summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/command/editable_wheel.py2
-rw-r--r--setuptools/tests/test_editable_install.py29
2 files changed, 30 insertions, 1 deletions
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py
index eb79608b..1bb7ddfb 100644
--- a/setuptools/command/editable_wheel.py
+++ b/setuptools/command/editable_wheel.py
@@ -439,7 +439,7 @@ class _TopLevelFinder:
roots = _find_package_roots(top_level, package_dir, src_root)
namespaces_: Dict[str, List[str]] = dict(chain(
- _find_namespaces(self.dist.packages, roots),
+ _find_namespaces(self.dist.packages or [], roots),
((ns, []) for ns in _find_virtual_namespaces(roots)),
))
diff --git a/setuptools/tests/test_editable_install.py b/setuptools/tests/test_editable_install.py
index 40a35f65..8ab17b3c 100644
--- a/setuptools/tests/test_editable_install.py
+++ b/setuptools/tests/test_editable_install.py
@@ -163,6 +163,35 @@ def test_editable_with_flat_layout(tmp_path, venv, editable_opts):
assert subprocess.check_output(cmd).strip() == b"4 2"
+def test_editable_with_single_module(tmp_path, venv, editable_opts):
+ files = {
+ "mypkg": {
+ "pyproject.toml": dedent("""\
+ [build-system]
+ requires = ["setuptools", "wheel"]
+ build-backend = "setuptools.build_meta"
+
+ [project]
+ name = "mod"
+ version = "3.14159"
+
+ [tool.setuptools]
+ py-modules = ["mod"]
+ """),
+ "mod.py": "b = 2",
+ },
+ }
+ jaraco.path.build(files, prefix=tmp_path)
+ project = tmp_path / "mypkg"
+
+ cmd = [venv.exe(), "-m", "pip", "install",
+ "--no-build-isolation", # required to force current version of setuptools
+ "-e", str(project), *editable_opts]
+ print(str(subprocess.check_output(cmd), "utf-8"))
+ cmd = [venv.exe(), "-c", "import mod; print(mod.b)"]
+ assert subprocess.check_output(cmd).strip() == b"2"
+
+
class TestLegacyNamespaces:
"""Ported from test_develop"""