From 573098f38fbc4006095cbbc9c2a80c7e45c7da8b Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Mon, 14 Aug 2017 21:07:08 +0100 Subject: [PATCH] Mac/Windows stubs and test case for environment inheritance --- cibuildwheel/macos.py | 2 +- cibuildwheel/windows.py | 2 +- test/05_environment/environment.json | 2 +- test/05_environment/setup.py | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index d98b9731..e6ff34f1 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -10,7 +10,7 @@ except ImportError: from .util import prepare_command -def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, skip): +def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, skip, environment): PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url']) python_configurations = [ PythonConfiguration(version='2.7', identifier='cp27-macosx_10_6_intel', url='https://www.python.org/ftp/python/2.7.13/python-2.7.13-macosx10.6.pkg'), diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 32a17853..1486c91b 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -10,7 +10,7 @@ from glob import glob from .util import prepare_command -def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, skip): +def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, skip, environment): # run_with_env is a cmd file that sets the right environment variables to run_with_env = os.path.join(tempfile.gettempdir(), 'appveyor_run_with_env.cmd') if not os.path.exists(run_with_env): diff --git a/test/05_environment/environment.json b/test/05_environment/environment.json index 582a1340..c97c84d7 100644 --- a/test/05_environment/environment.json +++ b/test/05_environment/environment.json @@ -1,3 +1,3 @@ { - "CIBW_ENVIRONMENT": "CIBW_TEST_VAR=\"a b c\" CIBW_TEST_VAR_2=1" + "CIBW_ENVIRONMENT": "CIBW_TEST_VAR=\"a b c\" CIBW_TEST_VAR_2=1 PATH=$PATH:/opt/cibw_test_path" } diff --git a/test/05_environment/setup.py b/test/05_environment/setup.py index 21f71264..3278c944 100644 --- a/test/05_environment/setup.py +++ b/test/05_environment/setup.py @@ -5,11 +5,17 @@ if sys.argv[-1] != '--name': # explode if environment isn't correct, as set in CIBW_ENVIRONMENT CIBW_TEST_VAR = os.environ.get('CIBW_TEST_VAR') CIBW_TEST_VAR_2 = os.environ.get('CIBW_TEST_VAR_2') + PATH = os.environ.get('PATH') if CIBW_TEST_VAR != 'a b c': raise Exception('CIBW_TEST_VAR should equal "a b c". It was "%s"' % CIBW_TEST_VAR) if CIBW_TEST_VAR_2 != '1': raise Exception('CIBW_TEST_VAR_2 should equal "1". It was "%s"' % CIBW_TEST_VAR_2) + if '/opt/cibw_test_path' not in PATH: + raise Exception('PATH should contain "/opt/cibw_test_path". It was "%s"' % PATH) + if '$PATH' in PATH: + raise Exception('$PATH should be expanded in PATH. It was "%s"' % PATH) + setup( name="spam",