diff options
author | 2010-07-04 08:30:19 +0300 | |
---|---|---|
committer | 2010-07-04 08:30:19 +0300 | |
commit | 4ca74d491597746f9122dd897cc25891a3370439 (patch) | |
tree | 8102dde0c42e8cc071b27c019c3fec02bb0511f2 /setup.py | |
parent | Added setup.py (diff) | |
download | gsoc2010-grumpy-4ca74d491597746f9122dd897cc25891a3370439.tar.gz gsoc2010-grumpy-4ca74d491597746f9122dd897cc25891a3370439.tar.bz2 gsoc2010-grumpy-4ca74d491597746f9122dd897cc25891a3370439.zip |
Added 'audit' command to setup.py
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 43 |
1 files changed, 41 insertions, 2 deletions
@@ -6,7 +6,44 @@ Project Grumpy is a an application and a set of utilities aimed to improve life for Gentoo developers. """ -from setuptools import setup +import os, sys + +from os.path import join +from setuptools import Command, setup + +class cmd_Audit(Command): + """Audits Grumpy's source code using PyFlakes for following issues: + - Names which are used but not defined or used before they are defined. + - Names which are redefined without having been used. + """ + + description = "Audit Grumpy's source with PyFlakes" + user_options = [] + + def initialize_options(self): + all = None + + def finalize_options(self): + pass + + def run(self): + try: + import pyflakes.scripts.pyflakes as flakes + except ImportError: + print "Audit requires PyFlakes installed in your system.""" + sys.exit(-1) + + dirs = ['grumpy', 'utils'] + warns = 0 + for dir in dirs: + filenames = os.listdir(dir) + for filename in filenames: + if filename.endswith('.py') and filename != '__init__.py': + warns += flakes.checkPath(os.path.join(dir, filename)) + if warns > 0: + print ("Audit finished with total %d warnings." % warns) + else: + print ("No problems found in sourcecode.") setup( name='Grumpy', @@ -18,6 +55,7 @@ setup( description='Set of QA helpers for Gentoo Developers', long_description=__doc__, packages=['grumpy'], + scripts=[join('utils', 'grumpy_sync.py')], zip_safe=False, platforms='any', install_requires=[ @@ -35,6 +73,7 @@ setup( 'Programming Language :: Python', 'Topic :: Software Development :: Quality Assurance', 'Topic :: Utilities' - ] + ], + cmdclass={'audit': cmd_Audit} ) |