summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-08-12 15:05:20 +0100
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-08-12 15:05:20 +0100
commit0adb305c8b6b1502fa96b595fd3887e9877fa9f7 (patch)
tree06473f5e9526f7804dd46229dcb54e641e54c2d8 /setuptools/command
parent8f2cc1f47f795de68a2a5a93e7e59fd91a6346d2 (diff)
parentce980c1fe7d286235a1f1c3751569e931bc7c2be (diff)
downloadpython-setuptools-git-0adb305c8b6b1502fa96b595fd3887e9877fa9f7.tar.gz
Handle accidental virtual namespaces in editable install (#3512)
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/editable_wheel.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py
index 8a53de65..2631a082 100644
--- a/setuptools/command/editable_wheel.py
+++ b/setuptools/command/editable_wheel.py
@@ -628,7 +628,14 @@ def _absolute_root(path: _Path) -> str:
def _find_virtual_namespaces(pkg_roots: Dict[str, str]) -> Iterator[str]:
"""By carefully designing ``package_dir``, it is possible to implement the logical
structure of PEP 420 in a package without the corresponding directories.
- This function will try to find this kind of namespaces.
+
+ Moreover a parent package can be purposefully/accidentally skipped in the discovery
+ phase (e.g. ``find_packages(include=["mypkg.*"])``, when ``mypkg.foo`` is included
+ by ``mypkg`` itself is not).
+ We consider this case to also be a virtual namespace (ignoring the original
+ directory) to emulate a non-editable installation.
+
+ This function will try to find these kinds of namespaces.
"""
for pkg in pkg_roots:
if "." not in pkg:
@@ -637,7 +644,8 @@ def _find_virtual_namespaces(pkg_roots: Dict[str, str]) -> Iterator[str]:
for i in range(len(parts) - 1, 0, -1):
partial_name = ".".join(parts[:i])
path = Path(find_package_path(partial_name, pkg_roots, ""))
- if not path.exists():
+ if not path.exists() or partial_name not in pkg_roots:
+ # partial_name not in pkg_roots ==> purposefully/accidentally skipped
yield partial_name