示例#1
0
文件: tasks.py 项目: GbalsaC/bitnamiP
def _launch_pavement(args):
    mod = types.ModuleType("pavement")
    environment.pavement = mod

    if not exists(environment.pavement_file):
        environment.pavement_file = None
        six.exec_("from paver.easy import *\n", mod.__dict__)
        _process_commands(args)
        return

    mod.__file__ = environment.pavement_file
    try:
        pf = open(environment.pavement_file)
        try:
            source = pf.read()
        finally:
            pf.close()
        exec(compile(source, environment.pavement_file, "exec"), mod.__dict__)
        auto_task = getattr(mod, "auto", None)
        auto_pending = isinstance(auto_task, Task)

        from paver.misctasks import generate_setup, minilib

        resident_tasks = {"help": help, "generate_setup": generate_setup, "minilib": minilib}
        mod.__dict__.update(resident_tasks)

        _process_commands(args, auto_pending=auto_pending)
    except PavementError:
        e = sys.exc_info()[1]
        # this is hacky, but it is needed if problem would occur within
        # argument parsing, which is actually quite common
        if getattr(environment.options, "propagate_traceback", False) or "--propagate-traceback" in args:
            raise
        print_("\n\n*** Problem with pavement:\n%s\n%s\n\n" % (abspath(environment.pavement_file), e))
示例#2
0
文件: test_tasks.py 项目: paver/paver
    def test_paver_doesnt_crash_on_task_function_with_annotations():
        local_scope = {}
        # exec()ing so that it doesn't crash when this test file is run
        # under Python 2 which doesn't support this syntax
        exec_(
            """
@tasks.task
def fun() -> None:
    pass""",
            globals(),
            local_scope,
        )
        fun = local_scope["fun"]
        environment = _set_environment(fun=fun)

        # This call would fail with:
        #     ValueError: Function has keyword-only arguments or annotations,
        #     use getfullargspec() API which can support them
        fun()
示例#3
0
    def test_paver_doesnt_crash_on_task_function_with_annotations():
        local_scope = {}
        # exec()ing so that it doesn't crash when this test file is run
        # under Python 2 which doesn't support this syntax
        exec_(
            """
@tasks.task
def fun() -> None:
    pass""",
            globals(),
            local_scope,
        )
        fun = local_scope['fun']
        environment = _set_environment(fun=fun)

        # This call would fail with:
        #     ValueError: Function has keyword-only arguments or annotations,
        #     use getfullargspec() API which can support them
        fun()
示例#4
0
文件: tasks.py 项目: nikolas/paver
def _launch_pavement(args):
    mod = types.ModuleType("pavement")
    environment.pavement = mod

    if not exists(environment.pavement_file):
        environment.pavement_file = None
        six.exec_("from paver.easy import *\n", mod.__dict__)
        _process_commands(args)
        return

    mod.__file__ = environment.pavement_file
    try:
        pf = open(environment.pavement_file)
        try:
            source = pf.read()
        finally:
            pf.close()
        exec(compile(source, environment.pavement_file, 'exec'), mod.__dict__)
        auto_task = getattr(mod, 'auto', None)
        auto_pending = isinstance(auto_task, Task)

        from paver.misctasks import generate_setup, minilib
        resident_tasks = {
            'help': help,
            'generate_setup': generate_setup,
            'minilib': minilib,
        }
        mod.__dict__.update(resident_tasks)

        _process_commands(args, auto_pending=auto_pending)
    except PavementError:
        e = sys.exc_info()[1]
        # this is hacky, but it is needed if problem would occur within
        # argument parsing, which is actually quite common
        if getattr(environment.options, "propagate_traceback", False) \
            or '--propagate-traceback' in args:
            raise
        print_("\n\n*** Problem with pavement:\n%s\n%s\n\n" %
               (abspath(environment.pavement_file), e))
示例#5
0
    setup(
        name='sett',
        version=find_version('sett/__init__.py'),
        packages=setuptools.find_packages(
            include=[
                'sett',
                'sett.*',
            ],
            exclude=[
            ]
        ),
        url='https://github.org/cecedille1/sett',
        author=u'Grégoire ROCHER',
        author_email='*****@*****.**',
        install_requires=parse_requirements('requirements.txt'),
        include_package_data=True,
    )


@task
@FileReplacer(ROOT.joinpath('requirements_minimal.txt'), ROOT.joinpath('requirements.txt'))
def make_minimal():
    call_task('sett.build.make')


try:
    with open(ROOT.joinpath('localpavement.py'), 'r') as localpavement:
        exec_(localpavement.read(), locals(), globals())
except (IOError, ImportError) as e:
    pass
示例#6
0
文件: shell.py 项目: cecedille1/Sett
 def __call__(self, globals, locals):
     previous = locals.copy()
     exec_(self.code, globals, locals)
     return self._find_changes(previous, locals)