Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions pywebpack/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

"""Webpack bundle API."""

import importlib.metadata as m
import re
from functools import wraps

from importlib_metadata import entry_points
from sys import version_info

from pywebpack.errors import MergeConflictError

Expand Down Expand Up @@ -145,3 +145,27 @@ def merge_deps(computed_deps, incoming_deps):
else:
computed[incoming_pkg] = incoming_version
return computed_deps


def entry_points(group):
"""Entry points.

Copied here from invenio-base so that we do not introduce a dependency on invenio-base.
"""
if version_info < (3, 10):
eps = m.entry_points()
# the only reason to add this check is to simplify the tests! the tests
# are implemented against python >=3.10 which uses the group keyword.
# since we drop python3.9 soon, this should work!
# in the tests there is a line which patches the return value of
# importlib.metadata.entry_points with a list. this works for
# python>=3.10 but not for 3.9
# the return value of .get can contain duplicates. the simplest way to
# remove is the set() call, to still return a list, list() is called on
# set()
if isinstance(eps, dict):
eps = list(set(eps.get(group, [])))
else:
eps = m.entry_points(group=group)

return eps
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ packages = find:
python_requires = >=3.7
zip_safe = False
install_requires =
importlib-metadata
pynpm>=0.1.0

[options.extras_require]
Expand Down
Loading