Skip to content

Commit a39a6c1

Browse files
committed
Fix wheels bundling wrong Python version
pybind11 v3.0.1 reads `Python_EXECUTABLE` instead of `PYTHON_EXECUTABLE`. The old variable name was silently ignored so that CMake's FindPython picked up whatever Python was first in the system PATH instead of the one running the build. Fixes #34
1 parent 235d720 commit a39a6c1

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
cmake_minimum_required(VERSION 3.15)
44
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
55

6-
message(STATUS "Found Python prefix ${PYTHON_PREFIX}")
7-
list(PREPEND CMAKE_PREFIX_PATH "${PYTHON_PREFIX}")
8-
96
project(python-samplerate)
107
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
118

12-
cmake_policy(SET CMP0148 NEW)
9+
set(PYBIND11_FINDPYTHON ON)
1310

1411
# adds the external dependencies
1512
add_subdirectory(external)

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ def build_extension(self, ext: CMakeExtension) -> None:
4646
# Can be set with Conda-Build, for example.
4747
cmake_generator = os.environ.get("CMAKE_GENERATOR", "")
4848

49-
# Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON
5049
# EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code
5150
# from Python.
5251
cmake_args = [
5352
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}",
54-
f"-DPYTHON_EXECUTABLE={sys.executable}",
53+
f"-DPython_EXECUTABLE={sys.executable}",
5554
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
5655
]
5756
build_args = []

0 commit comments

Comments
 (0)