Skip to content

Commit

Permalink
Fix absolute path from wheel; fix copy header bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Jan 17, 2024
1 parent 855d8e0 commit ed7ecae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rtree/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def get_include() -> str:
if pkg_files is not None:
for path in pkg_files: # type: ignore
if path.name == "SpatialIndex.h":
return str(path.parent.parent)
return str(Path(path.locate()).parent.parent)
except importlib.metadata.PackageNotFoundError:
pass

Expand Down
14 changes: 4 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,12 @@ def finalize_options(self) -> None:
else:
raise ValueError(f"unhandled platform {sys.platform!r}")

target_lib.mkdir(parents=True, exist_ok=True)
for pth in source_lib.glob(lib_pattern):
# if the source isn't a file skip it
if not pth.is_file():
continue

# make directory if it doesn't exist yet
if not target_lib.is_dir():
target_lib.mkdir(parents=True)

# copy the source file to the target directory
self.copy_file(str(pth), str(target_lib / pth.name))

Expand All @@ -73,14 +70,11 @@ def finalize_options(self) -> None:
if source_include.is_dir():
for pth in source_include.rglob("*.h"):
rpth = pth.relative_to(source_include)
target_subdir = target_include / rpth

# make directory if it doesn't exist yet
if not target_subdir.is_dir():
target_subdir.mkdir(parents=True)

# copy the source file to the target directory
self.copy_file(str(pth), str(target_include / rpth))
target_subdir = target_include / rpth.parent
target_subdir.mkdir(parents=True, exist_ok=True)
self.copy_file(str(pth), str(target_subdir))


# See pyproject.toml for other project metadata
Expand Down

0 comments on commit ed7ecae

Please sign in to comment.