Skip to content

Commit ff1bb2e

Browse files
committed
metadata: remove Distribution._local
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 <[email protected]>
1 parent df5e617 commit ff1bb2e

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

importlib_metadata/__init__.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -576,18 +576,6 @@ def _discover_resolvers():
576576
)
577577
return filter(None, declared)
578578

579-
@classmethod
580-
def _local(cls, root='.'):
581-
from pep517 import build, meta
582-
583-
system = build.compat_system(root)
584-
builder = functools.partial(
585-
meta.build,
586-
source_dir=root,
587-
system=system,
588-
)
589-
return PathDistribution(zipp.Path(meta.build_as_zip(builder)))
590-
591579
@property
592580
def metadata(self) -> _meta.PackageMetadata:
593581
"""Return the parsed metadata for this Distribution.

tests/test_integration.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ def __getattribute__(self, name):
4444
_compat.disable_stdlib_finder()
4545

4646

47-
class LocalProjectTests(fixtures.LocalPackage, unittest.TestCase):
48-
def test_find_local(self):
49-
dist = Distribution._local()
50-
assert dist.metadata['Name'] == 'local-pkg'
51-
assert dist.version == '2.0.1'
52-
53-
5447
class DistSearch(unittest.TestCase):
5548
def test_search_dist_dirs(self):
5649
"""

0 commit comments

Comments
 (0)