Skip to content

Commit

Permalink
do not use old datalad-core extractors
Browse files Browse the repository at this point in the history
This commit ensures that extractors that were
moved from datalad-core into datalad-metalad
are used, even if the old code is still present
in datalad-core.
  • Loading branch information
christian-monch committed Sep 29, 2022
1 parent 544a954 commit 863562a
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions datalad_metalad/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,29 @@ def get_extractor_class(extractor_name: str) -> Union[
""" Get an extractor from its name """
from pkg_resources import iter_entry_points

entry_points = list(
iter_entry_points("datalad.metadata.extractors", extractor_name))
# The extractor class names of the old datalad-contained extractors have
# been changed, when the extractors were moved to datalad_metalad.
# Therefore, we have to use to extractors in
# `datalad_metalad.extractors.legacy` instead of any old extractor code
# from datalad core.
entry_points = [
entry_point
for entry_point in iter_entry_points(
"datalad.metadata.extractors",
extractor_name
)
if entry_point.dist.project_name != "datalad"
]

if not entry_points:
entry_points = [
entry_point
for entry_point in iter_entry_points(
"datalad.metadata.extractors",
extractor_name
)
if entry_point.dist.project_name == "datalad"
]

if not entry_points:
raise ExtractorNotFoundError(
Expand Down

0 comments on commit 863562a

Please sign in to comment.