Skip to content

Commit 863562a

Browse files
do not use old datalad-core extractors
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.
1 parent 544a954 commit 863562a

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

datalad_metalad/extract.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,29 @@ def get_extractor_class(extractor_name: str) -> Union[
488488
""" Get an extractor from its name """
489489
from pkg_resources import iter_entry_points
490490

491-
entry_points = list(
492-
iter_entry_points("datalad.metadata.extractors", extractor_name))
491+
# The extractor class names of the old datalad-contained extractors have
492+
# been changed, when the extractors were moved to datalad_metalad.
493+
# Therefore, we have to use to extractors in
494+
# `datalad_metalad.extractors.legacy` instead of any old extractor code
495+
# from datalad core.
496+
entry_points = [
497+
entry_point
498+
for entry_point in iter_entry_points(
499+
"datalad.metadata.extractors",
500+
extractor_name
501+
)
502+
if entry_point.dist.project_name != "datalad"
503+
]
504+
505+
if not entry_points:
506+
entry_points = [
507+
entry_point
508+
for entry_point in iter_entry_points(
509+
"datalad.metadata.extractors",
510+
extractor_name
511+
)
512+
if entry_point.dist.project_name == "datalad"
513+
]
493514

494515
if not entry_points:
495516
raise ExtractorNotFoundError(

0 commit comments

Comments
 (0)