Example #1
0
def _clean_build(plugdir):
    print("Cleaning " + plugdir)
    __setup(plugdir, ['clean', '-a'])
    files = [ 'build', 'dist', 'ez_setup.py', plugdir + '.egg-info' ]
    files = [ os.path.join(plugdir, f) for f in files ]
    shell('rm', '-rf', *files, silent=False)
    shell('find', '.', '-name', '*.pyc', '-delete')
Example #2
0
def benchmake(jobs):
    makefile = """
OBJECTS = \\
\t%s

benchmark: $(OBJECTS)
\t"%s" -o benchmark $(OBJECTS)

%%.o: %%.c
\t"%s" -c $< -o $@

%%.c: \\
\t%s
""" % (' \\\n\t'.join('source%d.o' % i for i in range(NUM_SOURCE_FILES)),
       COMPILER,
       COMPILER,
       ' \\\n\t'.join('header%d.h' % i for i in range(NUM_HEADER_FILES)))

    filename = os.path.join(BUILD_DIR, 'Makefile')
    f = open(filename, 'w')
    f.write(makefile)
    f.close()

    time0 = get_time()
    filename = os.path.join(BUILD_DIR, 'build.py')
    job_arg = '-j%d' % jobs
    fabricate.shell('make', job_arg, '-s', '-C', BUILD_DIR)
    elapsed_time = get_time() - time0
    return elapsed_time
Example #3
0
def _clean_build(plugdir):
    print("Cleaning " + plugdir)
    __setup(plugdir, ['clean', '-a'])
    files = ['build', 'dist', 'ez_setup.py', plugdir + '.egg-info']
    files = [os.path.join(plugdir, f) for f in files]
    shell('rm', '-rf', *files, silent=False)
    shell('find', '.', '-name', '*.pyc', '-delete')
Example #4
0
def release():
    if main.options.release is None:
        print("Must specify a version to release with --release <version>")
        sys.exit(1)

    rel = main.options.release

    if rel in check_output(['git', 'tag', '-l'],
                           universal_newlines=True).split('\n'):
        print("Version %s is already git tagged." % rel)
        sys.exit(1)

    _require_y("Release version %s ?" % rel)

    _set_version(rel)
    run(main.options.python, 'setup.py', 'sdist', '--formats=zip,gztar,bztar',
        'upload')
    run(main.options.python, 'setup.py', 'bdist_wheel', 'upload')
    shell('git', 'commit', 'setup.py', '-m', 'Release %s' % rel, silent=False)
    shell('git', 'tag', rel, silent=False)
    _set_version(rel + '-dev')
    shell('git',
          'commit',
          'setup.py',
          '-m',
          'Bump to %s-dev' % rel,
          silent=False)
    shell('git', 'push', silent=False)
    shell('git', 'push', '--tags', silent=False)
    clean_build()
    print("Released!")
Example #5
0
def _sub_repo(name, url):
    debug(lambda: "Updating themes")
    if not os.path.exists(name):
        run("git", "clone", url, name)
    with chdir(name):
        shell("git", "pull")
        shell("git", "submodule", "update", "--init", "--recursive")
Example #6
0
def benchmake(jobs):
    makefile = """
OBJECTS = \\
\t%s

benchmark: $(OBJECTS)
\t"%s" -o benchmark $(OBJECTS)

%%.o: %%.c
\t"%s" -c $< -o $@

%%.c: \\
\t%s
""" % (' \\\n\t'.join('source%d.o' % i for i in range(NUM_SOURCE_FILES)),
       COMPILER, COMPILER, ' \\\n\t'.join('header%d.h' % i
                                          for i in range(NUM_HEADER_FILES)))

    filename = os.path.join(BUILD_DIR, 'Makefile')
    f = open(filename, 'w')
    f.write(makefile)
    f.close()

    time0 = get_time()
    filename = os.path.join(BUILD_DIR, 'build.py')
    job_arg = '-j%d' % jobs
    fabricate.shell('make', job_arg, '-s', '-C', BUILD_DIR)
    elapsed_time = get_time() - time0
    return elapsed_time
Example #7
0
def _test_deps():
    _deps()
    shell('pip',
          'install',
          '-r',
          'requirements_tests.txt',
          ignore_status=False)
Example #8
0
def build():
    build_dir = BUILD_DIR
    pelican()
    themes()
    plugins()
    debug(lambda: "Building index and blogs")
    if not os.path.isdir(build_dir): os.mkdir(build_dir)
    indexfilename = os.path.join(build_dir, "index.html")
    with open(indexfilename, "w") as indexfile:
        for name in os.listdir(THEMES):
            if name in [ ".git" ]: continue
            path = os.path.join(THEMES, name)
            if not os.path.isdir(path): continue
            dest_theme = os.path.join(build_dir, name)
            if os.path.isdir(dest_theme): continue

            conf_file = os.path.join(THEMES, "configure-theme-" + name + ".py")
            shutil.copyfile("ipsumconf.py", conf_file)
            with open(conf_file, "a") as conf:
                conf.write('SITEURL="' + SITEURL + name + '"\n')
                if name == 'syte':
                    conf.write('PLUGIN_PATH="plugins"\n')
                    conf.write('PLUGINS=["assets"]\n')
            os.mkdir(dest_theme)
            print(_pelcmd('pelican'), '-t', path, '-o', dest_theme, '-s', conf_file, 'content')
            shell(_pelcmd('pelican'), '-t', path, '-o', dest_theme, '-s', conf_file, 'content', ignore_status=True, shell=True)
            indexfile.write('<h1><a href="' + name + '">' + name + '</a>')
            indexfile.write(' - <a href="' + THEMELINKBASE + name + '">source</a></h1>\n')
            theme_screenshot = os.path.join(THEMES, name, "screenshot.png")
            if os.path.exists(theme_screenshot):
                indexfile.write('<img src="' + name + '/screenshot.png">\n')
                run('cp', theme_screenshot, dest_theme)
            indexfile.write('<hr />\n')
Example #9
0
def _sub_repo(name, url):
    debug(lambda: "Updating themes")
    if not os.path.exists(name):
        run("git", "clone", url, name)
    with chdir(name):
        shell("git", "pull")
        shell("git", "submodule", "update", "--init", "--recursive")
Example #10
0
def clean():
    autoclean()
    shell('find', '.', '-name', '*.pyc', '-delete')
    clean_env()
    clean_smoke()
    clean_jenv()
    clean_test()
    clean_build()
Example #11
0
def clean():
    """clean all artifacts"""
    autoclean()
    shell('find', '.', '-name', '*.pyc', '-delete')
    clean_env()
    clean_sphinx()
    clean_test()
    clean_build()
Example #12
0
def clean():
    autoclean()
    shell('find', '.', '-name', '*.pyc', '-delete')
    clean_env()
    clean_smoke()
    clean_jenv()
    clean_test()
    clean_build()
Example #13
0
def clean():
    """clean all artifacts"""
    autoclean()
    shell('find', '.', '-name', '*.pyc', '-delete')
    clean_env()
    clean_sphinx()
    clean_jenv()
    clean_test()
    clean_build()
Example #14
0
def _test(pytest_args=()):
    _test_deps()
    pytest_args = pytest_args or shlex.split(os.environ.get('PYTEST_ARGS', ''))
    shell('python',
          '-m',
          'pytest',
          'tests',
          *pytest_args,
          ignore_status=False,
          silent=False)
    shell('pyflakes', 'aspen', 'tests', ignore_status=False, silent=False)
Example #15
0
def namecoindns_update():
    gitdir = namecoindns_gitdir
    env = os.environ
    env['GIT_DIR'] = gitdir + '/.git'
    shell('rm', '-rf', gitdir)
    shell('git', 'clone', 'https://github.com/khalahan/NamecoinToBind.git', gitdir)
    shell(('git log -n 1 > %s/LOG_HEAD' % gitdir).split(), shell=True, env=env, cwd=gitdir, silent=False)
    archive = os.path.join(os.getcwd(), _docker_dir('namecoin-dns'), 'NamecoinToBind.tar.gz')
    shell('git', 'archive', '-o', archive, 'HEAD', cwd=gitdir, silent=False)
Example #16
0
def benchmark(runner, jobs):
    if runner == 'always_runner':
        delete_deps()

    para = (', parallel_ok=True, jobs=%d' % jobs) if jobs > 1 else ''
    build_file = r"""
from fabricate import *

sources = [
    %s
]

def build():
    compile()
    after()
    link()

def compile():
    for source in sources:
        run(%s, '-c', source + '.c')

def link():
    objects = [s + '.o' for s in sources]
    run(%s, '-o', 'benchmark', objects)

def clean():
    autoclean()

main(runner='%s'%s)
""" % (',\n    '.join("'source%d'" % i for i in range(NUM_SOURCE_FILES)),
       repr(COMPILER),
       repr(COMPILER),
       runner,
       para)

    filename = os.path.join(BUILD_DIR, 'build.py')
    f = open(filename, 'w')
    f.write(build_file)
    f.close()

    time0 = get_time()
    filename = os.path.join(BUILD_DIR, 'build.py')
    fabricate.shell('python', filename, '-q')
    elapsed_time = get_time() - time0
    return elapsed_time
Example #17
0
def aspen():
    _env()
    v = shell(_virt('python'), '-c', 'import aspen; print("found")', ignore_status=True)
    if "found" in v:
        return
    for dep in ASPEN_DEPS:
        run(_virt('pip'), 'install', '--no-index',
            '--find-links=' + INSTALL_DIR, dep)
    run(_virt('python'), 'setup.py', 'develop')
Example #18
0
def build():
    build_dir = BUILD_DIR
    pelican()
    themes()
    plugins()
    debug(lambda: "Building index and blogs")
    if not os.path.isdir(build_dir): os.mkdir(build_dir)
    indexfilename = os.path.join(build_dir, "index.html")
    with open(indexfilename, "w") as indexfile:
        for name in os.listdir(THEMES):
            if name in [".git"]: continue
            path = os.path.join(THEMES, name)
            if not os.path.isdir(path): continue
            dest_theme = os.path.join(build_dir, name)
            if os.path.isdir(dest_theme): continue

            conf_file = os.path.join(THEMES, "configure-theme-" + name + ".py")
            shutil.copyfile("ipsumconf.py", conf_file)
            with open(conf_file, "a") as conf:
                conf.write('SITEURL="' + SITEURL + name + '"\n')
                if name == 'syte':
                    conf.write('PLUGIN_PATH="plugins"\n')
                    conf.write('PLUGINS=["assets"]\n')
            os.mkdir(dest_theme)
            print(_pelcmd('pelican'), '-t', path, '-o', dest_theme, '-s',
                  conf_file, 'content')
            shell(_pelcmd('pelican'),
                  '-t',
                  path,
                  '-o',
                  dest_theme,
                  '-s',
                  conf_file,
                  'content',
                  ignore_status=True,
                  shell=True)
            indexfile.write('<h1><a href="' + name + '">' + name + '</a>')
            indexfile.write(' - <a href="' + THEMELINKBASE + name +
                            '">source</a></h1>\n')
            theme_screenshot = os.path.join(THEMES, name, "screenshot.png")
            if os.path.exists(theme_screenshot):
                indexfile.write('<img src="' + name + '/screenshot.png">\n')
                run('cp', theme_screenshot, dest_theme)
            indexfile.write('<hr />\n')
Example #19
0
def _deps(envdir='env'):
    envdir = _env(envdir)
    v = shell(_virt('python', envdir), '-c', 'import aspen; print("found")', ignore_status=True)
    if b"found" in v:
        return envdir
    for dep in ASPEN_DEPS:
        run(_virt('pip', envdir), 'install', '--no-index',
            '--find-links=' + INSTALL_DIR, dep)
    run(_virt('python', envdir), 'setup.py', 'develop')
    return envdir
Example #20
0
def benchmark(runner, jobs):
    if runner == 'always_runner':
        delete_deps()

    para = (', parallel_ok=True, jobs=%d' % jobs) if jobs > 1 else ''
    build_file = r"""
from fabricate import *

sources = [
    %s
]

def build():
    compile()
    after()
    link()

def compile():
    for source in sources:
        run(%s, '-c', source + '.c')

def link():
    objects = [s + '.o' for s in sources]
    run(%s, '-o', 'benchmark', objects)

def clean():
    autoclean()

main(runner='%s'%s)
""" % (',\n    '.join("'source%d'" % i for i in range(NUM_SOURCE_FILES)),
       repr(COMPILER), repr(COMPILER), runner, para)

    filename = os.path.join(BUILD_DIR, 'build.py')
    f = open(filename, 'w')
    f.write(build_file)
    f.close()

    time0 = get_time()
    filename = os.path.join(BUILD_DIR, 'build.py')
    fabricate.shell('python', filename, '-q')
    elapsed_time = get_time() - time0
    return elapsed_time
Example #21
0
def release():
    if main.options.release is None:
        print("Must specify a version to release with --release <version>")
        sys.exit(1)

    rel = main.options.release

    if rel in check_output(['git', 'tag', '-l'],universal_newlines=True).split('\n'):
        print("Version %s is already git tagged." % rel)
        sys.exit(1)

    _require_y("Release version %s ?" % rel)

    _set_version(rel)
    run(main.options.python, 'setup.py', 'sdist', '--formats=zip,gztar,bztar', 'upload')
    run(main.options.python, 'setup.py', 'bdist_wheel', 'upload')
    shell('git', 'commit', 'setup.py', '-m', 'Release %s' % rel, silent=False) 
    shell('git', 'tag', rel, silent=False)
    _set_version(rel + '-dev')
    shell('git', 'commit', 'setup.py', '-m', 'Bump to %s-dev' % rel, silent=False) 
    shell('git', 'push', silent=False)
    shell('git', 'push', '--tags', silent=False)
    clean_build()
    print("Released!")
Example #22
0
def env():
    if not shell('python', '--version').startswith('Python 2.7'):
        raise SystemExit('Error: Python 2.7 required')

    fab_run('python', './vendor/virtualenv-1.7.1.2.py',
            '--unzip-setuptools',
            '--prompt="[gittip] "',
            '--never-download',
            '--extra-search-dir=' + p('./vendor/'),
            '--distribute',
            p('./env/'))

    pip_install('-r', p('./requirements.txt'))
    pip_install(p('./vendor/nose-1.1.2.tar.gz'))
    pip_install('-e', p('./'))
Example #23
0
def getVersion():
    """
        Returns the version number for the plugin
    """
    now = datetime.datetime.now()
    year = now.year
    month = now.month
    day = now.day
    try:
        commit = shell('git', 'log', '-1', '--pretty=%h').strip()
    except WindowsError:
        commit = ""
    except ExecutionError:
        commit = ""
    return "{0}.{1}.{2}.{3}".format(year, month, day, commit)
Example #24
0
def dev(envdir='./env'):
    if os.path.exists(envdir): return
    args = [ main.options.python ] + ENV_ARGS + [ envdir ]
    shell(*args, silent=False)
    for plugin in PLUGINS:
        print("Running %s install -e %s..." % (_virt('pip', envdir=envdir), plugin))
        if not os.path.exists(os.path.join(plugin, 'ez_setup.py')):
            shutil.copy('ez_setup.py', plugin)
        # --find-links added for Cheroot which is current not hosted in PyPI
        shell(_virt('pip', envdir=envdir),
              'install', '-e', './'+plugin, '--find-links=./vendor', silent=False)
    for pkg in DEV_DEPS:
        shell(_virt('pip', envdir=envdir),
              'install', pkg, silent=False)
Example #25
0
def dev(envdir='./env'):
    if os.path.exists(envdir): return
    args = [main.options.python] + ENV_ARGS + [envdir]
    shell(*args, silent=False)
    for plugin in PLUGINS:
        print("Running %s install -e %s..." %
              (_virt('pip', envdir=envdir), plugin))
        if not os.path.exists(os.path.join(plugin, 'ez_setup.py')):
            shutil.copy('ez_setup.py', plugin)
        # --find-links added for Cheroot which is current not hosted in PyPI
        shell(_virt('pip', envdir=envdir),
              'install',
              '-e',
              './' + plugin,
              '--find-links=./vendor',
              silent=False)
    for pkg in DEV_DEPS:
        shell(_virt('pip', envdir=envdir), 'install', pkg, silent=False)
Example #26
0
def docs():
    aspen()
    run(_virt('pip'), 'install', 'aspen-tornado')
    run(_virt('pip'), 'install', 'pygments')
    shell(_virt('aspen'), '-a:5370', '-wdoc', '-pdoc/.aspen', '--changes_reload=1', silent=False)
Example #27
0
def clean_sphinx():
    """clean sphinx artifacts"""
    shell('rm', '-rf', 'docs/_build')
Example #28
0
def _clean_sub_repo(name):
    debug(lambda: "Cleaning " + name)
    shell("rm", "-rf", name)
Example #29
0
def clean_jtest():
    """clean jython test results"""
    shell('find', '.', '-name', '*.class', '-delete')
    shell('rm', '-rf', 'jython-testresults.xml')
Example #30
0
def clean_test():
    """clean test artifacts"""
    clean_env()
    shell('rm', '-rf', '.coverage', 'coverage.xml', 'testresults.xml', 'htmlcov', 'pylint.out')
Example #31
0
def test():
    """run all tests"""
    shell(_virt('py.test', _dev_deps()), 'tests/', ignore_status=True, silent=False)
Example #32
0
def namecoindns_run():
    env = os.environ
    env['NAMECOIN_USERNAME'] = '******'
    env['NAMECOIN_PASSWORD'] = '******'
    env['NAMECOIN_HOSTNAME'] = 'localhost.localdomain'
    shell('docker', 'run', '-d', '-t', '-p', '53053:53', '-p', '53053:53/udp', 'pjz/namecoin-dns', silent=False, env=env)
Example #33
0
def namecoindns_clean():
    shell('rm', '-rf', namecoindns_gitdir)
Example #34
0
def test(envdir='./env'):
    dev(envdir=envdir)
    shell(_virt('py.test', envdir=envdir),
          'tests/',
          ignore_status=True,
          silent=False)
Example #35
0
def base_image():
    shell('docker', 'build', '-t', 'pjzz/base', '.', cwd=_docker_dir('base'), silent=False)
Example #36
0
def clean():
    autoclean()
    shell('rm','-rf', BUILDDIR)
Example #37
0
def publish():
    build()
    shell('s3cmd', 'sync', BUILDDIR + '/', S3_BUCKET)
Example #38
0
def docs():
    aspen()
    run(_virt('pip'), 'install', 'aspen-tornado')
    run(_virt('pip'), 'install', 'pygments')
    shell(_virt('aspen'), '-a:5370', '-wdoc', '-pdoc/.aspen',
          '--changes_reload=1', silent=False)
Example #39
0
def clean_dev(envdir='./env'):
    shell('rm', '-rf', './env', silent=False)
Example #40
0
def clean_sphinx():
    """clean sphinx artifacts"""
    shell('rm', '-rf', 'docs/_build')
    shell('rm', '-rf', 'denv')
Example #41
0
def clean_dev():
    shell('rm', '-rf', 'env')
Example #42
0
def testf():
    """run tests, stopping at the first failure"""
    shell(_virt('py.test', _dev_deps()), '-x', 'tests/', ignore_status=True, silent=False)
Example #43
0
def clean_test():
    clean_dev()
    shell('rm', '-f', '.coverage', 'coverage.xml', 'testresults.xml',
          'pylint.out')
Example #44
0
def clean_jenv():
    """clean up the jython environment"""
    shell('find', '.', '-name', '*.class', '-delete')
    shell('rm', '-rf', 'jenv', 'vendor/jython-installer.jar', 'jython_home')
Example #45
0
def clean_build():
    shell(main.options.python, 'setup.py', 'clean', '-a')
    shell('rm', '-rf', 'dist')
Example #46
0
def _virt_version(envdir):
    v = shell(_virt('python', envdir), '-c',
              'import sys; print(sys.version_info[:2])')
    return eval(v)
Example #47
0
def _virt_version(envdir):
    v = shell(_virt('python', envdir), '-c',
              'import sys; print(sys.version_info[:2])')
    return eval(v)
Example #48
0
def test():
    aspen()
    dev()
    shell(_virt('py.test'), 'tests/', ignore_status=True, silent=False)
Example #49
0
def clean_jtest():
    shell('find', '.', '-name', '*.class', '-delete')
    shell('rm', '-rf', 'jython-testresults.xml')
Example #50
0
def clean_smoke():
    shell('rm', '-rf', smoke_dir)
Example #51
0
def clean_build():
    debug(lambda: "Cleaning index and blogs")
    shell("rm", "-rf", BUILD_DIR)
Example #52
0
def _tox(*args, **kw):
    _env()
    _install_tox()
    kw.setdefault('silent', False)
    shell('tox', '--skip-missing-interpreters', '--', *args, **kw)
Example #53
0
def docserve():
    """run the aspen website"""
    envdir = _deps()
    run(_virt('pip', envdir), 'install', 'aspen-tornado')
    run(_virt('pip', envdir), 'install', 'pygments')
    shell(_virt('python', envdir), '-m', 'aspen_io', silent=False)
Example #54
0
def clean_test():
    """clean test artifacts"""
    shell('rm', '-rf', '.tox')
    shell('rm', '-rf', '.coverage', 'coverage.xml', 'testresults.xml',
          'htmlcov', 'pylint.out')
Example #55
0
def clean_env():
    shell('rm', '-rf', 'env')
Example #56
0
def _install_tox():
    # install tox if it isn't there
    try:
        shell('pip', 'show', 'tox')
    except ExecutionError:
        run('pip', 'install', 'tox')
Example #57
0
def clean_env():
    """clean env artifacts"""
    shell('rm', '-rf', 'env')
Example #58
0
def clean_env():
    """clean env artifacts"""
    shell('rm', '-rf', 'env')
Example #59
0
def clean_pelican():
    debug(lambda: "Cleaning pelican")
    shell("rm", "-rf", PEL_BASE)