Skip to content

Commit 59396e3

Browse files
committed
fix: Errors when using the editables backend with the includes field.
Fixes #242 Signed-off-by: Frost Ming <me@frostming.com>
1 parent 8930817 commit 59396e3

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/pdm/backend/config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ def convert_package_paths(self) -> dict[str, list | dict]:
118118
dir_name = include.rstrip("/\\")
119119
temp = list(find_packages_iter(dir_name, src=package_dir or "."))
120120
if os.path.isfile(os.path.join(dir_name, "__init__.py")):
121-
temp.insert(0, dir_name)
121+
temp.insert(
122+
0,
123+
os.path.relpath(dir_name, package_dir or None)
124+
.replace("\\", ".")
125+
.replace("/", "."),
126+
)
122127
packages_set.update(temp)
123128
includes.remove(include)
124129
packages[:] = list(packages_set)

tests/pdm/backend/hooks/version/test_scm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def scm_dir() -> Iterable:
145145
@pytest.fixture
146146
def git(scm_dir: Path) -> GitScm:
147147
git = shutil.which("git")
148-
assert git is not None, "Cannot find git in path"
148+
if git is None:
149+
pytest.skip("Cannot find git in path")
149150

150151
scm = GitScm(Path(git), scm_dir)
151152

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

160162
scm = HgScm(Path(hg), scm_dir)
161163

0 commit comments

Comments
 (0)