Пример #1
0
def main():
    """Invokes the tasks defined in _tasks.py, with some configuration."""

    try:
        from invoke import Collection, Program  # isort:skip
        from sdsstools import _tasks  # isort:skip
    except (ImportError, ModuleNotFoundError):
        raise ImportError("Cannot find invoke. Make sure sdsstools "
                          "is installed for development.")

    # Use the metadata file to determine the root of the package.
    metadata_file = get_metadata_files(".")
    if metadata_file is None:
        raise RuntimeError("cannot find the root of the package.")

    os.chdir(os.path.dirname(metadata_file))

    # Override the configuration if there is an invoke.yaml file next to the
    # metadata file.
    if os.path.exists("./invoke.yaml"):
        config = yaml.safe_load(open("invoke.yaml"))
        print("Using configuration file invoke.yaml")
    else:
        config = None

    program = Program(version=__version__,
                      namespace=Collection.from_module(_tasks, config=config))
    program.run()
Пример #2
0
def setup_from_tasks(globals_dict,
                     main_package=None,
                     settings_module_name=None,
                     **kwargs):
    """
    This is the function you must call from your :xfile:`tasks.py` file
    in order to activate the tasks defined by atelier.

    Arguments:

    - `globals_dict` must be the `globals()` of the calling script.

    - Optional `main_package` is the name of the main Python package provided by
      this project.

    - Optional `settings_module_name` will be stored in the
      :envvar:`DJANGO_SETTINGS_MODULE`, and certain project configuration
      options will get their default value from that module.

    - All remaining keyword arguments are project configuration parameters and
      stored to the :ref:`project configuration options <atelier.prjconf>`.

    """
    if '__file__' not in globals_dict:
        raise Exception(
            "No '__file__' in %r. "
            "First argument to setup_from_tasks() must be `globals()`." %
            globals_dict)

    tasks_file = Path(globals_dict['__file__'])
    if not tasks_file.exists():
        raise Exception("No such file: %s" % tasks_file)
    # print("20180428 setup_from_tasks() : {}".format(root_dir))

    from atelier.invlib import tasks
    from atelier.projects import get_project_from_tasks
    prj = get_project_from_tasks(tasks_file.parent)

    if atelier.current_project is None:
        atelier.current_project = prj

    if kwargs:
        prj.config.update(kwargs)

    if settings_module_name is not None:
        os.environ['DJANGO_SETTINGS_MODULE'] = settings_module_name
        from django.conf import settings
        prj.config.update(
            languages=[lng.name for lng in settings.SITE.languages])

    if isinstance(main_package, str):
        main_package = import_module(main_package)
    if main_package:
        prj.set_main_package(main_package)

    self = Collection.from_module(tasks)
    prj.set_namespace(self)

    return self
Пример #3
0
 def explicit_namespace_works_correctly(self):
     # Regression-ish test re #288
     ns = Collection.from_module(load('integration'))
     expect(
         'print_foo',
         out='foo\n',
         program=Program(namespace=ns),
     )
Пример #4
0
 def explicit_namespace_works_correctly(self):
     # Regression-ish test re #288
     ns = Collection.from_module(load('integration'))
     expect(
         'print-foo',
         out='foo\n',
         program=Program(namespace=ns),
     )
Пример #5
0
def main():
    config = {
        'run': {
            'echo': True
        },
        'NINJA_STATUS': '[%f/%t (%p) %es]'  # make the ninja output even nicer
    }

    ns = Collection.from_module(tasks, config=config)
    ns.add_collection(
        Collection.from_module(setupenv, name='setup-dev-env', config=config))

    p = Program(binary='m(mongodb command line tool)',
                name='MongoDB Command Line Tool',
                namespace=ns,
                version='1.0.0-alpha2')

    p.run()
Пример #6
0
def _site(name, build_help):
    _path = join('sites', name)
    # TODO: turn part of from_module into .clone(), heh.
    self = sys.modules[__name__]
    coll = Collection.from_module(self, name=name, config={
        'sphinx': {
            'source': _path,
            'target': join(_path, '_build')
        }
    })
    coll['build'].__doc__ = build_help
    return coll
Пример #7
0
def _site(name, help_part):
    _path = join("sites", name)
    # TODO: turn part of from_module into .clone(), heh.
    self = sys.modules[__name__]
    coll = Collection.from_module(
        self,
        name=name,
        config={"sphinx": {"source": _path, "target": join(_path, "_build")}},
    )
    coll.__doc__ = "Tasks for building {}".format(help_part)
    coll["build"].__doc__ = "Build {}".format(help_part)
    return coll
Пример #8
0
def _site(name, help_part):
    _path = join('sites', name)
    # TODO: turn part of from_module into .clone(), heh.
    self = sys.modules[__name__]
    coll = Collection.from_module(self, name=name, config={
        'sphinx': {
            'source': _path,
            'target': join(_path, '_build')
        }
    })
    coll.__doc__ = "Tasks for building {}".format(help_part)
    coll['build'].__doc__ = "Build {}".format(help_part)
    return coll
Пример #9
0
def _site(name, build_help):
    _path = join('sites', name)
    # TODO: turn part of from_module into .clone(), heh.
    self = sys.modules[__name__]
    coll = Collection.from_module(
        self,
        name=name,
        config={'sphinx': {
            'source': _path,
            'target': join(_path, '_build')
        }})
    coll['build'].__doc__ = build_help
    return coll
Пример #10
0
def run():
    invoke_config = {
        'run': {
            'hide': True  # Don't print stdout or stderr.
        },
        'NINJA_STATUS': '[%f/%t (%p) %es] '  # make the ninja output even nicer
    }

    ns = Collection.from_module(tasks, config=invoke_config)
    ns.add_collection(
        Collection.from_module(setupenv, name='setup', config=invoke_config))
    ns.add_collection(
        Collection.from_module(helpers, name='helpers', config=invoke_config))

    proj_info = pkg_resources.require("server_workflow_tool")[0]

    p = Program(binary='workflow',
                name=proj_info.project_name,
                namespace=ns,
                version=proj_info.version)

    p.parse_core(sys.argv[1:])

    if p.args.debug.value:
        get_logger(level=logging.DEBUG)
    else:
        get_logger(level=logging.INFO)

    c = Config()
    try:
        p.run()
    except (InvalidConfigError, RequireUserInputError):
        # These errors are not actionable right now.
        sys.exit(1)
    finally:
        c.dump()
Пример #11
0
def _site(name, help_part):
    _path = join("sites", name)
    # TODO: turn part of from_module into .clone(), heh.
    self = sys.modules[__name__]
    coll = Collection.from_module(
        self,
        name=name,
        config={"sphinx": {
            "source": _path,
            "target": join(_path, "_build")
        }},
    )
    coll.__doc__ = "Tasks for building {}".format(help_part)
    coll["build"].__doc__ = "Build {}".format(help_part)
    return coll
Пример #12
0
def setup_from_tasks(
    globals_dict, main_package=None,
    settings_module_name=None, **kwargs):
    """
    This is the function you must call from your :xfile:`tasks.py` file
    in order to activate the tasks defined by atelier.
    """
    if '__file__' not in globals_dict:
        raise Exception(
            "No '__file__' in %r. "
            "First parameter to must be `globals()`" % globals_dict)

    tasks_file = Path(globals_dict['__file__'])
    if not tasks_file.exists():
        raise Exception("No such file: %s" % tasks_file)
    # print("20180428 setup_from_tasks() : {}".format(root_dir))

    from atelier.invlib import tasks
    from atelier.projects import get_project_from_tasks
    prj = get_project_from_tasks(tasks_file.parent)
    atelier.current_project = prj
    
    if kwargs:
        prj.config.update(kwargs)
        
    if settings_module_name is not None:
        os.environ['DJANGO_SETTINGS_MODULE'] = settings_module_name
        from django.conf import settings
        prj.config.update(
            languages=[lng.name for lng in settings.SITE.languages])

    if isinstance(main_package, six.string_types):
        main_package = import_module(main_package)
    if main_package:
        prj.set_main_package(main_package)
        
    self = Collection.from_module(tasks)
    prj.set_namespace(self)

    return self
Пример #13
0
    init(ctx)


@task(aliases=["examples"])
def cmake_examples(ctx, build_config=None):
    """Build CMake examples."""
    build_config = build_config or "Debug"
    with cd("examples/"):
        ctx.run("make BUILD_CONFIG={0}".format(build_config))


# -----------------------------------------------------------------------------
# TASK CONFIGURATION:
# -----------------------------------------------------------------------------
namespace = Collection()
namespace.add_collection(Collection.from_module(cleanup), name="cleanup")
namespace.add_task(init)
namespace.add_task(reinit)
namespace.add_task(cmake_examples)
namespace.add_collection(Collection.from_module(test))
namespace.add_collection(Collection.from_module(cmake_build, name="cmake"))
# DISABLED: namespace.add_collection(Collection.from_module(docs))
# DISABLED: namespace.add_collection(Collection.from_module(release))

cleanup.cleanup_tasks.add_task(cleanup.clean_python)

# -- INJECT: clean configuration into this namespace
namespace.configure(cleanup.namespace.configuration())
if sys.platform.startswith("win"):
    # -- OVERRIDE SETTINGS: For platform=win32, ... (Windows)
    from ._compat_shutil import which
Пример #14
0
 def _load(self, name):
     mod, _ = self.loader.load(name)
     return Collection.from_module(mod)
Пример #15
0
HERE = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
WHEELHOUSE_PATH = os.environ.get('WHEELHOUSE')
CONSTRAINTS_PATH = os.path.join(HERE, 'requirements', 'constraints.txt')

try:
    __import__('rednose')
except ImportError:
    TEST_CMD = 'nosetests'
else:
    TEST_CMD = 'nosetests --rednose'

ns = Collection()

try:
    from admin import tasks as admin_tasks
    ns.add_collection(Collection.from_module(admin_tasks), name='admin')
except ImportError:
    pass


def task(*args, **kwargs):
    """Behaves the same way as invoke.task. Adds the task
    to the root namespace.
    """
    if len(args) == 1 and callable(args[0]):
        new_task = invoke.task(args[0])
        ns.add_task(new_task)
        return new_task
    def decorator(f):
        new_task = invoke.task(f, *args, **kwargs)
        ns.add_task(new_task)
    extract_cards_from_video,
    VideoExtractionParameters,
)
from card_generator.find_convex_hull import (
    find as find_convex_hull_impl,
    FindParameters as FindConvexHullParameters,
)
from card_generator.decks.base import Deck, CardGroup
from card_generator.util import show_images_in_windows
from .util import augment_with_task_decorator, get_deck_by_name
from tasks import test

DATA_DIR = "data"

ns = augment_with_task_decorator(Collection())
ns.add_collection(Collection.from_module(test))
task = ns.task


@task
def fetch_backgrounds(c):
    c.run("rm dtd-r1.0.1.tar.gz")
    c.run(
        "wget https://www.robots.ox.ac.uk/~vgg/data/dtd/download/dtd-r1.0.1.tar.gz",
        pty=True,
    )
    c.run("tar xf dtd-r1.0.1.tar.gz")
    c.run("mv dtd/images/* data/backgrounds")
    print("done")

Пример #17
0
from os.path import join

from invoke import Collection
from invocations import docs as _docs, testing


d = 'sites'

# Usage doc/API site (published as docs.paramiko.org)
path = join(d, 'docs')
docs = Collection.from_module(_docs, name='docs', config={
    'sphinx.source': path,
    'sphinx.target': join(path, '_build'),
})

# Main/about/changelog site ((www.)?paramiko.org)
path = join(d, 'www')
www = Collection.from_module(_docs, name='www', config={
    'sphinx.source': path,
    'sphinx.target': join(path, '_build'),
})

ns = Collection(testing.test, docs=docs, www=www)
Пример #18
0
import pkg_resources
from invoke import Argument, Collection, Program

import rdeploy


class MainProgram(Program):
    def core_args(self):
        core_args = super(MainProgram, self).core_args()
        extra_args = [
            Argument(names=('project', 'n'), help="The project/package name being build"),
        ]
        return core_args + extra_args


version = pkg_resources.get_distribution("rdeploy").version
program = MainProgram(namespace=Collection.from_module(rdeploy), version=version)
Пример #19
0
def main():
    program = Program(namespace=Collection.from_module(sys.modules[__name__]),
                      version='0.1.0')
    program.run()
Пример #20
0
from invoke import Collection, Program
from reform import tasks

program = Program(namespace=Collection.from_module(tasks), version="0.2.1")
Пример #21
0
from . import core as _core
from invoke import Collection as _Collection, task as _task

ns = _Collection.from_module(_core)


def task(*args, **kwargs):
    if not kwargs and len(args) == 1 and callable(args[0]):
        task = _task(args[0])
        ns.add_task(task)
    else:

        def decorator(func):
            task = _task(func)
            ns.add_task(task)
            return task

        return decorator
Пример #22
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import absolute_import
from invoke import Collection
from . import demo
from . import image
from . import email

from thread_learn import queue_ctrl_c

ns = Collection()  # must be ns?
ns.add_collection(Collection.from_module(demo))
ns.add_collection(Collection.from_module(image))
ns.add_collection(Collection.from_module(email))

ns.add_collection(Collection.from_module(queue_ctrl_c))
Пример #23
0
 def explicit_namespace_works_correctly(self):
     # Regression-ish test re #288
     ns = Collection.from_module(load("integration"))
     expect("print-foo", out="foo\n", program=Program(namespace=ns))
Пример #24
0
from invoke import Collection
from tasks import build, docker, lint, server, test

ns = Collection()
ns.add_collection(Collection.from_module(build))
ns.add_collection(Collection.from_module(docker))
ns.add_collection(Collection.from_module(lint))
ns.add_collection(Collection.from_module(server))
ns.add_collection(Collection.from_module(test))
Пример #25
0
#!/usr/bin/env python3
"""Command line tasks to build and deploy the ACW Battle Data."""
from invoke import Collection

from . import data, misc

ns = Collection(misc.clean, misc.doc, misc.deploy, misc.check_tables)
ns.add_task(data.build, name='build', default=True)
ns.add_collection(Collection.from_module(data))
Пример #26
0
from . import core as _core
from invoke import Collection as _Collection, task as _task

ns = _Collection.from_module(_core)


def task(*args, **kwargs):
    if not kwargs and len(args) == 1 and callable(args[0]):
        task = _task(args[0])
        ns.add_task(task)
    else:
        def decorator(func):
            task = _task(func)
            ns.add_task(task)
            return task
        return decorator
Пример #27
0
from invoke import Collection, Program, Argument
from dstack_factory import tasks


class FactoryProgram(Program):
    def core_args(self):
        core_args = super(FactoryProgram, self).core_args()
        extra_args = [
            Argument(names=('project', 'n'),
                     help="The project/package name being build"),
        ]
        return core_args + extra_args


program = FactoryProgram(namespace=Collection.from_module(tasks),
                         version='1.0.5')
Пример #28
0
@task
def clean(ctx):
    """Clean up release artifacts."""
    if RELEASE_DIR.is_dir():
        try:
            shutil.rmtree(str(RELEASE_DIR))
        except (OSError, shutil.Error) as e:
            logging.warning("Error while cleaning release dir: %s", e)
        else:
            RELEASE_DIR.mkdir()


# Task setup

ns = Collection()
ns.add_task(all_, default=True)
ns.add_task(clean)

# Import every task from submodules directly into the root task namespace
# (without creating silly qualified names like `release.fpm.deb`
# instead of just `release.deb`).
submodules = [f.stem for f in Path(__file__).parent.glob('*.py')
              if f.name != '__init__.py']
this_module = __import__('tasks.release', fromlist=submodules)
for mod_name in submodules:
    module = getattr(this_module, mod_name)
    collection = Collection.from_module(module)
    for task_name in collection.task_names:
        task = getattr(module, task_name)
        ns.add_task(task)
Пример #29
0
from invoke import Collection
from invoke import Program
import invoke_cptasklib
import invoke_cptasklib.tasks.file_util as file_util

program = Program(namespace=Collection.from_module(file_util), version='0.1')

Пример #30
0
 def _load(self, name):
     mod, _ = self.loader.load(name)
     return Collection.from_module(mod)
Пример #31
0
from invoke import Collection, task
from reliabilly.tasks import docker, build, data, tests, process, deploy, chat, k8s, publish
from reliabilly.scaffold.generator import scaffold_up_service
from reliabilly.settings import Constants, Settings


ns = Collection()  # pylint: disable=invalid-name
ns.add_collection(Collection.from_module(docker))
ns.add_collection(Collection.from_module(process))
ns.add_collection(Collection.from_module(build))
ns.add_collection(Collection.from_module(deploy))
ns.add_collection(Collection.from_module(data))
ns.add_collection(Collection.from_module(tests))
ns.add_collection(Collection.from_module(chat))
ns.add_collection(Collection.from_module(k8s))


def get_collections():
    collections = list(ns.collections)
    collections.sort()
    return collections


@task(default=True, pre=[build.lint, tests.test], aliases=['build'])
def default(_):
    """ Default invoke task which should be run often during development. """


@task(pre=[build.lint, tests.test, tests.integration])
def rebuild(_):
    """ Run lint, unit tests, purge, build, and integration tests. """
Пример #32
0
import os.path

from invoke import Collection

from app import create_app
from task import db as database, misc, pkg, assets
from task.db import get_project_root

_project_root = get_project_root(__file__)

_app = create_app(os.getenv('ENV') or 'default')

ns = Collection.from_module(misc)
ns.configure({'config': _app.config, 'project_root': _project_root})

ns.add_collection(Collection.from_module(database))
ns.add_collection(Collection.from_module(pkg))
ns.add_collection(Collection.from_module(assets))
Пример #33
0
def default(_):
    u""" Default Invoke will run tests """
    pass


@task(pre=deploy.cfn_up)
def cfn_up(_):
    u""" Stand up Cloudformation Resources """
    pass


@task(pre=deploy.cfn_down)
def cfn_down(_):
    u""" Teardown Cloudformation Resources """
    pass

@task(pre=deploy.cfn_update)
def cfn_update(_):
    u""" Update Cloudformation Stack """
    pass

ns = Collection()
ns.add_collection(Collection.from_module(tests))
ns.add_collection(Collection.from_module(deploy))

ns.add_task(default)
ns.add_task(tests.test)
ns.add_task(deploy.cfn_up)
ns.add_task(deploy.cfn_down)
ns.add_task(deploy.cfn_update)
Пример #34
0
from invocations import docs
from invocations.testing import test
from invocations.packaging import vendorize, release

from invoke import task, run, Collection


@task
def doctree():
    run("tree -Ca -I \".git|*.pyc|*.swp|dist|*.egg-info|_static|_build\" docs")

docs = Collection.from_module(docs)
docs.add_task(doctree, 'tree')
ns = Collection(test, vendorize, release, docs)
Пример #35
0
from invoke import Collection
import sys

# -- TASK-LIBRARY:
from . import clean
from . import docs
from . import test

# -----------------------------------------------------------------------------
# TASKS:
# -----------------------------------------------------------------------------
# None

# -----------------------------------------------------------------------------
# TASK CONFIGURATION:
# -----------------------------------------------------------------------------
namespace = Collection()
namespace.add_task(clean.clean)
namespace.add_task(clean.clean_all)
namespace.add_collection(Collection.from_module(docs))
namespace.add_collection(Collection.from_module(test))

# -- INJECT: clean configuration into this namespace
namespace.configure(clean.namespace.configuration())
if sys.platform.startswith("win"):
    # -- OVERRIDE SETTINGS: For platform=win32, ... (Windows)
    run_settings = dict(echo=True,
                        pty=False,
                        shell="C:/Windows/System32/cmd.exe")
    namespace.configure({"run": run_settings})
Пример #36
0
import pathlib
import sys
from invoke import Collection

from tasks.root import *

ns = Collection.from_module(sys.modules[__name__])

collections = [
    'assets',
    'analysis',
    'deploy',
    'dictionary',
    'exports',
    'fonts',
    'jsdata',
    'log',
    'newrelic',
    'search',
    'test',
    'textdata',
    'tmp',
    'travis',
]

for collection in collections:
    exec('from tasks import {} as module'.format(collection))
    ns.add_collection(module)
Пример #37
0
from invoke import Collection, task

from . import coverage, test
from .helpers import get_app_cmd, prun, s

coverage = Collection.from_module(coverage)
test = Collection.from_module(test)


@task
def install(c):
    """Install the project dependencies.

    """
    c.run("poetry install", pty=True)


@task
def lint(c):
    """Run linters (pycodestyle, pylint and mypy) on the code.

    """
    prun(c, "flake8 app")
    prun(c, "pylint app")
    prun(c, "mypy app")


@task(default=True)
def run(c, host=None, port=None, reload=False):
    """Run the app server process.
Пример #38
0
import sys
from invoke import Collection

# -- TASK-LIBRARY:
from . import _tasklet_cleanup as clean
from . import test
from . import release

# -----------------------------------------------------------------------------
# TASKS:
# -----------------------------------------------------------------------------
# None


# -----------------------------------------------------------------------------
# TASK CONFIGURATION:
# -----------------------------------------------------------------------------
namespace = Collection()
namespace.add_task(clean.clean)
namespace.add_task(clean.clean_all)
namespace.add_collection(Collection.from_module(test))
namespace.add_collection(Collection.from_module(release))

# -- INJECT: clean configuration into this namespace
namespace.configure(clean.namespace.configuration())
if sys.platform.startswith("win"):
    # -- OVERRIDE SETTINGS: For platform=win32, ... (Windows)
    from ._compat_shutil import which
    run_settings = dict(echo=True, pty=False, shell=which("cmd"))
    namespace.configure({"run": run_settings})
Пример #39
0
from . import test
from . import release

# -----------------------------------------------------------------------------
# TASKS:
# -----------------------------------------------------------------------------
# None


# -----------------------------------------------------------------------------
# TASK CONFIGURATION:
# -----------------------------------------------------------------------------
namespace = Collection()
# DISABLED: namespace.add_task(clean.clean)
# DISABLED: namespace.add_task(clean.clean_all)
namespace.add_collection(Collection.from_module(cleanup), name="cleanup")
namespace.add_collection(Collection.from_module(docs))
namespace.add_collection(Collection.from_module(test))
namespace.add_collection(Collection.from_module(release))
cleanup.cleanup_tasks.add_task(cleanup.clean_python)

cleanup.cleanup_tasks.add_task(cleanup.clean_python)

# -- INJECT: clean configuration into this namespace
namespace.configure(cleanup.namespace.configuration())
if sys.platform.startswith("win"):
    # -- OVERRIDE SETTINGS: For platform=win32, ... (Windows)
    from ._compat_shutil import which
    run_settings = dict(echo=True, pty=False, shell=which("cmd"))
    namespace.configure({"run": run_settings})
else:
Пример #40
0
# -----------------------------------------------------------------------------
# IMPORTS:
# -----------------------------------------------------------------------------
from invoke import Collection

# -- TASK-LIBRARY:
from . import clean
from . import docs
from . import test

# -----------------------------------------------------------------------------
# TASKS:
# -----------------------------------------------------------------------------
# None


# -----------------------------------------------------------------------------
# TASK CONFIGURATION:
# -----------------------------------------------------------------------------
namespace = Collection()
namespace.add_task(clean.clean)
namespace.add_task(clean.clean_all)
namespace.add_task(test.behave, "behave_test")
namespace.add_collection(Collection.from_module(docs))
namespace.add_collection(Collection.from_module(test))

# -- INJECT: clean configuration into this namespace
namespace.configure(clean.namespace.configuration())
namespace.configure(test.namespace.configuration())

Пример #41
0
from invoke import Collection

import tasks.dev as dev_tasks
import tasks.db as db_tasks

ns = Collection()
ns.add_collection(Collection.from_module(dev_tasks))
ns.add_collection(Collection.from_module(db_tasks))
Пример #42
0
from invoke import Collection, task
from etc.tasks import local_tasks
from etc.tasks import k8s_tasks
from etc.tasks import server_tasks
import base64

@task
def base64encode(ctx, string):
    encoded = base64.b64encode(bytes(string, "utf-8"))
    ctx.run('echo ' + encoded.decode("utf-8"))

ns = Collection()
ns.add_collection(Collection.from_module(local_tasks, name='local'))
ns.add_collection(Collection.from_module(k8s_tasks, name='k8s'))
ns.add_collection(Collection.from_module(server_tasks, name='server'))
ns.add_task(base64encode, name='base64')
Пример #43
0
from invoke import Collection
import watch

ns = Collection()
ns.add_collection(Collection.from_module(watch))
Пример #44
0
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
####################################################################################################

# http://www.pyinvoke.org

####################################################################################################

from invoke import task, Collection
# import sys

####################################################################################################

from . import clean
from . import doc
from . import release

ns = Collection()
ns.add_collection(Collection.from_module(clean))
ns.add_collection(Collection.from_module(release))
ns.add_collection(Collection.from_module(doc))
Пример #45
0
 def explicit_namespace_works_correctly(self):
     # Regression-ish test re #288
     ns = Collection.from_module(load("integration"))
     expect("print-foo", out="foo\n", program=Program(namespace=ns))
Пример #46
0
    # Copy MSVC runtime libraries into the dist folder
    redist = r'%VS100COMNTOOLS%..\..\VC\redist\x86\Microsoft.VC100.CRT'
    redist = os.path.expandvars(redist)
    libs = glob.glob(os.path.join(redist, 'msvc?100.dll'))
    if not libs:
        print("Warning: Could not copy CRT libraries. Expect deployment problems.",
              file=sys.stderr)
        return
    BUILDDIR = 'dist\\MapsEvolved-win32'
    for lib in libs:
        shutil.copy(lib, BUILDDIR)
    zipname = shutil.make_archive(BUILDDIR, 'zip', BUILDDIR)
    print("Successfully created Windows binary distribution.",
          file=sys.stderr)

@ctask
def doxygen(ctx):
    """Generate documentation for pymaplib_cpp"""
    try:
        doxygen = mev_build_utils.find_executable('doxygen')
    except ValueError:
        logger.error("Could not find doxygen executable. Is it installed?")
        sys.exit(2)
    ctx.run([doxygen, 'Doxyfile'], cwd='docs')


ns = Collection(*[obj for obj in vars().values() if isinstance(obj, Task)])
ns.add_collection(Collection.from_module(tasks_thirdparty), 'third-party')
ns.add_collection(Collection.from_module(tasks_sip), 'sip')
ns.configure({'run': { 'runner': mev_build_utils.LightInvokeRunner }})
Пример #47
0
"""Define tasks for invoke."""
from invoke import Collection
from . import build_image, digital_ocean

ns = Collection()  # pylint: disable=invalid-name
ns.add_collection(Collection.from_module(build_image))
ns.add_collection(Collection.from_module(digital_ocean, name="ocean"))
Пример #48
0
from invoke import Collection
from . import main, copy, mp3, meta


namespace = Collection.from_module(main)
for mod in (copy, mp3, meta):
    namespace.add_collection(mod)
Пример #49
0
logging.getLogger('invoke').setLevel(logging.CRITICAL)

# gets the root path for all the scripts that rely on it
HERE = os.path.abspath(
    os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
WHEELHOUSE_PATH = os.environ.get('WHEELHOUSE')

try:
    __import__('rednose')
except ImportError:
    TEST_CMD = 'nosetests'
else:
    TEST_CMD = 'nosetests --rednose'

ns = Collection()
ns.add_collection(Collection.from_module(admin_tasks), name='admin')


def task(*args, **kwargs):
    """Behaves the same way as invoke.task. Adds the task
    to the root namespace.
    """
    if len(args) == 1 and callable(args[0]):
        new_task = invoke.task(args[0])
        ns.add_task(new_task)
        return new_task

    def decorator(f):
        new_task = invoke.task(f, *args, **kwargs)
        ns.add_task(new_task)
        return new_task
Пример #50
0
from invocations import docs as _docs, packaging

from invoke import Collection


# TODO: move this & paramiko's copy of same into Alabaster?


d = 'sites'

# Usage doc/API site (published as docs.paramiko.org)
docs_path = join(d, 'docs')
docs = Collection.from_module(_docs, name='docs', config={
    'sphinx': {
        'source': docs_path,
        'target': join(docs_path, '_build')
    }
})

# Main/about/changelog site ((www.)?paramiko.org)
www_path = join(d, 'www')
www = Collection.from_module(_docs, name='www', config={
    'sphinx': {
        'source': www_path,
        'target': join(www_path, '_build')
    }
})


ns = Collection(docs=docs, www=www, release=packaging)
Пример #51
0
import shutil

from invocations import docs as _docs
from invocations.testing import test
from invocations.packaging import vendorize, release

from invoke import ctask as task, run, Collection

d = 'sites'

# Usage doc/API site (published as docs.paramiko.org)
docs_path = join(d, 'docs')
docs_build = join(docs_path, '_build')
docs = Collection.from_module(_docs,
                              name='docs',
                              config={
                                  'sphinx.source': docs_path,
                                  'sphinx.target': docs_build,
                              })

# Main/about/changelog site ((www.)?paramiko.org)
www_path = join(d, 'www')
www = Collection.from_module(_docs,
                             name='www',
                             config={
                                 'sphinx.source': www_path,
                                 'sphinx.target': join(www_path, '_build'),
                             })


@task
def vendorize_pexpect(ctx, version):
Пример #52
0
# -- TASK-LIBRARY:
from . import _tasklet_cleanup as cleanup
from . import test
from . import release

# -----------------------------------------------------------------------------
# TASKS:
# -----------------------------------------------------------------------------
# None

# -----------------------------------------------------------------------------
# TASK CONFIGURATION:
# -----------------------------------------------------------------------------
namespace = Collection()
namespace.add_collection(Collection.from_module(cleanup), name="cleanup")
namespace.add_collection(Collection.from_module(test))
namespace.add_collection(Collection.from_module(release))

cleanup.cleanup_tasks.add_task(cleanup.clean_python)

# -- INJECT: clean configuration into this namespace
namespace.configure(cleanup.namespace.configuration())
if sys.platform.startswith("win"):
    # -- OVERRIDE SETTINGS: For platform=win32, ... (Windows)
    from ._compat_shutil import which
    run_settings = dict(echo=True, pty=False, shell=which("cmd"))
    namespace.configure({"run": run_settings})
else:
    namespace.configure({"run": dict(echo=True, pty=True)})
Пример #53
0
from . import tasks
from . import context
from . import stack
from . import mustack
# structlog.processors.KeyValueRenderer

structlog.configure(
    processors=[
        structlog.processors.StackInfoRenderer(),
        structlog.dev.set_exc_info,
        structlog.processors.format_exc_info,
        # structlog.processors.TimeStamper(),
        # structlog.processors.KeyValueRenderer(),
        structlog.dev.ConsoleRenderer(),
    ],
    wrapper_class=structlog.BoundLogger,
    context_class=
    dict,  # or OrderedDict if the runtime's dict is unordered (e.g. Python <3.6)
    logger_factory=structlog.PrintLoggerFactory(),
    cache_logger_on_first_use=False)

ns = Collection()
for module in [tasks, context, stack, mustack]:
    ns.add_collection(Collection.from_module(module))

program = Program(
    version="0.1.0",
    binary_names=["sk", "sanky"],
    namespace=ns,
)
Пример #54
0

from invoke import Collection
from tasks import countries


ns = Collection()
ns.add_collection(Collection.from_module(countries))