From ff1bb2eee097ded0f9b7821b0975465df52d10ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sat, 30 Oct 2021 17:22:22 +0100 Subject: [PATCH] metadata: remove Distribution._local MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Importing an external module is anti-pattern and very unexpected behavior. Furthermore, the specific builder implementation we are using will provision an isolated virtual environmnent and perform the build there, which is unwanted in various scenarious. Perhaps there was a time this helper was needed, but we can now remove this in favor of build.util.project_wheel_metadata[1]. [1] https://github.com/pypa/build/blob/82051d509a87124a46f3766134c11fc8aee9b86a/src/build/util.py#L27 Signed-off-by: Filipe LaĆ­ns --- importlib_metadata/__init__.py | 12 ------------ tests/test_integration.py | 7 ------- 2 files changed, 19 deletions(-) diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index 95427cb2..1c4df5fe 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -576,18 +576,6 @@ def _discover_resolvers(): ) return filter(None, declared) - @classmethod - def _local(cls, root='.'): - from pep517 import build, meta - - system = build.compat_system(root) - builder = functools.partial( - meta.build, - source_dir=root, - system=system, - ) - return PathDistribution(zipp.Path(meta.build_as_zip(builder))) - @property def metadata(self) -> _meta.PackageMetadata: """Return the parsed metadata for this Distribution. diff --git a/tests/test_integration.py b/tests/test_integration.py index 00e9021a..a73fad9c 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -44,13 +44,6 @@ def __getattribute__(self, name): _compat.disable_stdlib_finder() -class LocalProjectTests(fixtures.LocalPackage, unittest.TestCase): - def test_find_local(self): - dist = Distribution._local() - assert dist.metadata['Name'] == 'local-pkg' - assert dist.version == '2.0.1' - - class DistSearch(unittest.TestCase): def test_search_dist_dirs(self): """