def _test_sourcecode(S): opdef = S.user_op._opdef assert opdef logger = _CopyLogger() sourcecode_src = opdef.guildfile.dir sourcecode_select = op_util.sourcecode_select_for_opdef(opdef) op_util.copy_sourcecode(sourcecode_src, sourcecode_select, None, handler_cls=logger.handler_cls) cli.out("Copying from %s" % cmd_impl_support.cwd_desc(logger.root)) cli.out("Rules:") for rule in logger.select.rules: cli.out(" %s" % _format_file_select_rule(rule)) if logger.select.disabled: assert not logger.selected, logger.selected assert not logger.skipped, logger.skipped cli.out("Source code copy disabled") else: cli.out("Selected for copy:") for path in logger.selected: cli.out(cli.style(" %s" % path, fg="yellow")) cli.out("Skipped:") for path in logger.skipped: cli.out(cli.style(" %s" % path, dim=True))
def _copy_run_sourcecode(sourcecode_src, sourcecode_select, run): if os.getenv("NO_SOURCECODE") == "1": log.debug("NO_SOURCECODE=1, skipping sourcecode copy") return if not sourcecode_src: log.debug("no sourcecode source, skipping sourcecode copy") return if not sourcecode_select: log.debug("no sourcecode rules, skipping sourcecode copy") return dest = run.guild_path("sourcecode") log.debug("copying source code files for run %s from %s to %s", run.id, sourcecode_src, dest) op_util.copy_sourcecode(sourcecode_src, sourcecode_select, dest)