Skip to content

Commit ea07bd6

Browse files
committed
Add extraroots to cover missing py files.
1 parent 7693a40 commit ea07bd6

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

eachdist.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ sortfirst=
77
ext/*
88

99
[lintroots]
10+
extraroots=examples/*,scripts/
1011
subglob=*.py,tests/,test/,src/*
1112

1213
[testroots]
14+
extraroots=examples/*,tests/
1315
subglob=tests/,test/

scripts/eachdist.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
DEFAULT_ALLSEP = " "
1414
DEFAULT_ALLFMT = "{rel}"
1515

16+
17+
def unique(elems):
18+
seen = set()
19+
for elem in elems:
20+
if elem not in seen:
21+
yield elem
22+
seen.add(elem)
23+
24+
1625
try:
1726
subprocess_run = subprocess.run
1827
except AttributeError: # Py < 3.5 compat
@@ -127,6 +136,12 @@ def find_targets(mode, rootpath):
127136
mcfg = cfg[mode]
128137

129138
targets = list(find_targets_unordered(rootpath))
139+
if "extraroots" in mcfg:
140+
targets += [
141+
path
142+
for extraglob in getlistcfg(mcfg["extraroots"])
143+
for path in rootpath.glob(extraglob)
144+
]
130145
if "sortfirst" in mcfg:
131146
sortfirst = getlistcfg(mcfg["sortfirst"])
132147

@@ -155,7 +170,7 @@ def keyfunc(path):
155170
if ".egg-info" not in str(newentry) and newentry.exists()
156171
]
157172

158-
return targets
173+
return list(unique(targets))
159174

160175

161176
def runsubprocess(dry_run, params, *args, **kwargs):
@@ -322,8 +337,7 @@ def lint_args(args):
322337
runsubprocess(args.dry_run, ("flake8", rootdir), check=True)
323338
execute_args(
324339
parse_subargs(
325-
args,
326-
("exec", "pylint scripts/ {}", "--all", "--mode", "lintroots",),
340+
args, ("exec", "pylint {}", "--all", "--mode", "lintroots",),
327341
)
328342
)
329343

0 commit comments

Comments
 (0)