diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-08-01 12:05:03 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-08-01 12:05:03 (GMT) |
commit | f96db0da906d6fedba0d1a7d11080faf31ecd89d (patch) | |
tree | b4e758f9222fa1dd8ecc6d5f728074086cc50a54 /scripts/check.py | |
parent | c62c487b795bae5e370854a8dd46fbd2c41e110e (diff) |
Fix check to emit an error when it fails.
Diffstat (limited to 'scripts/check.py')
-rw-r--r-- | scripts/check.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/scripts/check.py b/scripts/check.py index 1dfc899..a49fc29 100644 --- a/scripts/check.py +++ b/scripts/check.py @@ -12,8 +12,16 @@ class cmd_check(Command): name = 'check' usage_args = '' + def run_pylint(self, args): + p = subprocess.Popen([ 'pylint' ] + args, stdout=subprocess.PIPE) + + output = p.stdout.read() + print output + + return len(output.strip()) > 0 + def lint(self, module): - subprocess.call(['pylint', module, '--rcfile=%s' % pylintrc_path]) + return self.run_pylint([module, '--rcfile=%s' % pylintrc_path]) def lint_path(self, path): cwd = os.getcwd() @@ -25,21 +33,27 @@ class cmd_check(Command): 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) + args = ['--rcfile=%s' % pylintrc_path] + python_files + result = self.run_pylint(args) os.chdir(cwd) + return result + def run(self, config, options, args): + result = True + 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')) + + result &= self.lint_path(os.path.join(sugar_path, 'shell')) + result &= self.lint_path(os.path.join(sugar_path, 'service')) print 'Pylint the sugar module...' - self.lint('sugar') + result &= self.lint('sugar') + + return result register_command(cmd_check) |