Skip to content

Commit

Permalink
Merge pull request #680 from jrbourbeau/entrypoints-select
Browse files Browse the repository at this point in the history
Update entrypoint selection
  • Loading branch information
martindurant authored Jun 21, 2021
2 parents beade7f + 384b872 commit a84d7fe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fsspec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@

if entry_points is not None:
try:
entry_points = entry_points()
eps = entry_points()
except TypeError:
pass # importlib-metadata < 0.8
else:
for spec in entry_points.get("fsspec.specs", []):
if hasattr(eps, "select"): # Python 3.10+ / importlib_metadata >= 3.9.0
specs = eps.select(group="fsspec.specs")
else:
specs = eps.get("fsspec.specs", [])
for spec in specs:
err_msg = f"Unable to load filesystem from {spec}"
register_implementation(
spec.name, spec.value.replace(":", "."), errtxt=err_msg
Expand Down

0 comments on commit a84d7fe

Please sign in to comment.