summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-09-13 08:38:45 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-09-13 08:38:45 +0200
commitcaf63452514c800a3b1d6be653b150b1510705ab (patch)
treeaf48473b4c8b6fde015dc7baf59c3c3ec852fd76
parent41febf947555ce2e91790c8dc1e4f4c222b00952 (diff)
downloadqutebrowser-caf63452514c800a3b1d6be653b150b1510705ab.tar.gz
qutebrowser-caf63452514c800a3b1d6be653b150b1510705ab.zip
requirements: Test --use-feature=in-tree-build
-rw-r--r--misc/requirements/requirements-pylint.txt-raw3
-rw-r--r--scripts/dev/recompile_requirements.py16
2 files changed, 16 insertions, 3 deletions
diff --git a/misc/requirements/requirements-pylint.txt-raw b/misc/requirements/requirements-pylint.txt-raw
index 08d340665..ccee2ac10 100644
--- a/misc/requirements/requirements-pylint.txt-raw
+++ b/misc/requirements/requirements-pylint.txt-raw
@@ -12,3 +12,6 @@ pefile
# Already included via test requirements
#@ ignore: urllib3
+
+# For pylint_checkers
+#@ pip_args: --use-feature=in-tree-build
diff --git a/scripts/dev/recompile_requirements.py b/scripts/dev/recompile_requirements.py
index d8ed9974b..7a7d66c0e 100644
--- a/scripts/dev/recompile_requirements.py
+++ b/scripts/dev/recompile_requirements.py
@@ -238,6 +238,7 @@ def read_comments(fobj):
'add': [],
'replace': {},
'pre': False,
+ 'pip_args': [],
}
for line in fobj:
if line.startswith('#@'):
@@ -267,6 +268,8 @@ def read_comments(fobj):
comments['add'].append(args)
elif command == 'pre':
comments['pre'] = True
+ elif command == 'pip_args':
+ comments['pip_args'] += args.split()
return comments
@@ -290,7 +293,7 @@ def run_pip(venv_dir, *args, quiet=False, **kwargs):
return subprocess.run([venv_python, '-m', 'pip'] + args, check=True, **kwargs)
-def init_venv(host_python, venv_dir, requirements, pre=False):
+def init_venv(host_python, venv_dir, requirements, pre=False, pip_args=None):
"""Initialize a new virtualenv and install the given packages."""
with utils.gha_group('Creating virtualenv'):
utils.print_col('$ python3 -m venv {}'.format(venv_dir), 'blue')
@@ -302,6 +305,8 @@ def init_venv(host_python, venv_dir, requirements, pre=False):
install_command = ['install', '-r', requirements]
if pre:
install_command.append('--pre')
+ if pip_args:
+ install_command += pip_args
with utils.gha_group('Installing requirements'):
run_pip(venv_dir, *install_command)
@@ -497,7 +502,8 @@ def build_requirements(name):
init_venv(host_python=host_python,
venv_dir=tmpdir,
requirements=filename,
- pre=comments['pre'])
+ pre=comments['pre'],
+ pip_args=comments['pip_args'])
with utils.gha_group('Freezing requirements'):
args = ['--all'] if name == 'tox' else []
proc = run_pip(tmpdir, 'freeze', *args, stdout=subprocess.PIPE)
@@ -556,9 +562,13 @@ def test_requirements(name, outfile, *, force=False):
print(f"Skipping test as there were no changes for {name}.")
return
+ in_file = os.path.join(REQ_DIR, 'requirements-{}.txt-raw'.format(name))
+ with open(in_file, 'r', encoding='utf-8') as f:
+ comments = read_comments(f)
+
host_python = get_host_python(name)
with tempfile.TemporaryDirectory() as tmpdir:
- init_venv(host_python, tmpdir, outfile)
+ init_venv(host_python, tmpdir, outfile, pip_args=comments['pip_args'])
def main():