Skip to content

Commit 8c8014f

Browse files
committed
Cleaner CPATH and C_INC_PATH handling
1 parent c1b8cac commit 8c8014f

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎setup.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
def create_ecodes(headers=None):
1515
if not headers:
1616
include_paths = set()
17-
if os.environ.get("CPATH", "").strip() != "":
18-
include_paths.update(os.environ["CPATH"].split(":"))
19-
if os.environ.get("C_INCLUDE_PATH", "").strip() != "":
20-
include_paths.update(os.environ["C_INCLUDE_PATH"].split(":"))
17+
cpath = os.environ.get("CPATH", "").strip()
18+
c_inc_path = os.environ.get("C_INCLUDE_PATH", "").strip()
19+
20+
if cpath:
21+
include_paths.update(cpath.split(":"))
22+
if c_inc_path:
23+
include_paths.update(c_inc_path.split(":"))
24+
2125
include_paths.add("/usr/include")
2226
files = ["linux/input.h", "linux/input-event-codes.h", "linux/uinput.h"]
2327
headers = [os.path.join(path, file) for path in include_paths for file in files]

0 commit comments

Comments
 (0)