diff --git a/setup.py b/setup.py index fe56d0e9..9048a2ce 100755 --- a/setup.py +++ b/setup.py @@ -1114,6 +1114,13 @@ def sdist(): ('Tracker, https://github.com/pymupdf/PyMuPDF/issues'), ('Changelog, https://pymupdf.readthedocs.io/en/latest/changes.html'), ], + + # Create a `fitz` command. + entry_points = textwrap.dedent(''' + [console_scripts] + pymupdf = fitz.__main__:main + '''), + fn_build=build, fn_sdist=sdist, diff --git a/tests/test_general.py b/tests/test_general.py index f3886379..9b1f5475 100644 --- a/tests/test_general.py +++ b/tests/test_general.py @@ -916,3 +916,10 @@ def next_fd(): fd2 = next_fd() assert fd2 == fd1, f'{fd1=} {fd2=}' os.remove(oldfile) + +def test_cli(): + if not hasattr(fitz, 'mupdf'): + print('test_cli(): Not running on classic because of fitz_old.') + return + import subprocess + subprocess.run(f'pymupdf -h', shell=1, check=1)