2017-07-24 22:38:48 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
|
|
from __future__ import print_function
|
2017-09-06 15:07:58 +02:00
|
|
|
import os, sys, subprocess, shutil, json
|
2017-07-24 22:38:48 +01:00
|
|
|
from glob import glob
|
|
|
|
|
|
2017-09-06 15:07:58 +02:00
|
|
|
def single_run(test_project):
|
2017-07-24 22:38:48 +01:00
|
|
|
# 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))
|
2017-09-07 18:55:33 +01:00
|
|
|
subprocess.check_call([sys.executable, '-m', 'cibuildwheel', test_project], env=env)
|
2017-07-24 22:38:48 +01:00
|
|
|
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')
|
|
|
|
|
|
2017-09-06 15:07:58 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
|
import argparse
|
2017-07-24 22:38:48 +01:00
|
|
|
|
2017-09-06 15:07:58 +02:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
parser.add_argument("test_project_dir")
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
project_path = os.path.abspath(args.test_project_dir)
|
2017-09-06 16:14:39 +02:00
|
|
|
|
2017-09-06 15:07:58 +02:00
|
|
|
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.')
|