def _do_clean (self, cao, packages) : for pn, pp in packages : with sos.changed_dir (pp) : if cao.verbose : print ("Cleaning", pn) to_clean = \ ( [".eggs", "build", "dist"] + sos.expanded_glob ("*.egg-info") ) if to_clean : TFL_STP.run_command (["rm", "-rf"] + to_clean)
def _do_clean(self, cao, packages): for pn, pp in packages: with sos.changed_dir(pp): if cao.verbose: print("Cleaning", pn) to_clean = \ ( [".eggs", "build", "dist"] + sos.expanded_glob ("*.egg-info") ) if to_clean: TFL_STP.run_command(["rm", "-rf"] + to_clean)
def _handle_tag (self, cao) : packages = self._packages (cao) new_tag = cao.Value message = " ".join (cao.argv) if packages : for pn, pp in packages : with sos.changed_dir (pp) : nt = self._do_tag (cao, new_tag, message) print ("Repository tag: %s" % (nt, )) else : nt = self._do_tag (cao, new_tag, message) print ("Repository tag: %s" % (nt, ))
def _handle_tag(self, cao): packages = self._packages(cao) new_tag = cao.Value message = " ".join(cao.argv) if packages: for pn, pp in packages: with sos.changed_dir(pp): nt = self._do_tag(cao, new_tag, message) print("Repository tag: %s" % (nt, )) else: nt = self._do_tag(cao, new_tag, message) print("Repository tag: %s" % (nt, ))
def _handle_version (self, cao) : packages = self._packages (cao) if packages : for pn, pp in packages : with sos.changed_dir (pp) : if cao.update : v = TFL_STP.update_version_py () else : v = self._git_version () or "unknown" print ("%-8s : %s" % (pn, v)) else : v = self._git_version () or "unknown" print ("Repository tag: %s" % (v, ))
def _handle_version(self, cao): packages = self._packages(cao) if packages: for pn, pp in packages: with sos.changed_dir(pp): if cao.update: v = TFL_STP.update_version_py() else: v = self._git_version() or "unknown" print("%-8s : %s" % (pn, v)) else: v = self._git_version() or "unknown" print("Repository tag: %s" % (v, ))
def run_app_tests_mod \ (path, exclude, py_executables, py_options, summary) : if exclude (path) : summary.excluded.append (path) print ("%s excluded" % (path, )) elif has_app_test (path) : try : mod = import_module (path) except Exception as exc : summary.failed += 1 summary.total += 1 summary.failures.append ((path, "Exception %s" % (exc, ))) print ("Import of %s raises exception `%r`" % (path, exc)) else : app_tests = getattr (mod, "__App_Tests__", None) if not app_tests : return with sos.changed_dir (mod.__App_Tests_Dir__) : summary.modules += 1 summary.cases += len (app_tests) for pyx in py_executables : failures = 0 pyv = py_version (pyx) for app_test in app_tests : summary.total += 1 run = app_test (pyx, py_options) et = " in %7.5fs" % (run.time) if run : tail = "" verb = "passes" else : sep = "\n " tps = [""] if run.error_diff : tps.append ("Error diff: %s" % run.error_diff) if run.output_diff : tps.append ("Output diff: %s" % run.output_diff) tail = sep.join (tps) verb = "fails " summary.failed += 1 failures += 1 print \ ( "%s [%s] %s application test%s [py %s]%s" % (app_test.name, path, verb, et, pyv, tail) , file = sys.stderr ) if failures : summary.failures.append ((path, failures))
def _do_setup (self, cao, argv, packages) : r_args = ["--repository", "testpypi"] \ if cao.test and ("register" in argv or "upload" in argv) else [] setup_cmd = [sys.executable, "setup.py"] + argv + r_args args = " ".join (argv) for pn, pp in packages : with sos.changed_dir (pp) : if cao.verbose : print ("Starting", args, "for", pn, "...") if cao.dry_run : print (" ", " ".join (setup_cmd [1:])) else : try : subprocess.call (setup_cmd) except subprocess.CalledProcessError as exc : print (exc) raise SystemExit (127) if cao.verbose : print ("... Finished", pn)
def _do_setup(self, cao, argv, packages): r_args = ["--repository", "testpypi"] \ if cao.test and ("register" in argv or "upload" in argv) else [] setup_cmd = [sys.executable, "setup.py"] + argv + r_args args = " ".join(argv) for pn, pp in packages: with sos.changed_dir(pp): if cao.verbose: print("Starting", args, "for", pn, "...") if cao.dry_run: print(" ", " ".join(setup_cmd[1:])) else: try: subprocess.call(setup_cmd) except subprocess.CalledProcessError as exc: print(exc) raise SystemExit(127) if cao.verbose: print("... Finished", pn)
def _do_twine (self, cao, cmd, args, packages) : r_args = ["--repository", "testpypi"] if cao.test else [] twc_head = ["twine", cmd] + r_args for pn, pp in packages : with sos.changed_dir (pp) : twc_tail = args if cmd == "register" : dist = sos.expanded_glob (args [-1]) twc_tail = args [:-1] + dist twc = twc_head + twc_tail if cao.verbose : print ("Starting twine upload for", pn, "...") if cao.dry_run : print (" ", " ".join (twc)) else : try : subprocess.call (twc) except subprocess.CalledProcessError as exc : print (exc) raise SystemExit (127) if cao.verbose : print ("... Finished", pn)
def _do_twine(self, cao, cmd, args, packages): r_args = ["-r", "pypitest"] if cao.test else [] twc_head = ["twine", cmd] + r_args for pn, pp in packages: with sos.changed_dir(pp): twc_tail = args if cmd == "register": dist = sos.expanded_glob(args[-1]) twc_tail = args[:-1] + dist twc = twc_head + twc_tail if cao.verbose: print("Starting twine upload for", pn, "...") if cao.dry_run: print(" ", " ".join(twc)) else: try: subprocess.call(twc) except subprocess.CalledProcessError as exc: print(exc) raise SystemExit(127) if cao.verbose: print("... Finished", pn)