* master: (28 commits) Update README to combine environment sections Update README os.path.samefile is not available on windows. Add shell-style execution on the Mac Use os.path.samefile to get around filename case insensitivity Add test for before_build executing in a shell Fix some linter warnings Add CIBW_ENVIRONMENT to README and reorder options Fix empty env string case Fix string splitting for the env string Making call from run_tests to run_test subprocess.check_call Fixing 'ValueError: Attempted relative import in non-package' Update README.md Reducing code duplication in bin/run_test.py and bin/run_tests.py Semicolons need quoting Ignore vscode project settings Windows uses a different pathsep so have to use that in the test Make shell evals work and add tests for that Use parse_environment in the main code Run the unit tests in CI ... # Conflicts: # .travis.yml # appveyor.yml # run_tests.py
46 lines
1.3 KiB
Python
Executable File
46 lines
1.3 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
from __future__ import print_function
|
|
import os, sys, subprocess, shutil, json
|
|
from glob import glob
|
|
|
|
def single_run(test_project):
|
|
# load project settings into environment
|
|
env_file = os.path.join(test_project, 'environment.json')
|
|
project_env = {}
|
|
if os.path.exists(env_file):
|
|
with open(env_file) as f:
|
|
project_env = json.load(f)
|
|
|
|
# run the build
|
|
env = os.environ.copy()
|
|
project_env = {str(k): str(v) for k, v in project_env.items()} # unicode not allowed in env
|
|
env.update(project_env)
|
|
print('Building %s with environment %s' % (test_project, project_env))
|
|
subprocess.check_call([sys.executable, '-m', 'cibuildwheel', test_project], env=env)
|
|
wheels = glob('wheelhouse/*.whl')
|
|
print('%s built successfully. %i wheels built.' % (test_project, len(wheels)))
|
|
|
|
# check some wheels were actually built
|
|
assert len(wheels) >= 4
|
|
|
|
# clean up
|
|
shutil.rmtree('wheelhouse')
|
|
|
|
if __name__ == '__main__':
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("test_project_dir")
|
|
args = parser.parse_args()
|
|
|
|
project_path = os.path.abspath(args.test_project_dir)
|
|
|
|
if not os.path.exists(project_path):
|
|
print('No test project not found.', file=sys.stderr)
|
|
exit(2)
|
|
|
|
single_run(project_path)
|
|
|
|
print('Project built successfully.')
|