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

show errors and check exit code for wheel filename formatting #960

Merged
Merged
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: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- name: "(vcpkg only) install setuptools"
if: ${{ matrix.package_manager == 'vcpkg' }}
run: |
pip install setuptools
pip install setuptools wheel

- name: Configure CMake
run: >
Expand Down
23 changes: 22 additions & 1 deletion cmake/MakePythonWheel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ except ImportError as e:
message(FATAL_ERROR "Python module `setuptools` required for correct wheel filename generation.")
endif()

execute_process(
COMMAND ${Python3_EXECUTABLE} -c "
import sys
try:
from wheel.bdist_wheel import bdist_wheel
sys.exit(0)
except ImportError as e:
print(f'{e}. Search paths:', file=sys.stderr)
for p in sys.path: print(f' {p}', file=sys.stderr)
sys.exit(1)
"
RESULT_VARIABLE has_bdist_wheel)

if(has_bdist_wheel EQUAL "1")
message(FATAL_ERROR "Python module `wheel.bdist_wheel` required for correct wheel filename generation.")
endif()

execute_process(
COMMAND ${Python3_EXECUTABLE} -c "
from setuptools.dist import Distribution
Expand All @@ -46,9 +63,13 @@ print(wheel_name(name='${python_module}', version='${version}', ext_modules=[Ext
"
OUTPUT_VARIABLE wheel_filename
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
RESULT_VARIABLE has_wheel_filename
)

if(NOT has_wheel_filename EQUAL "0")
message(FATAL_ERROR "Cannot format wheel filename via 'setuptools'.")
endif()

set(wheel_filename "${CMAKE_BINARY_DIR}/${wheel_filename}.whl")
set(wheel_distinfo "${CMAKE_BINARY_DIR}/${python_module}-${version}.dist-info")
set(wheel_data "${CMAKE_BINARY_DIR}/${python_module}-${version}.data")
Expand Down
Loading