Skip to content

Commit

Permalink
respect CPATH/C_INCLUDE_PATH #195)
Browse files Browse the repository at this point in the history
  • Loading branch information
sezanzeb committed Dec 5, 2023
2 parents 2dd6ce6 + ae51cb1 commit e40753f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions evdev/genecodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
headers = [
'/usr/include/linux/input.h',
'/usr/include/linux/input-event-codes.h',
'/usr/include/linux/uinput.h',
]

if sys.argv[1:]:
Expand Down
13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@
#-----------------------------------------------------------------------------
def create_ecodes(headers=None):
if not headers:
headers = [
'/usr/include/linux/input.h',
'/usr/include/linux/input-event-codes.h',
'/usr/include/linux/uinput.h',
]
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(":"))
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]

headers = [header for header in headers if os.path.isfile(header)]
if not headers:
Expand Down

0 comments on commit e40753f

Please sign in to comment.