Skip to content

Commit

Permalink
cleanup pavement.py
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Sep 27, 2020
1 parent 76b2a69 commit 7aae668
Showing 1 changed file with 0 additions and 85 deletions.
85 changes: 0 additions & 85 deletions pavement.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
from builtins import range
# -*- coding: utf-8 -*-
#
# (c) 2016 Boundless, http://boundlessgeo.com
# This code is licensed under the GPL 2.0 license.
#

import os
import fnmatch
import zipfile
import shutil

from paver.easy import *
# this pulls in the sphinx target
from paver.doctools import html

options(
Expand Down Expand Up @@ -85,82 +79,3 @@ def filter_excludes(files):
relpath = os.path.relpath(root, '.')
zip.write(path(root) / f, path(relpath) / f)
filter_excludes(dirs)


@task
def install_devtools():
"""Install development tools"""
try:
import pip
except:
error('FATAL: Unable to import pip, please install it first!')
sys.exit(1)

pip.main(['install', '-r', 'requirements-dev.txt'])


@task
@consume_args
def pep8(args):
"""Check code for PEP8 violations"""
try:
import pep8
except:
error('pep8 not found! Run "paver install_devtools".')
sys.exit(1)

# Errors to ignore
ignore = ['E203', 'E121', 'E122', 'E123', 'E124', 'E125', 'E126', 'E127',
'E128', 'E402']
styleguide = pep8.StyleGuide(ignore=ignore,
exclude=['*/extlibs/*', '*/ext-src/*'],
repeat=True, max_line_length=79,
parse_argv=args)
styleguide.input_dir(options.plugin.source_dir)
info('===== PEP8 SUMMARY =====')
styleguide.options.report.print_statistics()


@task
@consume_args
def autopep8(args):
"""Format code according to PEP8
"""
try:
import autopep8
except:
error('autopep8 not found! Run "paver install_devtools".')
sys.exit(1)

if any(x not in args for x in ['-i', '--in-place']):
args.append('-i')

args.append('--ignore=E261,E265,E402,E501')
args.insert(0, 'dummy')

cmd_args = autopep8.parse_args(args)

excludes = ('extlibs', 'ext-src')
for p in options.plugin.source_dir.walk():
if any(exclude in p for exclude in excludes):
continue

if p.fnmatch('*.py'):
autopep8.fix_file(p, options=cmd_args)


@task
@consume_args
def pylint(args):
"""Check code for errors and coding standard violations"""
try:
from pylint import lint
except:
error('pylint not found! Run "paver install_devtools".')
sys.exit(1)

if not 'rcfile' in args:
args.append('--rcfile=pylintrc')

args.append(options.plugin.source_dir)
lint.Run(args)

0 comments on commit 7aae668

Please sign in to comment.