Add before_build option, that runs a shell command before 'pip wheel'

This commit is contained in:
Joe Rickerby
2017-04-10 21:42:12 +01:00
parent 56f9a37165
commit 2679cb7f46
9 changed files with 147 additions and 22 deletions
+8 -1
View File
@@ -7,8 +7,10 @@ try:
except ImportError:
from pipes import quote as shlex_quote
from .util import prepare_command
def build(project_dir, package_name, output_dir, test_command, test_requires):
def build(project_dir, package_name, output_dir, test_command, test_requires, before_build):
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'url'])
python_configurations = [
PythonConfiguration(version='2.7', url='https://www.python.org/ftp/python/2.7.13/python-2.7.13-macosx10.6.pkg'),
@@ -47,6 +49,11 @@ def build(project_dir, package_name, output_dir, test_command, test_requires):
shell([pip, 'install', 'wheel'], env=env)
shell([pip, 'install', 'delocate'], env=env)
# run the before_build command
if before_build:
before_build_prepared = prepare_command(before_build, python=python, pip=pip)
shell(shlex.split(before_build_prepared), env=env)
# build the wheel to temp dir
temp_wheel_dir = '/tmp/tmpwheel%s' % config.version
shell([pip, 'wheel', project_dir, '-w', temp_wheel_dir], env=env)