summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-08-21 06:43:34 +0100
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-08-21 06:43:34 +0100
commitd6095e99c846aef17f4d5a6d8a78432a54aacc52 (patch)
treeebf959aba7d8df3fe8fa62c7e1e6804a86748156
parent2372749be2e92df5d2aab11b1407948a8e25bf2f (diff)
downloadpython-setuptools-git-d6095e99c846aef17f4d5a6d8a78432a54aacc52.tar.gz
Limit number of string replacements
-rw-r--r--setuptools/command/editable_wheel.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py
index cd535e48..b908298f 100644
--- a/setuptools/command/editable_wheel.py
+++ b/setuptools/command/editable_wheel.py
@@ -684,9 +684,13 @@ def _is_nested(pkg: str, pkg_path: str, parent: str, parent_path: str) -> bool:
False
>>> _is_nested("a.b", "path/a/b", "c", "path/c")
False
+ >>> _is_nested("a.a", "path/a/a", "a", "path/a")
+ True
+ >>> _is_nested("b.a", "path/b/a", "a", "path/a")
+ False
"""
norm_pkg_path = _normalize_path(pkg_path)
- rest = pkg.replace(parent, "").strip(".").split(".")
+ rest = pkg.replace(parent, "", 1).strip(".").split(".")
return (
pkg.startswith(parent)
and norm_pkg_path == _normalize_path(Path(parent_path, *rest))