Exemple #1
0
def main(argv):

    parser = console.getOptionParser(usage=__doc__)  # "usage: %prog [options] DIR",
    ##         description="""\
    ## where DIR is the source directory.
    ## """)

    parser.add_option(
        "-f",
        "--force",
        help="""\
force generation even if target file is up-to-date""",
        action="store_true",
        dest="force",
        default=False,
    )

    parser.add_option(
        "-d",
        "--dest",
        help="""\
destination directory""",
        action="store",
        type="string",
        dest="dest",
        default=None,
    )

    (options, args) = parser.parse_args(argv)

    if len(args) == 0:
        parser.print_help()
        return -1

    wmm2html(srcdir=args[0], files=args[1:], outdir=options.dest, force=options.force)
Exemple #2
0
def main(argv):

    parser = console.getOptionParser(
        usage=__doc__,  #"usage: %prog [options] DIR",
    )
    ##         description="""\
    ## where DIR is the source directory.
    ## """)

    parser.add_option("-f",
                      "--force",
                      help="""\
force generation even if target file is up-to-date""",
                      action="store_true",
                      dest="force",
                      default=False)

    parser.add_option("-d",
                      "--dest",
                      help="""\
destination directory""",
                      action="store",
                      type="string",
                      dest="dest",
                      default=None)

    (options, args) = parser.parse_args(argv)

    if len(args) == 0:
        parser.print_help()
        return -1

    wmm2html(srcdir=args[0],
             files=args[1:],
             outdir=options.dest,
             force=options.force)
Exemple #3
0
def main(targets):

    verbose = False
    severe = False

    if "-v" in targets:
        targets.remove("-v")
        verbose = True
        print "Gonna be verbose...!"
    else:
        console.set(verbosity=-1)
        
    if "-s" in targets:
        targets.remove("-s")
        severe = True
        if verbose:
            print "Gonna be severe...!"
        
    if len(targets) == 0:
        targets = ['unittest']
        #targets = ['html','tests']
        # targets = ['html','doctest']

    if 'tests' in targets:
        targets.remove('tests')
        targets += ('unittest', 'doctest')
        
    if 'clean' in targets:
        targets.remove('clean')
        for root, dirs, files in os.walk('.'):
            for fn in files:
                (name,ext) = os.path.splitext(fn)
                if ext in (".html",'.pdf'):
                    fn = os.path.join(root,fn)
                    if verbose:
                        print "removed:", fn
                    os.remove(fn)
        
    if 'upload_sf' in targets:
        targets.remove('upload_sf')
        os.chdir("docs")
        os.system('rsync --rsh=ssh -v -r . [email protected]:/home/groups/l/li/lino/htdocs')
        os.chdir("..")
        
    if 'html' in targets:
        targets.remove('html')
        print "Generating docs..."
        from lino.webman.static import wmm2html
        wmm2html(srcdir='docs',showOutput=False) #,force=True) 
        

    if 'unittest' in targets:
        targets.remove('unittest')
        print "Running unittest on test/ ..."
        #cwd = os.getcwd()
        #from os.path import join, getsize
        suites = []
        for root, dirs, files in os.walk('tests'):
            tests = [name[:-3] for name in files if name.endswith('.py')]
            if len(tests):
                print " collecting cases in " + root
                sys.path.append(os.path.abspath(root))
                # os.chdir(root)
                for modname in tests:
                    # print modname
                    s = tsttools.makesuite(modname)
                    suites.append(s)
                    # print os.path.join(root,modname+".py")
                    # unittest.main(modname)
            # don't visit CVS and _attic directories
            for dontGo in ('CVS','_attic'):
                try:
                    dirs.remove(dontGo)
                except ValueError:
                    pass
                
        # os.chdir(cwd)
        runner = unittest.TextTestRunner()
        runner.run(unittest.TestSuite(suites))

        

    if 'doctest' in targets:
        targets.remove('doctest')

        from lino import adamo, sdoc
        modules = (adamo,sdoc)

        print "Running doctest on %s ..." % [M.__name__ for M in modules]
        failures = 0
        tested = 0
        for M in modules: 
            (f,t) = doctest.testmod(M, verbose=False, report=0)
            if f != 0 and severe:
                raise FailuresFound,\
                        "Stopped after %d failures in %s" % (f,pfn)
            failures += f
            tested += t


        print "Running doctest on docs/ ..."
        doctest_dir('docs',verbose,severe)


        doctest.master.summarize(verbose=verbose)

    if len(targets):
        print "Unknown targets : %s" % str(targets)
Exemple #4
0
def main(targets):

    verbose = False
    severe = False

    if "-v" in targets:
        targets.remove("-v")
        verbose = True
        print "Gonna be verbose...!"
    else:
        console.set(verbosity=-1)

    if "-s" in targets:
        targets.remove("-s")
        severe = True
        if verbose:
            print "Gonna be severe...!"

    if len(targets) == 0:
        targets = ['unittest']
        #targets = ['html','tests']
        # targets = ['html','doctest']

    if 'tests' in targets:
        targets.remove('tests')
        targets += ('unittest', 'doctest')

    if 'clean' in targets:
        targets.remove('clean')
        for root, dirs, files in os.walk('.'):
            for fn in files:
                (name, ext) = os.path.splitext(fn)
                if ext in (".html", '.pdf'):
                    fn = os.path.join(root, fn)
                    if verbose:
                        print "removed:", fn
                    os.remove(fn)

    if 'upload_sf' in targets:
        targets.remove('upload_sf')
        os.chdir("docs")
        os.system(
            'rsync --rsh=ssh -v -r . [email protected]:/home/groups/l/li/lino/htdocs'
        )
        os.chdir("..")

    if 'html' in targets:
        targets.remove('html')
        print "Generating docs..."
        from lino.webman.static import wmm2html
        wmm2html(srcdir='docs', showOutput=False)  #,force=True)

    if 'unittest' in targets:
        targets.remove('unittest')
        print "Running unittest on test/ ..."
        #cwd = os.getcwd()
        #from os.path import join, getsize
        suites = []
        for root, dirs, files in os.walk('tests'):
            tests = [name[:-3] for name in files if name.endswith('.py')]
            if len(tests):
                print " collecting cases in " + root
                sys.path.append(os.path.abspath(root))
                # os.chdir(root)
                for modname in tests:
                    # print modname
                    s = tsttools.makesuite(modname)
                    suites.append(s)
                    # print os.path.join(root,modname+".py")
                    # unittest.main(modname)
            # don't visit CVS and _attic directories
            for dontGo in ('CVS', '_attic'):
                try:
                    dirs.remove(dontGo)
                except ValueError:
                    pass

        # os.chdir(cwd)
        runner = unittest.TextTestRunner()
        runner.run(unittest.TestSuite(suites))

    if 'doctest' in targets:
        targets.remove('doctest')

        from lino import adamo, sdoc
        modules = (adamo, sdoc)

        print "Running doctest on %s ..." % [M.__name__ for M in modules]
        failures = 0
        tested = 0
        for M in modules:
            (f, t) = doctest.testmod(M, verbose=False, report=0)
            if f != 0 and severe:
                raise FailuresFound,\
                        "Stopped after %d failures in %s" % (f,pfn)
            failures += f
            tested += t

        print "Running doctest on docs/ ..."
        doctest_dir('docs', verbose, severe)

        doctest.master.summarize(verbose=verbose)

    if len(targets):
        print "Unknown targets : %s" % str(targets)