How to use the cibuildwheel.util function in cibuildwheel

To help you get started, we’ve selected a few cibuildwheel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joerick / cibuildwheel / test / test_dependency_versions.py View on Github external
build_environment = {}

    if python_version == '2.7':
        constraint_filename = 'constraints-python27.txt'
        build_pattern = '[cp]p27-*'
    elif python_version == '3.5':
        constraint_filename = 'constraints-python35.txt'
        build_pattern = '[cp]p35-*'
    elif python_version == '3.6':
        constraint_filename = 'constraints-python36.txt'
        build_pattern = '[cp]p36-*'
    else:
        constraint_filename = 'constraints.txt'
        build_pattern = '[cp]p38-*'

    constraint_file = cibuildwheel.util.resources_dir / constraint_filename
    constraint_versions = get_versions_from_constraint_file(constraint_file)

    for package in ['pip', 'setuptools', 'wheel', 'virtualenv']:
        env_name = f'EXPECTED_{package.upper()}_VERSION'
        build_environment[env_name] = constraint_versions[package]

    cibw_environment_option = ' '.join(
        [f'{k}={v}' for k, v in build_environment.items()]
    )

    # build and test the wheels
    actual_wheels = utils.cibuildwheel_run(project_dir, add_env={
        'CIBW_BUILD': build_pattern,
        'CIBW_ENVIRONMENT': cibw_environment_option,
    })
github joerick / cibuildwheel / unit_test / main_util_fixtures.py View on Github external
def mock_protection(monkeypatch):
    '''
    Ensure that a unit test will never actually run a cibuildwheel 'build'
    function, which shouldn't be run on a developer's machine
    '''

    def fail_on_call(*args, **kwargs):
        raise RuntimeError("This should never be called")

    monkeypatch.setattr(subprocess, 'Popen', fail_on_call)
    monkeypatch.setattr(util, 'download', fail_on_call)
    monkeypatch.setattr(windows, 'build', fail_on_call)
    monkeypatch.setattr(linux, 'build', fail_on_call)
    monkeypatch.setattr(macos, 'build', fail_on_call)