File indexing completed on 2025-01-18 10:17:50
0001 import os
0002
0003 DIR = os.path.abspath(os.path.dirname(__file__))
0004
0005
0006 def get_include(user: bool = False) -> str:
0007 """
0008 Return the path to the pybind11 include directory. The historical "user"
0009 argument is unused, and may be removed.
0010 """
0011 installed_path = os.path.join(DIR, "include")
0012 source_path = os.path.join(os.path.dirname(DIR), "include")
0013 return installed_path if os.path.exists(installed_path) else source_path
0014
0015
0016 def get_cmake_dir() -> str:
0017 """
0018 Return the path to the pybind11 CMake module directory.
0019 """
0020 cmake_installed_path = os.path.join(DIR, "share", "cmake", "pybind11")
0021 if os.path.exists(cmake_installed_path):
0022 return cmake_installed_path
0023
0024 msg = "pybind11 not installed, installation required to access the CMake files"
0025 raise ImportError(msg)
0026
0027
0028 def get_pkgconfig_dir() -> str:
0029 """
0030 Return the path to the pybind11 pkgconfig directory.
0031 """
0032 pkgconfig_installed_path = os.path.join(DIR, "share", "pkgconfig")
0033 if os.path.exists(pkgconfig_installed_path):
0034 return pkgconfig_installed_path
0035
0036 msg = "pybind11 not installed, installation required to access the pkgconfig files"
0037 raise ImportError(msg)