run_checks: Add main block

This commit is contained in:
Florian Bruhin 2014-08-12 18:48:31 +02:00
parent 2d1f84e7f0
commit 01ec30cda3

View File

@ -221,10 +221,11 @@ def _get_args(checker):
return args return args
argv = sys.argv[:] def main():
check_unittest() argv = sys.argv[:]
check_git() check_unittest()
for trg in CONFIG.get('DEFAULT', 'targets').split(','): check_git()
for trg in CONFIG.get('DEFAULT', 'targets').split(','):
print("==================== {} ====================".format(trg)) print("==================== {} ====================".format(trg))
check_pep257(trg, _get_args('pep257')) check_pep257(trg, _get_args('pep257'))
for chk in ('pylint', 'flake8'): for chk in ('pylint', 'flake8'):
@ -232,16 +233,20 @@ for trg in CONFIG.get('DEFAULT', 'targets').split(','):
run(chk, trg, _get_args(chk)) run(chk, trg, _get_args(chk))
check_vcs_conflict(trg) check_vcs_conflict(trg)
if '--setup' in argv: if '--setup' in argv:
print("==================== Setup checks ====================") print("==================== Setup checks ====================")
for chk in ('pyroma', 'check-manifest'): for chk in ('pyroma', 'check-manifest'):
run(chk, args=_get_args(chk)) run(chk, args=_get_args(chk))
print("Exit status values:") print("Exit status values:")
for (k, v) in status.items(): for (k, v) in status.items():
print(' {} - {}'.format(k, v)) print(' {} - {}'.format(k, v))
if all(val in (True, 0) for val in status): if all(val in (True, 0) for val in status):
sys.exit(0) return 0
else: else:
sys.exit(1) return 1
if __name__ == '__main__':
sys.exit(main())