Skip to content

Commit

Permalink
metadata: remove Distribution._local
Browse files Browse the repository at this point in the history
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 <lains@riseup.net>
  • Loading branch information
FFY00 committed Oct 30, 2021
1 parent df5e617 commit ff1bb2e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
12 changes: 0 additions & 12 deletions importlib_metadata/__init__.py
Expand Up @@ -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.
Expand Down
7 changes: 0 additions & 7 deletions tests/test_integration.py
Expand Up @@ -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):
"""
Expand Down

0 comments on commit ff1bb2e

Please sign in to comment.