Imported Upstream version 65.1.1 upstream/65.1.1
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:55 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:55 +0000 (17:02 +0900)
.bumpversion.cfg
.github/workflows/main.yml
CHANGES.rst
setup.cfg
setuptools/command/editable_wheel.py
setuptools/tests/test_editable_install.py

index 9dde3c5fdd2aa0ef9ce6c7e99801a476e41cd243..6df865b07b4ec7b2c66e25ff259fe1f8727e6f26 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 65.1.0
+current_version = 65.1.1
 commit = True
 tag = True
 
index 83624a5bc4e5cec8c85a802ffde25b43ca52962d..1ff040395574063c85c0958559fdbc02731cd8ed 100644 (file)
@@ -36,7 +36,7 @@ jobs:
     steps:
       - uses: actions/checkout@v3
       - name: Setup Python
-        uses: actions/setup-python@v3
+        uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python }}
       - uses: actions/cache@v3
index 6cd0a78b450c7012c047b3479d0e8e289779df11..448c6e8ea49c28818e7397ed240fe60541b341aa 100644 (file)
@@ -1,3 +1,13 @@
+v65.1.1
+-------
+
+
+Misc
+^^^^
+* #3551: Avoided circular imports in meta path finder for editable installs when a
+  missing module has the same name as its parent.
+
+
 v65.1.0
 -------
 
index b2a695046552984918a2d1642546d367900ffeaa..ca95d7d1ff3a6df5a1deb05ddaaa058b682393fb 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = setuptools
-version = 65.1.0
+version = 65.1.1
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
 description = Easily download, build, install, upgrade, and uninstall Python packages
index ea2148412f6042f84228ec5142c12027fd7b031d..b908298f4a3baf791108ef8b5b6f9b5fa9f5b479 100644 (file)
@@ -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))
@@ -755,7 +759,7 @@ class _EditableFinder:  # MetaPathFinder
     def find_spec(cls, fullname, path=None, target=None):
         for pkg, pkg_path in reversed(list(MAPPING.items())):
             if fullname.startswith(pkg):
-                rest = fullname.replace(pkg, "").strip(".").split(".")
+                rest = fullname.replace(pkg, "", 1).strip(".").split(".")
                 return cls._find_spec(fullname, Path(pkg_path, *rest))
 
         return None
index 6b5cdd1c0e2d1bfb574f4043ac0afec0e30e4c33..4a2ceb12f997970036497d1fdb5c738fc3a7b516 100644 (file)
@@ -494,6 +494,27 @@ class TestFinderTemplate:
             three = import_module("parent.child.three")
             assert three.x == 3
 
+    def test_no_recursion(self, tmp_path):
+        # See issue #3550
+        files = {
+            "pkg": {
+                "__init__.py": "from . import pkg",
+            },
+        }
+        jaraco.path.build(files, prefix=tmp_path)
+
+        mapping = {
+            "pkg": str(tmp_path / "pkg"),
+        }
+        template = _finder_template(str(uuid4()), mapping, {})
+
+        with contexts.save_paths(), contexts.save_sys_modules():
+            sys.modules.pop("pkg", None)
+
+            self.install_finder(template)
+            with pytest.raises(ImportError, match="pkg"):
+                import_module("pkg")
+
 
 def test_pkg_roots(tmp_path):
     """This test focus in getting a particular implementation detail right.