Skip to content

Commit

Permalink
Ensure absolute include paths
Browse files Browse the repository at this point in the history
  • Loading branch information
honnibal committed Jan 8, 2025
1 parent e6d9116 commit db8e6a1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def compile_objects(self, platform, py_arch, obj_dir):
env = spec["environment"]
print(env)
continue
spec["includes"] = _ensure_abs_paths(BLIS_DIR, spec["include"])
_, target_name = os.path.split(spec["target"])
if platform == "windows":
target_name = target_name.replace("/", "\\")
Expand Down Expand Up @@ -270,7 +271,6 @@ def build_object(self, compiler, source, target, flags, macros, include, env=Non
command.extend(macros)
command.extend(include)
print("[COMMAND]", " ".join(command))
print("\n" * 500)
# TODO: change this to subprocess.run etc. once we drop 2.7
subprocess.check_call(command, cwd=BLIS_DIR)
return target
Expand All @@ -287,6 +287,16 @@ def chdir(new_dir):
del sys.path[0]
os.chdir(old_dir)

def _ensure_abs_paths(root, paths):
"""Ensure that paths aren't relative"""
output = []
for path in paths:
if os.path.isabs(path):
output.append(path)
else:
output.append(os.path.join(root, path))
return output


PWD = os.path.join(os.path.abspath(os.path.dirname(".")))
SRC = os.path.join(PWD, "blis")
Expand Down

0 comments on commit db8e6a1

Please sign in to comment.