Skip to content

Commit 11728e8

Browse files
committed
BUG, Benchmark: fix passing optimization build options to asv
1 parent 5f071c6 commit 11728e8

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

benchmarks/asv_compare.conf.json.tpl

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@
7878

7979
"build_command" : [
8080
"python setup.py build {numpy_build_options}",
81-
"PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"
81+
// pip ignores '--global-option' when pep517 is enabled, we also enabling pip verbose to
82+
// be reached from asv `--verbose` so we can verify the build options.
83+
"PIP_NO_BUILD_ISOLATION=false python {build_dir}/benchmarks/asv_pip_nopep517.py -v {numpy_global_options} --no-deps --no-index -w {build_cache_dir} {build_dir}"
8284
],
8385
// The commits after which the regression search in `asv publish`
8486
// should start looking for regressions. Dictionary whose keys are

benchmarks/asv_pip_nopep517.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
This file is used by asv_compare.conf.json.tpl.
3+
"""
4+
import subprocess, sys
5+
# pip ignores '--global-option' when pep517 is enabled therefore we disable it.
6+
cmd = [sys.executable, '-mpip', 'wheel', '--no-use-pep517']
7+
try:
8+
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
9+
except Exception as e:
10+
output = str(e.output)
11+
if "no such option" in output:
12+
print("old version of pip, escape '--no-use-pep517'")
13+
cmd.pop()
14+
15+
subprocess.run(cmd + sys.argv[1:])

runtests.py

+1
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ def asv_compare_config(bench_path, args, h_commits):
524524

525525
is_cached = asv_substitute_config(conf_path, nconf_path,
526526
numpy_build_options = ' '.join([f'\\"{v}\\"' for v in build]),
527+
numpy_global_options= ' '.join([f'--global-option=\\"{v}\\"' for v in ["build"] + build])
527528
)
528529
if not is_cached:
529530
asv_clear_cache(bench_path, h_commits)

0 commit comments

Comments
 (0)