Skip to content

Commit

Permalink
Temporary hack to fix build regression with Scikit-build 0.17.3 and n…
Browse files Browse the repository at this point in the history
…ewer.
  • Loading branch information
asmorkalov committed May 30, 2023
1 parent 0ba2c80 commit 46d2ddf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ def main():
]

python_version = cmaker.CMaker.get_python_version()
python_lib_path = (cmaker.CMaker.get_python_library(python_version) or "").replace(
"\\", "/"
)
python_lib_path = cmaker.CMaker.get_python_library(python_version) or ""
# HACK: For Scikit-build 0.17.3 and newer that returns None or empty sptring for PYTHON_LIBRARY in manylinux2014
# A small release related to PYTHON_LIBRARY handling changes in 0.17.2; scikit-build 0.17.3 returns an empty string from get_python_library if no Python library is present (like on manylinux), where 0.17.2 returned None, and previous versions returned a non-existent path. Note that adding REQUIRED to find_package(PythonLibs will fail, but it is incorrect (you must not link to libPython.so) and was really just injecting a non-existent path before.
# TODO: Remove the hack when the issue is handled correctly in main OpenCV CMake.
if python_lib_path == "":
python_lib_path = "libpython%sm.a" % python_version
python_lib_path = python_lib_path.replace("\\", "/")

python_include_dir = cmaker.CMaker.get_python_include_dir(python_version).replace(
"\\", "/"
)
Expand Down

0 comments on commit 46d2ddf

Please sign in to comment.