diff options
author | Cole Robinson <crobinso@redhat.com> | 2019-05-16 07:19:17 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2019-05-16 14:43:31 -0400 |
commit | d50187e65cc5d9cf46b133828973324a3861ce14 (patch) | |
tree | 35835e320f485839a498419e5e0edd28968b4c17 /setup.py | |
parent | bc4573a14b274e0065e8698e8623a628eb9e1358 (diff) | |
download | virt-manager-d50187e65cc5d9cf46b133828973324a3861ce14.tar.gz |
setup: Make codespell an optional part of the 'pylint' target
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 39 |
1 files changed, 12 insertions, 27 deletions
@@ -568,32 +568,6 @@ class TestDist(TestBaseCommand): TestBaseCommand.run(self) -class CheckSpell(distutils.core.Command): - user_options = [] - description = "Check code for common misspellings" - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - try: - import codespell_lib - except ImportError: - raise ImportError('codespell is not installed') - - files = ["setup.py", "virt-install", "virt-clone", - "virt-convert", "virt-xml", "virt-manager", - "virtcli", "virtinst", "virtconv", "virtManager", - "tests"] - # pylint: disable=protected-access - codespell_lib._codespell.main( - '-I', 'tests/codespell_dict.txt', - '--skip', '*.pyc,*.zip,*.vmdk,*.iso,*.xml', *files) - - class CheckPylint(distutils.core.Command): user_options = [ ("jobs=", "j", "use multiple processes to speed up Pylint"), @@ -616,6 +590,18 @@ class CheckPylint(distutils.core.Command): "virtcli", "virtinst", "virtconv", "virtManager", "tests"] + try: + import codespell_lib + # pylint: disable=protected-access + print("running codespell") + codespell_lib._codespell.main( + '-I', 'tests/codespell_dict.txt', + '--skip', '*.pyc,*.zip,*.vmdk,*.iso,*.xml', *files) + except ImportError: + print("codespell is not installed. skipping...") + except Exception as e: + print("Error running codespell: %s" % e) + output_format = sys.stdout.isatty() and "colorized" or "text" print("running pycodestyle") @@ -709,7 +695,6 @@ distutils.core.setup( 'configure': configure, 'pylint': CheckPylint, - 'codespell': CheckSpell, 'rpm': my_rpm, 'test': TestCommand, 'test_ui': TestUI, |