pybind11/pybind11/commands.py
Henry Schreiner 4b42c37191
style: pylint (#3720)
* fix: add pylint and fix issue

* chore: add pylint to pre-commit

* fix: local variable warning surfaced mistake in intree
2022-02-15 17:48:33 -05:00

26 lines
843 B
Python

import os
DIR = os.path.abspath(os.path.dirname(__file__))
def get_include(user: bool = False) -> str: # pylint: disable=unused-argument
"""
Return the path to the pybind11 include directory. The historical "user"
argument is unused, and may be removed.
"""
installed_path = os.path.join(DIR, "include")
source_path = os.path.join(os.path.dirname(DIR), "include")
return installed_path if os.path.exists(installed_path) else source_path
def get_cmake_dir() -> str:
"""
Return the path to the pybind11 CMake module directory.
"""
cmake_installed_path = os.path.join(DIR, "share", "cmake", "pybind11")
if os.path.exists(cmake_installed_path):
return cmake_installed_path
msg = "pybind11 not installed, installation required to access the CMake files"
raise ImportError(msg)