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

fix: Don't error if no new wheels were built #1086

Merged
merged 13 commits into from Apr 22, 2022

Conversation

pauldmccarthy
Copy link
Contributor

Howdy, this PR contains a simple fix for an issue which I came across when using the --allow-empty flag. There is some logic in cibuildwheel.util.print_new_wheels which is raising an error if no new wheels were built.

mkdir testproj && cd testproj && touch setup.py
CIBW_BUILD="don't match anything" cibuildwheel --platform=linux --allow-empty
     _ _       _ _   _       _           _
 ___|_| |_ _ _|_| |_| |_ _ _| |_ ___ ___| |
|  _| | . | | | | | . | | | |   | -_| -_| |
|___|_|___|___|_|_|___|_____|_|_|___|___|_|

cibuildwheel version 2.4.0

Build options:
  platform: 'linux'
  architectures: {<Architecture.i686: 'i686'>, <Architecture.x86_64: 'x86_64'>}
  build_selector: BuildSelector(skip_config='', build_config="don't match anything", requires_python=None, prerelease_pythons=False)
  output_dir: PosixPath('wheelhouse')
  package_dir: PosixPath('.')
  test_selector: TestSelector(skip_config='', build_config='*', requires_python=None, prerelease_pythons=False)
  before_all: ''
  before_build: ''
  before_test: ''
  build_frontend: 'pip'
  build_verbosity: 0
  dependency_constraints: DependencyConstraints(PosixPath('/home/paulmc/Projects/cibuildwheel/cibuildwheel/resources/constraints.txt'))
  environment: ParsedEnvironment([])
  manylinux_images: {'x86_64': 'quay.io/pypa/manylinux2014_x86_64:2022-04-03-da6ecb3', 'i686': 'quay.io/pypa/manylinux2014_i686:2022-04-03-da6ecb3', 'pypy_x86_64': 'quay.io/pypa/manylinux2014_x86_64:2022-04-03-da6ecb3', 'aarch64': 'quay.io/pypa/manylinux2014_aarch64:2022-04-03-da6ecb3', 'ppc64le': 'quay.io/pypa/manylinux2014_ppc64le:2022-04-03-da6ecb3', 's390x': 'quay.io/pypa/manylinux2014_s390x:2022-04-03-da6ecb3', 'pypy_aarch64': 'quay.io/pypa/manylinux2014_aarch64:2022-04-03-da6ecb3', 'pypy_i686': 'quay.io/pypa/manylinux2014_i686:2022-04-03-da6ecb3'}
  musllinux_images: {'x86_64': 'quay.io/pypa/musllinux_1_1_x86_64:2022-04-03-da6ecb3', 'i686': 'quay.io/pypa/musllinux_1_1_i686:2022-04-03-da6ecb3', 'aarch64': 'quay.io/pypa/musllinux_1_1_aarch64:2022-04-03-da6ecb3', 'ppc64le': 'quay.io/pypa/musllinux_1_1_ppc64le:2022-04-03-da6ecb3', 's390x': 'quay.io/pypa/musllinux_1_1_s390x:2022-04-03-da6ecb3'}
  repair_command: 'auditwheel repair -w {dest_dir} {wheel}'
  test_command: ''
  test_extras: ''
  test_requires: []
Cache folder: /home/paulmc/.cache/cibuildwheel

Here we go!

cibuildwheel: No build identifiers selected: BuildSelector(skip_config='', build_config="don't match anything", requires_python=None, prerelease_pythons=False)
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/paulmc/Projects/cibuildwheel/cibuildwheel/__main__.py", line 295, in <module>
    main()
  File "/home/paulmc/Projects/cibuildwheel/cibuildwheel/__main__.py", line 213, in main
    assert_never(platform)
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/paulmc/Projects/cibuildwheel/cibuildwheel/util.py", line 433, in print_new_wheels
    max_name_len = max(len(f.name) for f in new_contents)
ValueError: max() arg is an empty sequence

✗ echo $?
1

With this PR:

CIBW_BUILD="don't match anything" cibuildwheel --platform=linux --allow-empty
     _ _       _ _   _       _           _
 ___|_| |_ _ _|_| |_| |_ _ _| |_ ___ ___| |
|  _| | . | | | | | . | | | |   | -_| -_| |
|___|_|___|___|_|_|___|_____|_|_|___|___|_|

cibuildwheel version 2.4.0

Build options:
  platform: 'linux'
  architectures: {<Architecture.x86_64: 'x86_64'>, <Architecture.i686: 'i686'>}
  build_selector: BuildSelector(skip_config='', build_config="don't match anything", requires_python=None, prerelease_pythons=False)
  output_dir: PosixPath('wheelhouse')
  package_dir: PosixPath('.')
  test_selector: TestSelector(skip_config='', build_config='*', requires_python=None, prerelease_pythons=False)
  before_all: ''
  before_build: ''
  before_test: ''
  build_frontend: 'pip'
  build_verbosity: 0
  dependency_constraints: DependencyConstraints(PosixPath('/home/paulmc/Projects/cibuildwheel/cibuildwheel/resources/constraints.txt'))
  environment: ParsedEnvironment([])
  manylinux_images: {'x86_64': 'quay.io/pypa/manylinux2014_x86_64:2022-04-03-da6ecb3', 'i686': 'quay.io/pypa/manylinux2014_i686:2022-04-03-da6ecb3', 'pypy_x86_64': 'quay.io/pypa/manylinux2014_x86_64:2022-04-03-da6ecb3', 'aarch64': 'quay.io/pypa/manylinux2014_aarch64:2022-04-03-da6ecb3', 'ppc64le': 'quay.io/pypa/manylinux2014_ppc64le:2022-04-03-da6ecb3', 's390x': 'quay.io/pypa/manylinux2014_s390x:2022-04-03-da6ecb3', 'pypy_aarch64': 'quay.io/pypa/manylinux2014_aarch64:2022-04-03-da6ecb3', 'pypy_i686': 'quay.io/pypa/manylinux2014_i686:2022-04-03-da6ecb3'}
  musllinux_images: {'x86_64': 'quay.io/pypa/musllinux_1_1_x86_64:2022-04-03-da6ecb3', 'i686': 'quay.io/pypa/musllinux_1_1_i686:2022-04-03-da6ecb3', 'aarch64': 'quay.io/pypa/musllinux_1_1_aarch64:2022-04-03-da6ecb3', 'ppc64le': 'quay.io/pypa/musllinux_1_1_ppc64le:2022-04-03-da6ecb3', 's390x': 'quay.io/pypa/musllinux_1_1_s390x:2022-04-03-da6ecb3'}
  repair_command: 'auditwheel repair -w {dest_dir} {wheel}'
  test_command: ''
  test_extras: ''
  test_requires: []
Cache folder: /home/paulmc/.cache/cibuildwheel

Here we go!

cibuildwheel: No build identifiers selected: BuildSelector(skip_config='', build_config="don't match anything", requires_python=None, prerelease_pythons=False)
No new wheels

✗ echo $?
0

Let me know if you'd like anything adjusted (e.g. the message that is printed). I'm also happy to add an integration test if you could point me to the right place to add it.

Thanks!

Copy link
Contributor

@joerick joerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. A test would also be good, you could add an integration test in the test_0_basic module.

cibuildwheel/util.py Outdated Show resolved Hide resolved
@pauldmccarthy
Copy link
Contributor Author

Hi @joerick, I'm not entirely sure of the cause of this test failure - any thoughts?

https://app.travis-ci.com/github/pypa/cibuildwheel/jobs/567099381#L339-L359

@joerick
Copy link
Contributor

joerick commented Apr 16, 2022

Looks like a flaky test/random failure. I've restarted it.

Copy link
Contributor

@joerick joerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, thanks! A few things to tweak and we can get this in 🙂

cibuildwheel/macos.py Outdated Show resolved Hide resolved
cibuildwheel/windows.py Outdated Show resolved Hide resolved
test/utils.py Outdated Show resolved Hide resolved
test/utils.py Outdated Show resolved Hide resolved
test/test_0_basic.py Outdated Show resolved Hide resolved
@pauldmccarthy
Copy link
Contributor Author

@joerick all requested changes made - over to you!

Copy link
Contributor

@joerick joerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you!

cibuildwheel/macos.py Outdated Show resolved Hide resolved
@joerick joerick merged commit dff6925 into pypa:main Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants