1 |
commit: ea895af0e5a9f22f71ba695dcb7fd6c8f6f0ce70 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 11 18:19:13 2015 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 11 18:19:13 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ea895af0 |
7 |
|
8 |
pylint: scan all modules by default |
9 |
|
10 |
Add a quick shortcut to scan all the modules in the tree. |
11 |
|
12 |
bin/pylint | 17 +++++++++++++++++ |
13 |
1 file changed, 17 insertions(+) |
14 |
|
15 |
diff --git a/bin/pylint b/bin/pylint |
16 |
index 1a50609..b001827 100755 |
17 |
--- a/bin/pylint |
18 |
+++ b/bin/pylint |
19 |
@@ -10,10 +10,27 @@ import os |
20 |
import sys |
21 |
|
22 |
|
23 |
+def find_all_modules(source_root): |
24 |
+ """Locate all python modules in the tree for scanning""" |
25 |
+ ret = [] |
26 |
+ |
27 |
+ for root, _dirs, files in os.walk(source_root, topdown=False): |
28 |
+ # Add all of the .py modules in the tree. |
29 |
+ ret += [os.path.join(root, x) for x in files if x.endswith('.py')] |
30 |
+ |
31 |
+ # Add the main scripts that don't end in .py. |
32 |
+ ret += [os.path.join(source_root, 'bin', x) for x in ('catalyst', 'pylint')] |
33 |
+ |
34 |
+ return ret |
35 |
+ |
36 |
+ |
37 |
def main(argv): |
38 |
"""The main entry point""" |
39 |
source_root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) |
40 |
|
41 |
+ if not argv: |
42 |
+ argv = find_all_modules(source_root) |
43 |
+ |
44 |
pympath = source_root |
45 |
pythonpath = os.environ.get('PYTHONPATH') |
46 |
if pythonpath is None: |