Skip to content

Commit

Permalink
fix: Errors when using the editables backend with the includes fi…
Browse files Browse the repository at this point in the history
…eld.

Fixes #242

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Jun 17, 2024
1 parent 8930817 commit 59396e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/pdm/backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ def convert_package_paths(self) -> dict[str, list | dict]:
dir_name = include.rstrip("/\\")
temp = list(find_packages_iter(dir_name, src=package_dir or "."))
if os.path.isfile(os.path.join(dir_name, "__init__.py")):
temp.insert(0, dir_name)
temp.insert(
0,
os.path.relpath(dir_name, package_dir or None)
.replace("\\", ".")
.replace("/", "."),
)
packages_set.update(temp)
includes.remove(include)
packages[:] = list(packages_set)
Expand Down
6 changes: 4 additions & 2 deletions tests/pdm/backend/hooks/version/test_scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def scm_dir() -> Iterable:
@pytest.fixture
def git(scm_dir: Path) -> GitScm:
git = shutil.which("git")
assert git is not None, "Cannot find git in path"
if git is None:
pytest.skip("Cannot find git in path")

scm = GitScm(Path(git), scm_dir)

Expand All @@ -155,7 +156,8 @@ def git(scm_dir: Path) -> GitScm:
@pytest.fixture
def hg(scm_dir: Path) -> HgScm:
hg = shutil.which("hg")
assert hg is not None, "Cannot find hg in path"
if hg is None:
pytest.skip("Cannot find hg in path")

scm = HgScm(Path(hg), scm_dir)

Expand Down

0 comments on commit 59396e3

Please sign in to comment.