Skip to content

Commit

Permalink
Cleaner CPATH and C_INC_PATH handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gvalkov committed Jan 29, 2024
1 parent c1b8cac commit 8c8014f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
def create_ecodes(headers=None):
if not headers:
include_paths = set()
if os.environ.get("CPATH", "").strip() != "":
include_paths.update(os.environ["CPATH"].split(":"))
if os.environ.get("C_INCLUDE_PATH", "").strip() != "":
include_paths.update(os.environ["C_INCLUDE_PATH"].split(":"))
cpath = os.environ.get("CPATH", "").strip()
c_inc_path = os.environ.get("C_INCLUDE_PATH", "").strip()

if cpath:
include_paths.update(cpath.split(":"))
if c_inc_path:
include_paths.update(c_inc_path.split(":"))

include_paths.add("/usr/include")
files = ["linux/input.h", "linux/input-event-codes.h", "linux/uinput.h"]
headers = [os.path.join(path, file) for path in include_paths for file in files]
Expand Down

0 comments on commit 8c8014f

Please sign in to comment.