smtpErrorAnalysis / pavement.py

from paver.easy import *
from paver.setuputils import setup

import paver.doctools
import os


PROJECT = 'smtpErrorAnalysis'

PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__)) + '''\\smtpErrorAnalysis''' 

PACKAGE_DATA = paver.setuputils.find_package_data(PROJECT, 
                                                  package=PROJECT,
                                                  only_in_packages=True,
                                                  )
PACKAGE_DATA1 = paver.setuputils.find_packages(PACKAGE_PATH)


setup(
    name="smtpErrorAnalysis",
    packages=['smtpErrorAnalysis'],
    version="0.1",
    url="http://mainlydata.kubadev.com/",
    author="Richard Shea",
    author_email="rshea@thecubagroup.com"
)
options(
    sphinx=Bunch(
        builddir="_build",
        sourcedir="",
        docroot="doc"
    ),
    sphinxAutodocInit=Bunch(
        suffix="txt",
        destdir=".\doc\_build\html\_sources",
        modulepath=".\smtpErrorAnalysis",
        sourceFileBuildScript="generate_modules.py"
    ),
    minilib=Bunch(
        extra_files=['doctools','.\generate_modules']
    ), 
    pylint=Bunch(
        defaultOutputFormat="text",
        defaultPathForOutput=".",
        defaultNameForOutput="smtpErrorAnalysis-pylintoutput.text",
        returnCodeFailureLimit=8
    ),
) 


        #destdir=".\doc\source\modules",
@task
@cmdopts([
    ('pyloutfile=', 'o', 'Name of PyLint output file'),
    ('pyloutpath=', 'p', 'Path of PyLint output file'),
    ('pyloutform=', 'f', 'Format of PyLint output file')
])
def lint(options):
    '''
    Runs Pylint agains the smtpErrorAnalysis module
    '''
    from pylint import lint
    from pylint.reporters.text import TextReporter
    forceTheseNamesToBeAcceptable = "smtpErrorAnalysis,findBadAddresses,regexEmailTester"
    print "The following names are forced to be OK : %s" % forceTheseNamesToBeAcceptable

    lintArgs = []
    lintArgs.append("--output-format=%s" % options.defaultOutputFormat)
    lintArgs.append("--reports=n")
    lintArgs.append("--good-names=%s" % forceTheseNamesToBeAcceptable)
    lintArgs.append("--disable=R0903,W0142,W0105,W0212,W0613,E1101")
    lintArgs.append("smtpErrorAnalysis") 
    try:
        lint.Run(lintArgs)
    except SystemExit, exc:
        return_code = exc.args[0]
        if return_code >= options.returnCodeFailureLimit:
            raise paver.tasks.BuildFailure(
                'PyLint finished with a exit code of %d which exceeds the limit of %d' % (return_code, options.returnCodeFailureLimit))

    '''
    sh("pylint.bat --output-format=%s --reports=y smtp-error-analysis > %s" 
        % ( options.defaultOutputFormat,
            outputFileFullPath))
    '''

@task
def nosetests():
    """Runs the tests and stops the build if tests fail"""

    import nose

    '''
    I'm not sure exactly how this works but if we don't supply some sort
    of argv value nose ends up reading the argv which invoked paver
    and that in turn means nose gets very confused. I've added the 
    --verbose directive as it seems the least invasive but I think anything
    would do
    '''
    
    testResults = nose.run(module=None, argv=['--verbose'])
    if testResults:
        pass
    else:
        raise BuildFailure

@task
@needs('paver.doctools.html')
def html(options):
    """Build the docs and put them into our package."""
    #destdir = path('pySourceAid/docs')
    #destdir.rmtree()
    #builtdocs = path("docs") / options.builddir / "html"
    #builtdocs.move(destdir)
    pass


@task
def sphinxAutodocInit(options):
    """Regenerate the sphinx module level source files"""
    sh("python %s --force --suffix=%s --dest-dir=%s %s" % (options.sourceFileBuildScript, options.suffix, options.destdir, options.modulepath))


@task
@needs(['nosetests','sphinxAutodocInit','html', 'distutils.command.sdist'])
def sdist():
    """Generate docs and source distribution."""
    pass

    
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.