diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index cd7a7136..9b6ab4d1 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -1,7 +1,6 @@ from __future__ import print_function import os, subprocess, sys from collections import namedtuple -from .util import prepare_command try: from shlex import quote as shlex_quote @@ -105,9 +104,7 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be test_command=shlex_quote( test_command.format(project='/project') if test_command else '' ), - before_build=shlex_quote( - prepare_command(before_build, python='python', pip='pip') if before_build else '' - ), + before_build=shlex_quote(before_build or ''), environment_exports='\n'.join(environment.as_shell_commands()), ) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 836a7189..71a5716d 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -7,8 +7,6 @@ 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, before_build, skip, environment): PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url']) @@ -60,18 +58,15 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be ]) env = environment.as_dictionary(prev_environment=env) - python = 'python3' if config.version[0] == '3' else 'python2' - pip = 'pip3' if config.version[0] == '3' else 'pip2' - # check what version we're on - call(['which', python], env=env) - call([python, '--version'], env=env) + call(['which', 'python'], env=env) + call(['python', '--version'], env=env) # install pip & wheel - call([python, get_pip_script, '--no-setuptools', '--no-wheel'], env=env) - call([pip, '--version'], env=env) - call([pip, 'install', 'wheel'], env=env) - call([pip, 'install', 'delocate'], env=env) + call(['python', get_pip_script, '--no-setuptools', '--no-wheel'], env=env) + call(['pip', '--version'], env=env) + call(['pip', 'install', 'wheel'], env=env) + call(['pip', 'install', 'delocate'], env=env) # setup dirs if os.path.exists('/tmp/built_wheel'): @@ -83,11 +78,10 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be # run the before_build command if before_build: - before_build_prepared = prepare_command(before_build, python=python, pip=pip) - call(before_build_prepared, env=env, shell=True) + call(before_build, env=env, shell=True) # build the wheel - call([pip, 'wheel', abs_project_dir, '-w', '/tmp/built_wheel', '--no-deps'], env=env) + call(['pip', 'wheel', abs_project_dir, '-w', '/tmp/built_wheel', '--no-deps'], env=env) built_wheel = glob('/tmp/built_wheel/*.whl')[0] if built_wheel.endswith('none-any.whl'): @@ -101,11 +95,11 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be delocated_wheel = glob('/tmp/delocated_wheel/*.whl')[0] # install the wheel - call([pip, 'install', delocated_wheel], env=env) + call(['pip', 'install', delocated_wheel], env=env) # test the wheel if test_requires: - call([pip, 'install'] + test_requires, env=env) + call(['pip', 'install'] + test_requires, env=env) if test_command: # run the tests from $HOME, with an absolute path in the command # (this ensures that Python runs the tests against the installed wheel diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py index d860beeb..e15d2ddd 100644 --- a/cibuildwheel/util.py +++ b/cibuildwheel/util.py @@ -1,18 +1,6 @@ from fnmatch import fnmatch -def prepare_command(command, python, pip): - ''' - Preprocesses a command by expanding variables like {python} or {pip}. - - For example, used for the before_build option, where the user would - like to run a command like `python setup.py test`. If the command should run on - Python 3, the user could write `{python} setup.py test`. This command would expand - it out to python2 or python3 as appropriate. - ''' - return command.format(python=python, pip=pip) - - class BuildSkipper(object): def __init__(self, skip_config): self.patterns = skip_config.split() diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index 3c962af9..1ea37128 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -7,7 +7,7 @@ except ImportError: from collections import namedtuple from glob import glob -from .util import prepare_command, Unbuffered +from .util import Unbuffered def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, skip, environment): @@ -78,8 +78,7 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be # run the before_build command if before_build: - before_build_prepared = prepare_command(before_build, python='python', pip='pip') - shell([before_build_prepared], env=env) + shell([before_build], env=env) # build the wheel shell(['pip', 'wheel', abs_project_dir, '-w', built_wheel_dir, '--no-deps'], env=env)