Skip to content

Commit 0389d40

Browse files
committed
Refactor to detect for callability instead of string types, letting the duck type work for string parameters. Fixes #179.
1 parent 289f7a2 commit 0389d40

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

setuptools_scm/version.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ def _warn_if_setuptools_outdated():
2222

2323
def callable_or_entrypoint(group, callable_or_name):
2424
trace('ep', (group, callable_or_name))
25-
if isinstance(callable_or_name, str):
26-
for ep in iter_entry_points(group, callable_or_name):
27-
trace("ep found:", ep.name)
28-
return ep.load()
29-
else:
25+
26+
if callable(callable_or_name):
3027
return callable_or_name
3128

29+
for ep in iter_entry_points(group, callable_or_name):
30+
trace("ep found:", ep.name)
31+
return ep.load()
32+
3233

3334
def tag_to_version(tag):
3435
trace('tag', tag)

0 commit comments

Comments
 (0)