diff --git a/setup.py b/setup.py index 0a32520f..1556207a 100644 --- a/setup.py +++ b/setup.py @@ -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( "\\", "/" )