From 45074a9b3a67f30a7ec718b347612bb846357f54 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 13 Aug 2020 20:50:36 -0400 Subject: [PATCH 1/3] fix: add extra space after ] --- cibuildwheel/windows.py | 5 ++++- test/test_pep518.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index f793acf4..4ebdf691 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -177,8 +177,11 @@ def pep_518_cp35_workaround(package_dir: Path, env: Dict[str, str]) -> None: if 'build-system' in data else [] ) + if requirements: - shell(['pip', 'install'] + requirements, env=env) + # Workaround for bug when ]>= is present, #421 + requirements = [r.replace("]", "] ") for r in requirements] + call(['pip', 'install'] + requirements, env=env) def build(options: BuildOptions) -> None: diff --git a/test/test_pep518.py b/test/test_pep518.py index 9257f7db..fe8f8174 100644 --- a/test/test_pep518.py +++ b/test/test_pep518.py @@ -27,6 +27,7 @@ basic_project.files[ [build-system] requires = [ "setuptools >= 42", + "setuptools_scm[toml]>=4.1.2", "wheel", "requests==2.22.0; python_version<'3.6'", "requests==2.23.0; python_version>='3.6'" @@ -47,3 +48,6 @@ def test_pep518(tmp_path): # check that the expected wheels are produced expected_wheels = utils.expected_wheels("spam", "0.1.0") assert set(actual_wheels) == set(expected_wheels) + + assert not (project_dir / "42").exists() + assert not (project_dir / "4.1.2").exists() From 416c6f3a3cd39149441f3c3f63a4c4ef6bd1219c Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 14 Aug 2020 14:55:08 -0400 Subject: [PATCH 2/3] fix: file method of requirement installs --- cibuildwheel/windows.py | 9 ++++++--- test/test_pep518.py | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 4ebdf691..151f8a30 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -179,9 +179,12 @@ def pep_518_cp35_workaround(package_dir: Path, env: Dict[str, str]) -> None: ) if requirements: - # Workaround for bug when ]>= is present, #421 - requirements = [r.replace("]", "] ") for r in requirements] - call(['pip', 'install'] + requirements, env=env) + with tempfile.TemporaryDirectory() as d: + reqfile = Path(d) / "requirements.txt" + with reqfile.open("w") as f: + for r in requirements: + print(r, file=f) + call(['pip', 'install', '-r', str(reqfile)], env=env) def build(options: BuildOptions) -> None: diff --git a/test/test_pep518.py b/test/test_pep518.py index fe8f8174..58ed2c71 100644 --- a/test/test_pep518.py +++ b/test/test_pep518.py @@ -1,6 +1,7 @@ import textwrap from . import test_projects from . import utils +import os basic_project = test_projects.new_c_project( setup_py_add=textwrap.dedent( @@ -51,3 +52,5 @@ def test_pep518(tmp_path): assert not (project_dir / "42").exists() assert not (project_dir / "4.1.2").exists() + + assert len(os.listdir(project_dir)) == len(basic_project.files) From fd2b5d3270fd2544639d3c28b1eb32198dd0244b Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sun, 16 Aug 2020 14:05:39 -0400 Subject: [PATCH 3/3] refactor: minor tweaks from @joerick --- cibuildwheel/windows.py | 2 +- test/test_pep518.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 151f8a30..bca658c0 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -184,7 +184,7 @@ def pep_518_cp35_workaround(package_dir: Path, env: Dict[str, str]) -> None: with reqfile.open("w") as f: for r in requirements: print(r, file=f) - call(['pip', 'install', '-r', str(reqfile)], env=env) + call(['pip', 'install', '-r', reqfile], env=env) def build(options: BuildOptions) -> None: diff --git a/test/test_pep518.py b/test/test_pep518.py index 58ed2c71..77482f93 100644 --- a/test/test_pep518.py +++ b/test/test_pep518.py @@ -50,6 +50,8 @@ def test_pep518(tmp_path): expected_wheels = utils.expected_wheels("spam", "0.1.0") assert set(actual_wheels) == set(expected_wheels) + # These checks ensure an extra file is not created when using custom + # workaround; see https://github.com/joerick/cibuildwheel/issues/421 assert not (project_dir / "42").exists() assert not (project_dir / "4.1.2").exists()