executables = re.findall('__([a-z + _]+)', stdout) if len(executables)>0: for executable in executables: if package_clear: io.println(io.Warn(), "some packages are running:") package_clear = False target_packages.append(package) target_executables.append(executable) io.println(io.WarnList(), executable, "in", package) if len(target_executables) == 0: string = io.println(io.Fail(), "no executable is running") io.exitSuccess() elif len(target_executables) == 1: string = io.scanln(io.Warn(), "do you want to kill it? (yes/no):") else: string = io.scanln(io.Warn(), "do you want to kill them? (yes/no):") io.newLine() if string == 'no': io.println(io.Fail(), "cancelled") io.exitFail() elif string != 'yes': io.println(io.Fail(), "invalid input, cancelled") io.exitFail() i = 0 while i < len(target_executables): if not io.runCommandMuted("screen -XS {}__{} quit".format(target_packages[i], target_executables[i])): io.println(io.Fail(), "failed to kill", target_executables[i], "in", target_packages[i])
io.printAsync(io.Empty(), "checking package..", io.Progress()) if not pkg.packageIsDir(args.package): io.println(io.Fail(), args.package, "does not exist") io.exitFail() if not pkg.packageIsGitRepository(args.package): io.println(io.Fail(), args.package, "is not a git repository") io.exitFail() repo = pkg.getPackageRepo(args.package) if not pkg.repoIsNotClean(repo): io.println(io.Success(), "done, nothing to be reset in", args.package) io.exitSuccess() string = io.scanln(io.Warn(), "are you sure you want to reset", args.package, "\b? (yes/no):") io.newLine() if string == 'no': io.println(io.Fail(), "cancelled") io.exitFail() elif string != 'yes': io.println(io.Fail(), "invalid input, cancelled") io.exitFail() io.printAsync(io.Empty(), "resetting", args.package, "\b..", io.Progress()) repo.git.reset('--hard') io.printAsync(io.Empty(), "cleaning", args.package, "\b..", io.Progress()) repo.git.clean('-xdf')
if len(commits_ahead) > 0: if package_clear: io.println(io.Warn(), package, "pull from origin remote:") package_clear = False io.println(io.WarnList(), package, "is ahead of master by", io.PluralCount('commit', len(commits_ahead))) all_clear = False continue else: io.println(io.Success(), package, "is up to date with origin") continue io.printAsync(io.Empty(), "checking dirty state..", io.Progress()) if pkg.repoIsNotClean(repo): inp = io.scanln( io.WarnList(), "found dirty state, are you sure you want to reset it? (yes/no):") io.newLine() if inp == 'yes': io.printAsync(io.EmptyList(), "resetting package..", io.Progress()) pkg.resetRepo(repo) io.println(io.SuccessList(), "done reset package") io.newLine() elif inp != 'no': io.println(io.FailList(), "invalid input, skipped") continue try: io.printAsync(io.Empty(), "merging branches..") pkg.mergeRepo(repo, "origin/{}".format(repo.active_branch))
author_name = "" author_email = "" try: author_name = os.environ['KURO_AUTHOR_NAME'] author_email = os.environ['KURO_AUTHOR_EMAIL'] if len(author_name) < 1 or len(author_email) < 1: raise KeyError except KeyError: io.println(io.Warn(), "could not load author info") while len(author_name) < 1: author_name = io.scanln(io.WarnList(), "input author name:") io.newLine() if len(author_name) < 1: io.println(io.FailList(), "author name cannot be empty") while len(author_email) < 1: author_email = io.scanln(io.WarnList(), "input author email:") io.newLine() if len(author_email) < 1: io.println(io.FailList(), "author email cannot be empty") io.printShell("export KURO_AUTHOR_NAME='{}'".format(author_name)) io.printShell("export KURO_AUTHOR_EMAIL='{}'".format(author_email))
io.println(io.Yellow("usage:"), "kuro clean [-h]") io.exitFail() directories = ['build', 'install', 'log'] directories_to_clean = [] io.printAsync(io.Empty(), "checking directories..", io.Progress()) for directory in directories: if os.path.exists(os.path.join(pkg.workspace_path, directory)): directories_to_clean.append(directory) if len(directories_to_clean) < 1: io.println(io.Success(), "already cleaned") io.exitSuccess() string = io.scanln(io.Warn(), "are you sure you want to clean the workspace? (yes/no)") io.newLine() if string == 'no': io.println(io.Fail(), "cancelled") io.exitFail() elif string != 'yes': io.println(io.Fail(), "invalid input, cancelled") io.exitFail() for directory in directories_to_clean: io.printAsync(io.Empty(), "checking", directory, "directory..", io.Progress()) path = os.path.join(pkg.workspace_path, directory) if os.path.isdir(path):