120120
121121 -m <location> | --mupdf <location>
122122 Location of local mupdf/ directory or 'git:...' to be used
123- when building PyMuPDF. [This sets environment variable
124- PYMUPDF_SETUP_MUPDF_BUILD, which is used by PyMuPDF/setup.py. If not
125- specified PyMuPDF will download its default mupdf .tgz.]
123+ when building PyMuPDF.
124+
125+ This sets environment variable PYMUPDF_SETUP_MUPDF_BUILD, which is used
126+ by PyMuPDF/setup.py. If not specified PyMuPDF will download its default
127+ mupdf .tgz.
128+
129+ Additionally if <location> starts with ':' we use the remaining text as
130+ the branch name and add https://github.com/ArtifexSoftware/mupdf.git.
131+
132+ For example:
133+
134+ -m "git:--branch master https://github.com/ArtifexSoftware/mupdf.git"
135+ -m :master
136+
137+ -m "git:--branch 1.26.x https://github.com/ArtifexSoftware/mupdf.git"
138+ -m :1.26.x
139+
126140
127141 -M 0|1
128142 --build-mupdf 0|1
181195 --timeout <seconds>
182196 Sets timeout when running tests.
183197
184- -T <command> | --pytest-prefix <command>
185- Use specified prefix when running pytest. E.g. `gdb --args`.
198+ -T <prefix>
199+ Use specified prefix when running pytest, must be one of:
200+ gdb
201+ helgrind
202+ vagrind
186203
187204 -v 0|1|2
188205 0 - do not use a venv.
192209 2 - Use venv
193210 The default is 2.
194211
195- --valgrind 0|1
196- Use valgrind in `test` or `buildtest`.
197- This will run `sudo apt update` and `sudo apt install valgrind`.
198-
199212Commands:
200213
201214 build
@@ -376,12 +389,6 @@ def main(argv):
376389 elif arg == '-f' :
377390 test_fitz = int (next (args ))
378391
379- elif arg == '--gdb' :
380- _gdb = int (next (args ))
381- if _gdb == 1 :
382- pytest_prefix = 'gdb'
383- warnings += f'{ arg = } is deprecated, use `-T gdb`.'
384-
385392 elif arg in ('-h' , '--help' ):
386393 show_help = True
387394
@@ -395,6 +402,10 @@ def main(argv):
395402 _mupdf = next (args )
396403 if _mupdf == '-' :
397404 _mupdf = None
405+ elif _mupdf .startswith (':' ):
406+ _branch = _mupdf [1 :]
407+ _mupdf = 'git:--branch {_branch} https://github.com/ArtifexSoftware/mupdf.git'
408+ os .environ ['PYMUPDF_SETUP_MUPDF_BUILD' ] = _mupdf
398409 elif _mupdf .startswith ('git:' ) or '://' in _mupdf :
399410 os .environ ['PYMUPDF_SETUP_MUPDF_BUILD' ] = _mupdf
400411 else :
@@ -439,19 +450,15 @@ def main(argv):
439450 elif arg == '--timeout' :
440451 test_timeout = float (next (args ))
441452
442- elif arg in ( '-T' , '--pytest-prefix' ) :
453+ elif arg == '-T' :
443454 pytest_prefix = next (args )
455+ assert pytest_prefix in ('gdb' , 'helgrind' , 'valgrind' ), \
456+ f'Unrecognised { pytest_prefix = } , should be one of: gdb valgrind helgrind.'
444457
445458 elif arg == '-v' :
446459 venv = int (next (args ))
447460 assert venv in (0 , 1 , 2 ), f'Invalid { venv = } should be 0, 1 or 2.'
448461
449- elif arg == '--valgrind' :
450- _valgrind = int (next (args ))
451- if _valgrind == 1 :
452- pytest_prefix = 'valgrind'
453- warnings += f'{ arg = } is deprecated, use `-T _valgrind`.'
454-
455462 elif arg in ('build' , 'cibw' , 'pyodide' , 'test' , 'wheel' ):
456463 commands .append (arg )
457464
0 commit comments