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))
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()
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()
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))
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
def __call__(self, globals, locals): previous = locals.copy() exec_(self.code, globals, locals) return self._find_changes(previous, locals)