diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-03-12 12:42:55 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-03-12 12:43:14 +0100 |
commit | 98d7982e24da00bf9d41099e07831c3909873dff (patch) | |
tree | 5cf9c5aceacdcb379abfb436514d75f042d6dffd | |
parent | 5de52f8a809c16878e1cedddd9f74be6814506fa (diff) | |
download | qutebrowser-98d7982e24da00bf9d41099e07831c3909873dff.tar.gz qutebrowser-98d7982e24da00bf9d41099e07831c3909873dff.zip |
Make recompile_requirements run on Windows
(cherry picked from commit c9cb42d3cd4e1243c3cdf32e09c828088b62fce7)
-rw-r--r-- | scripts/dev/recompile_requirements.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/dev/recompile_requirements.py b/scripts/dev/recompile_requirements.py index 1849a5218..f9a94bfe3 100644 --- a/scripts/dev/recompile_requirements.py +++ b/scripts/dev/recompile_requirements.py @@ -279,7 +279,7 @@ def run_pip(venv_dir, *args, quiet=False, **kwargs): arg_str = ' '.join(str(arg) for arg in args) utils.print_col('venv$ pip {}'.format(arg_str), 'blue') - venv_python = os.path.join(venv_dir, 'bin', 'python') + venv_python = get_venv_python(venv_dir) return subprocess.run([venv_python, '-m', 'pip'] + args, check=True, **kwargs) @@ -458,6 +458,12 @@ def get_host_python(name): return sys.executable +def get_venv_python(venv_dir): + """Get the path to Python inside a virtualenv.""" + subdir = 'Scripts' if os.name == 'nt' else 'bin' + return os.path.join(venv_dir, subdir, 'python') + + def get_outfile(name): """Get the path to the output requirements.txt file.""" if name == 'qutebrowser': @@ -510,7 +516,7 @@ def test_tox(): with tempfile.TemporaryDirectory() as tmpdir: venv_dir = os.path.join(tmpdir, 'venv') tox_workdir = os.path.join(tmpdir, 'tox-workdir') - venv_python = os.path.join(venv_dir, 'bin', 'python') + venv_python = get_venv_python(venv_dir) init_venv(host_python, venv_dir, req_path) list_proc = subprocess.run([venv_python, '-m', 'tox', '--listenvs'], check=True, |