Skip to content

Commit b549c0c

Browse files
committed
Rework file finder integration
- do not replace '' with '.', fixes #248 - do not assume path is at scm toplevel, fixes #251
1 parent 7253898 commit b549c0c

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

setuptools_scm/integration.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os
1+
from pkg_resources import iter_entry_points
22

33
from .version import _warn_if_setuptools_outdated
44
from .utils import do
@@ -22,22 +22,14 @@ def version_keyword(dist, keyword, value):
2222
dist.metadata.version = get_version(**value)
2323

2424

25-
def find_files(path='.'):
26-
if not path:
27-
path = '.'
28-
abs = os.path.abspath(path)
29-
ep = next(iter_matching_entrypoints(
30-
abs, 'setuptools_scm.files_command'), None)
31-
if ep:
25+
def find_files(path=''):
26+
for ep in iter_entry_points('setuptools_scm.files_command'):
3227
command = ep.load()
33-
try:
34-
if isinstance(command, str):
35-
return do(ep.load(), path).splitlines()
36-
else:
37-
return command(path)
38-
except Exception:
39-
print("File Finder Failed for %s" % ep)
40-
raise
41-
42-
else:
43-
return []
28+
if isinstance(command, str):
29+
# this technique is deprecated
30+
res = do(ep.load(), path or '.').splitlines()
31+
else:
32+
res = command(path)
33+
if res:
34+
return res
35+
return []

0 commit comments

Comments
 (0)