Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2008-04-29 20:45:26 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2008-04-29 20:45:26 (GMT)
commit755a7468e672677efb4e371146ce8f10883d82ac (patch)
tree3061dabe9632d08f99c4cbcb5ca120b3a2f2b6d9 /scripts
parent74d69b38f7f6129aa313b4722687bfeb3d863ce2 (diff)
Make it pylint the shell.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/check.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/scripts/check.py b/scripts/check.py
index e04d92e..1dfc899 100644
--- a/scripts/check.py
+++ b/scripts/check.py
@@ -5,6 +5,7 @@ from jhbuild.commands import Command, register_command
scripts_dir = os.path.dirname(__file__)
data_dir = os.path.join(scripts_dir, 'data')
+pylintrc_path = os.path.join(data_dir, 'pylintrc')
class cmd_check(Command):
@@ -12,11 +13,33 @@ class cmd_check(Command):
usage_args = ''
def lint(self, module):
- rc_path = os.path.join(data_dir, 'pylintrc')
- cmd = ['pylint', module, '--rcfile=%s' % rc_path]
+ subprocess.call(['pylint', module, '--rcfile=%s' % pylintrc_path])
+
+ def lint_path(self, path):
+ cwd = os.getcwd()
+ os.chdir(path)
+
+ python_files = []
+ for (path, dirs, files) in os.walk('.'):
+ for f in files:
+ if f.endswith('.py'):
+ python_files.append(os.path.join(path, f))
+
+ cmd = ['pylint', '--rcfile=%s' % pylintrc_path]
+ cmd.extend(python_files)
subprocess.call(cmd)
+ os.chdir(cwd)
+
def run(self, config, options, args):
+ print 'Pylint the sugar shell...'
+
+ sugar_path = os.path.join(config.prefix, 'share', 'sugar')
+ self.lint_path(os.path.join(sugar_path, 'shell'))
+ self.lint_path(os.path.join(sugar_path, 'service'))
+
+ print 'Pylint the sugar module...'
+
self.lint('sugar')
register_command(cmd_check)