Skip to content

Commit 4448caf

Browse files
scripts/test.py: allow -i to specify installation of local .whl files.
1 parent 8718806 commit 4448caf

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

scripts/test.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,13 @@
176176
Default is 'r'. Also see `PyMuPDF:tests/run_compound.py`.
177177
178178
-i <install_version>
179-
Set version installed by the 'install' command.
179+
Controls behaviour of `install` command:
180+
181+
* If <install_version> ends with `.whl` we use `pip install
182+
<install_version>`.
183+
* If <install_version> starts with == or >= or >, we use `pip install
184+
pymupdf<install_version>`.
185+
* Otherwise we use `pip install pymupdf==<install_version>`.
180186
181187
-k <expression>
182188
Specify which test(s) to run; passed straight through to pytest's `-k`.
@@ -684,9 +690,12 @@ def main(argv):
684690
elif command == 'install':
685691
p = 'pymupdf'
686692
if install_version:
687-
if not install_version.startswith(('==', '>=', '>')):
688-
p = f'{p}=='
689-
p = f'{p}{install_version}'
693+
if install_version.endswith('.whl'):
694+
p = install_version
695+
elif install_version.startswith(('==', '>=', '>')):
696+
p = f'{p}{install_version}'
697+
else:
698+
p = f'{p}=={install_version}'
690699
run(f'pip install --force-reinstall {p}')
691700
have_installed = True
692701

0 commit comments

Comments
 (0)