Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CIBW_FROM_PYPI option #94

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cibuildwheel/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def main():
build_verbosity = get_option_from_environment('CIBW_BUILD_VERBOSITY', platform=platform, default='')
skip_config = os.environ.get('CIBW_SKIP', '')
environment_config = get_option_from_environment('CIBW_ENVIRONMENT', platform=platform, default='')
from_pypi = os.environ.get('CIBW_FROM_PYPI', '')

try:
build_verbosity = min(3, max(-3, int(build_verbosity)))
Expand Down Expand Up @@ -136,6 +137,7 @@ def main():
build_verbosity=build_verbosity,
skip=skip,
environment=environment,
from_pypi=from_pypi,
)

if platform == 'linux':
Expand Down
5 changes: 3 additions & 2 deletions cibuildwheel/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DockerRunTimeoutError(Exception):
pass


def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, skip, environment, manylinux1_images):
def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, skip, environment, manylinux1_images, from_pypi):
try:
subprocess.check_call(['docker', '--version'])
except:
Expand Down Expand Up @@ -80,7 +80,7 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be
ls -l /host

# Build that wheel
PATH="$PYBIN:$PATH" "$PYBIN/pip" wheel . -w /tmp/built_wheel --no-deps {build_verbosity_flag}
PATH="$PYBIN:$PATH" "$PYBIN/pip" wheel {pypi_or_dir} -w /tmp/built_wheel --no-deps {build_verbosity_flag}
built_wheel=(/tmp/built_wheel/*.whl)

# Delocate the wheel
Expand Down Expand Up @@ -125,6 +125,7 @@ def build(project_dir, package_name, output_dir, test_command, test_requires, be
),
build_verbosity_flag=' '.join(get_build_verbosity_extra_flags(build_verbosity)),
environment_exports='\n'.join(environment.as_shell_commands()),
pypi_or_dir=from_pypi or '.',
uid=os.getuid(),
gid=os.getgid(),
)
Expand Down
4 changes: 2 additions & 2 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .util import prepare_command, get_build_verbosity_extra_flags


def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, skip, environment):
def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, skip, environment, from_pypi):
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.15/python-2.7.15-macosx10.6.pkg'),
Expand Down Expand Up @@ -104,7 +104,7 @@ def call(args, env=None, cwd=None, shell=False):
call(before_build_prepared, env=env, shell=True)

# build the wheel
call(['pip', 'wheel', abs_project_dir, '-w', '/tmp/built_wheel', '--no-deps'] + get_build_verbosity_extra_flags(build_verbosity), env=env)
call(['pip', 'wheel', from_pypi or abs_project_dir, '-w', '/tmp/built_wheel', '--no-deps'] + get_build_verbosity_extra_flags(build_verbosity), env=env)
built_wheel = glob('/tmp/built_wheel/*.whl')[0]

if built_wheel.endswith('none-any.whl'):
Expand Down
4 changes: 2 additions & 2 deletions cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .util import prepare_command, get_build_verbosity_extra_flags


def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, skip, environment):
def build(project_dir, package_name, output_dir, test_command, test_requires, before_build, build_verbosity, skip, environment, from_pypi):
# 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):
Expand Down Expand Up @@ -85,7 +85,7 @@ def shell(args, env=None, cwd=None):
shell([before_build_prepared], env=env)

# build the wheel
shell(['pip', 'wheel', abs_project_dir, '-w', built_wheel_dir, '--no-deps'] + get_build_verbosity_extra_flags(build_verbosity), env=env)
shell(['pip', 'wheel', from_pypi or abs_project_dir, '-w', built_wheel_dir, '--no-deps'] + get_build_verbosity_extra_flags(build_verbosity), env=env)
built_wheel = glob(built_wheel_dir+'/*.whl')[0]

# install the wheel
Expand Down