當前位置: 首頁>>代碼示例>>Python>>正文


Python invoke.Collection類代碼示例

本文整理匯總了Python中invoke.Collection的典型用法代碼示例。如果您正苦於以下問題:Python Collection類的具體用法?Python Collection怎麽用?Python Collection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Collection類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: explicit_namespace_works_correctly

 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),
     )
開發者ID:gtback,項目名稱:invoke,代碼行數:8,代碼來源:program.py

示例2: _site

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
開發者ID:pyinvoke,項目名稱:invocations,代碼行數:12,代碼來源:docs.py

示例3: setup_from_tasks

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
開發者ID:lino-framework,項目名稱:atelier,代碼行數:40,代碼來源:__init__.py

示例4: exec

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)
開發者ID:jgpacker,項目名稱:suttacentral,代碼行數:28,代碼來源:__init__.py

示例5: doctree

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)
開發者ID:alex,項目名稱:invoke,代碼行數:14,代碼來源:tasks.py

示例6: get_project_root

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))
開發者ID:nakedou,項目名稱:stock,代碼行數:18,代碼來源:tasks.py

示例7: Collection

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})
開發者ID:cucumber,項目名稱:cucumber,代碼行數:30,代碼來源:__init__.py

示例8: site

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)
開發者ID:egroeper,項目名稱:paramiko,代碼行數:23,代碼來源:tasks.py

示例9: print

    # 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 }})
開發者ID:Grk0,項目名稱:MapsEvolved,代碼行數:30,代碼來源:tasks.py

示例10: clean

@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)
開發者ID:Xion,項目名稱:gisht,代碼行數:30,代碼來源:__init__.py

示例11: main

def main():
    program = Program(namespace=Collection.from_module(sys.modules[__name__]),
                      version='0.1.0')
    program.run()
開發者ID:ashapochka,項目名稱:saapy,代碼行數:4,代碼來源:povray.py

示例12: Collection

#!/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))
開發者ID:jrnold,項目名稱:acw_battle_data,代碼行數:9,代碼來源:__init__.py

示例13: Collection

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))
開發者ID:marcus-crane,項目名稱:pkgparse,代碼行數:9,代碼來源:__init__.py

示例14: task

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
開發者ID:fabiommendes,項目名稱:python-boilerplate,代碼行數:16,代碼來源:__init__.py

示例15: in

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)
開發者ID:feihong,項目名稱:music-tool,代碼行數:7,代碼來源:__init__.py


注:本文中的invoke.Collection類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。