From 15b8a5bbdf3fb81edc6eac707bd2bd78d54394cf Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 20 Sep 2009 11:08:30 +0000 Subject: Update syntax of calls to print() for compatibility with Python 3. (2to3-3.1 -f print -nw ${FILES}) svn path=/main/trunk/; revision=14290 --- pym/_emerge/Scheduler.py | 10 +- pym/_emerge/actions.py | 295 ++++++++-------- pym/_emerge/countdown.py | 6 +- pym/_emerge/depgraph.py | 114 +++--- pym/_emerge/emergelog.py | 2 +- pym/_emerge/help.py | 724 +++++++++++++++++++------------------- pym/_emerge/main.py | 52 +-- pym/_emerge/search.py | 24 +- pym/_emerge/unmerge.py | 58 +-- pym/_emerge/userquery.py | 6 +- pym/portage/__init__.py | 36 +- pym/portage/cache/sql_template.py | 2 +- pym/portage/cache/util.py | 10 +- pym/portage/cvstree.py | 32 +- pym/portage/dbapi/bintree.py | 2 +- pym/portage/dbapi/porttree.py | 4 +- pym/portage/dbapi/vartree.py | 14 +- pym/portage/dispatch_conf.py | 22 +- pym/portage/eclass_cache.py | 4 +- pym/portage/elog/mod_echo.py | 4 +- pym/portage/localization.py | 6 +- pym/portage/mail.py | 2 +- pym/portage/sets/__init__.py | 8 +- pym/portage/sets/libs.py | 6 +- pym/portage/versions.py | 8 +- pym/portage/xpak.py | 2 +- pym/repoman/utilities.py | 2 +- 27 files changed, 727 insertions(+), 728 deletions(-) (limited to 'pym') diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index d532335e6..4655be7ff 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -904,10 +904,10 @@ class Scheduler(PollScheduler): root_msg = "" if mysettings["ROOT"] != "/": root_msg = " merged to %s" % mysettings["ROOT"] - print + print() printer.einfo("Error messages for package %s%s:" % \ (colorize("INFORM", key), root_msg)) - print + print() for phase in portage.const.EBUILD_PHASES: if phase not in logentries: continue @@ -1472,7 +1472,7 @@ class Scheduler(PollScheduler): @rtype: bool @returns: True if successful, False otherwise. """ - print colorize("GOOD", "*** Resuming merge...") + print(colorize("GOOD", "*** Resuming merge...")) if self._show_list(): if "--tree" in self.myopts: @@ -1489,7 +1489,7 @@ class Scheduler(PollScheduler): "--nodeps" not in self.myopts if show_spinner: - print "Calculating dependencies ", + print("Calculating dependencies ", end=' ') myparams = create_depgraph_params(self.myopts, None) success = False @@ -1507,7 +1507,7 @@ class Scheduler(PollScheduler): dropped_tasks = set() if show_spinner: - print "\b\b... done!" + print("\b\b... done!") if e is not None: def unsatisfied_resume_dep_msg(): diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 9de19cfbd..3255a9b9e 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -168,13 +168,13 @@ def action_build(settings, trees, mtimedb, else: action = "merged" if "--tree" in myopts and action != "fetched": # Tree doesn't work with fetching - print - print darkgreen("These are the packages that would be %s, in reverse order:") % action - print + print() + print(darkgreen("These are the packages that would be %s, in reverse order:") % action) + print() else: - print - print darkgreen("These are the packages that would be %s, in order:") % action - print + print() + print(darkgreen("These are the packages that would be %s, in order:") % action) + print() show_spinner = "--quiet" not in myopts and "--nodeps" not in myopts if not show_spinner: @@ -186,7 +186,7 @@ def action_build(settings, trees, mtimedb, favorites = [] if show_spinner: - print "Calculating dependencies ", + print("Calculating dependencies ", end=' ') myparams = create_depgraph_params(myopts, myaction) resume_data = mtimedb["resume"] @@ -208,7 +208,7 @@ def action_build(settings, trees, mtimedb, if isinstance(e, depgraph.UnsatisfiedResumeDep): mydepgraph = e.depgraph if show_spinner: - print + print() from textwrap import wrap from portage.output import EOutput out = EOutput() @@ -262,7 +262,7 @@ def action_build(settings, trees, mtimedb, out.eerror(line) else: if show_spinner: - print "\b\b... done!" + print("\b\b... done!") if success: if dropped_tasks: @@ -287,11 +287,11 @@ def action_build(settings, trees, mtimedb, return 1 else: if ("--resume" in myopts): - print darkgreen("emerge: It seems we have nothing to resume...") + print(darkgreen("emerge: It seems we have nothing to resume...")) return os.EX_OK if "--quiet" not in myopts and "--nodeps" not in myopts: - print "Calculating dependencies ", + print("Calculating dependencies ", end=' ') sys.stdout.flush() myparams = create_depgraph_params(myopts, myaction) @@ -300,13 +300,13 @@ def action_build(settings, trees, mtimedb, settings, trees, myopts, myparams, myaction, myfiles, spinner) except portage.exception.PackageSetNotFound as e: if show_spinner: - print "\b\b... done!" + print("\b\b... done!") root_config = trees[settings["ROOT"]]["root_config"] display_missing_pkg_set(root_config, e.value) return 1 if show_spinner: - print "\b\b... done!" + print("\b\b... done!") if not success: mydepgraph.display_problems() @@ -319,7 +319,7 @@ def action_build(settings, trees, mtimedb, if "--resume" in myopts: mymergelist = mydepgraph.altlist() if len(mymergelist) == 0: - print colorize("INFORM", "emerge: It seems we have nothing to resume...") + print(colorize("INFORM", "emerge: It seems we have nothing to resume...")) return os.EX_OK favorites = mtimedb["resume"]["favorites"] retval = mydepgraph.display( @@ -355,26 +355,26 @@ def action_build(settings, trees, mtimedb, not sets[x[1:]].world_candidate)] if "--noreplace" in myopts and \ not oneshot and world_candidates: - print + print() for x in world_candidates: - print " %s %s" % (good("*"), x) + print(" %s %s" % (good("*"), x)) prompt="Would you like to add these packages to your world favorites?" elif settings["AUTOCLEAN"] and "yes"==settings["AUTOCLEAN"]: prompt="Nothing to merge; would you like to auto-clean packages?" else: - print - print "Nothing to merge; quitting." - print + print() + print("Nothing to merge; quitting.") + print() return os.EX_OK elif "--fetchonly" in myopts or "--fetch-all-uri" in myopts: prompt="Would you like to fetch the source files for these packages?" else: prompt="Would you like to merge these packages?" - print + print() if "--ask" in myopts and userquery(prompt) == "No": - print - print "Quitting." - print + print() + print("Quitting.") + print() return os.EX_OK # Don't ask again (e.g. when auto-cleaning packages after merge) myopts.pop("--ask", None) @@ -383,7 +383,7 @@ def action_build(settings, trees, mtimedb, if ("--resume" in myopts): mymergelist = mydepgraph.altlist() if len(mymergelist) == 0: - print colorize("INFORM", "emerge: It seems we have nothing to resume...") + print(colorize("INFORM", "emerge: It seems we have nothing to resume...")) return os.EX_OK favorites = mtimedb["resume"]["favorites"] retval = mydepgraph.display( @@ -409,8 +409,8 @@ def action_build(settings, trees, mtimedb, graph_copy.difference_update(removed_nodes) if not graph_copy.hasallzeros(ignore_priority = \ DepPrioritySatisfiedRange.ignore_medium): - print "\n!!! --buildpkgonly requires all dependencies to be merged." - print "!!! You have to merge the dependencies before you can build this package.\n" + print("\n!!! --buildpkgonly requires all dependencies to be merged.") + print("!!! You have to merge the dependencies before you can build this package.\n") return 1 else: if "--buildpkgonly" in myopts: @@ -423,8 +423,8 @@ def action_build(settings, trees, mtimedb, graph_copy.difference_update(removed_nodes) if not graph_copy.hasallzeros(ignore_priority = \ DepPrioritySatisfiedRange.ignore_medium): - print "\n!!! --buildpkgonly requires all dependencies to be merged." - print "!!! Cannot merge requested packages. Merge deps and try again.\n" + print("\n!!! --buildpkgonly requires all dependencies to be merged.") + print("!!! Cannot merge requested packages. Merge deps and try again.\n") return 1 if ("--resume" in myopts): @@ -473,7 +473,7 @@ def action_build(settings, trees, mtimedb, def action_config(settings, trees, myopts, myfiles): if len(myfiles) != 1: - print red("!!! config can only take a single package atom at this time\n") + print(red("!!! config can only take a single package atom at this time\n")) sys.exit(1) if not is_valid_package_atom(myfiles[0]): portage.writemsg("!!! '%s' is not a valid package atom.\n" % myfiles[0], @@ -481,46 +481,46 @@ def action_config(settings, trees, myopts, myfiles): portage.writemsg("!!! Please check ebuild(5) for full details.\n") portage.writemsg("!!! (Did you specify a version but forget to prefix with '='?)\n") sys.exit(1) - print + print() try: pkgs = trees[settings["ROOT"]]["vartree"].dbapi.match(myfiles[0]) except portage.exception.AmbiguousPackageName as e: # Multiple matches thrown from cpv_expand pkgs = e.args[0] if len(pkgs) == 0: - print "No packages found.\n" + print("No packages found.\n") sys.exit(0) elif len(pkgs) > 1: if "--ask" in myopts: options = [] - print "Please select a package to configure:" + print("Please select a package to configure:") idx = 0 for pkg in pkgs: idx += 1 options.append(str(idx)) - print options[-1]+") "+pkg - print "X) Cancel" + print(options[-1]+") "+pkg) + print("X) Cancel") options.append("X") idx = userquery("Selection?", options) if idx == "X": sys.exit(0) pkg = pkgs[int(idx)-1] else: - print "The following packages available:" + print("The following packages available:") for pkg in pkgs: - print "* "+pkg - print "\nPlease use a specific atom or the --ask option." + print("* "+pkg) + print("\nPlease use a specific atom or the --ask option.") sys.exit(1) else: pkg = pkgs[0] - print + print() if "--ask" in myopts: if userquery("Ready to configure "+pkg+"?") == "No": sys.exit(0) else: - print "Configuring pkg..." - print + print("Configuring pkg...") + print() ebuildpath = trees[settings["ROOT"]]["vartree"].dbapi.findname(pkg) mysettings = portage.config(clone=settings) vardb = trees[mysettings["ROOT"]]["vartree"].dbapi @@ -532,7 +532,7 @@ def action_config(settings, trees, myopts, myfiles): if retval == os.EX_OK: portage.doebuild(ebuildpath, "clean", mysettings["ROOT"], mysettings, debug=debug, mydbapi=vardb, tree="vartree") - print + print() def action_depclean(settings, trees, ldpath_mtimes, myopts, action, myfiles, spinner): @@ -604,16 +604,16 @@ def action_depclean(settings, trees, ldpath_mtimes, if not cleanlist and "--quiet" in myopts: return - print "Packages installed: " + str(len(vardb.cpv_all())) - print "Packages in world: " + \ - str(len(root_config.sets["world"].getAtoms())) - print "Packages in system: " + \ - str(len(root_config.sets["system"].getAtoms())) - print "Required packages: "+str(req_pkg_count) + print("Packages installed: " + str(len(vardb.cpv_all()))) + print("Packages in world: " + \ + str(len(root_config.sets["world"].getAtoms()))) + print("Packages in system: " + \ + str(len(root_config.sets["system"].getAtoms()))) + print("Required packages: "+str(req_pkg_count)) if "--pretend" in myopts: - print "Number to remove: "+str(len(cleanlist)) + print("Number to remove: "+str(len(cleanlist))) else: - print "Number removed: "+str(len(cleanlist)) + print("Number removed: "+str(len(cleanlist))) def calc_depclean(settings, trees, ldpath_mtimes, myopts, action, args_set, spinner): @@ -1200,8 +1200,8 @@ def action_deselect(settings, trees, opts, atoms): break if discard_atoms: for atom in sorted(discard_atoms): - print ">>> Removing %s from \"world\" favorites file..." % \ - colorize("INFORM", str(atom)) + print(">>> Removing %s from \"world\" favorites file..." % \ + colorize("INFORM", str(atom))) if '--ask' in opts: prompt = "Would you like to remove these " + \ @@ -1214,47 +1214,47 @@ def action_deselect(settings, trees, opts, atoms): if not pretend: world_set.replace(remaining) else: - print ">>> No matching atoms found in \"world\" favorites file..." + print(">>> No matching atoms found in \"world\" favorites file...") finally: if locked: world_set.unlock() return os.EX_OK def action_info(settings, trees, myopts, myfiles): - print getportageversion(settings["PORTDIR"], settings["ROOT"], + print(getportageversion(settings["PORTDIR"], settings["ROOT"], settings.profile_path, settings["CHOST"], - trees[settings["ROOT"]]["vartree"].dbapi) + trees[settings["ROOT"]]["vartree"].dbapi)) header_width = 65 header_title = "System Settings" if myfiles: - print header_width * "=" - print header_title.rjust(int(header_width/2 + len(header_title)/2)) - print header_width * "=" - print "System uname: "+platform.platform(aliased=1) + print(header_width * "=") + print(header_title.rjust(int(header_width/2 + len(header_title)/2))) + print(header_width * "=") + print("System uname: "+platform.platform(aliased=1)) lastSync = portage.grabfile(os.path.join( settings["PORTDIR"], "metadata", "timestamp.chk")) - print "Timestamp of tree:", + print("Timestamp of tree:", end=' ') if lastSync: - print lastSync[0] + print(lastSync[0]) else: - print "Unknown" + print("Unknown") output=commands.getstatusoutput("distcc --version") if not output[0]: - print str(output[1].split("\n",1)[0]), + print(str(output[1].split("\n",1)[0]), end=' ') if "distcc" in settings.features: - print "[enabled]" + print("[enabled]") else: - print "[disabled]" + print("[disabled]") output=commands.getstatusoutput("ccache -V") if not output[0]: - print str(output[1].split("\n",1)[0]), + print(str(output[1].split("\n",1)[0]), end=' ') if "ccache" in settings.features: - print "[enabled]" + print("[enabled]") else: - print "[disabled]" + print("[disabled]") myvars = ["sys-devel/autoconf", "sys-devel/automake", "virtual/os-headers", "sys-devel/binutils", "sys-devel/libtool", "dev-lang/python"] @@ -1275,9 +1275,9 @@ def action_info(settings, trees, myopts, myfiles): pkgs.append(ver) if pkgs: pkgs = ", ".join(pkgs) - print "%-20s %s" % (x+":", pkgs) + print("%-20s %s" % (x+":", pkgs)) else: - print "%-20s %s" % (x+":", "[NOT VALID]") + print("%-20s %s" % (x+":", "[NOT VALID]")) libtool_vers = ",".join(trees["/"]["vartree"].dbapi.match("sys-devel/libtool")) @@ -1303,7 +1303,7 @@ def action_info(settings, trees, myopts, myfiles): for x in myvars: if x in settings: if x != "USE": - print '%s="%s"' % (x, settings[x]) + print('%s="%s"' % (x, settings[x])) else: use = set(settings["USE"].split()) for varname in use_expand: @@ -1313,23 +1313,23 @@ def action_info(settings, trees, myopts, myfiles): use.remove(f) use = list(use) use.sort() - print 'USE="%s"' % " ".join(use), + print('USE="%s"' % " ".join(use), end=' ') for varname in use_expand: myval = settings.get(varname) if myval: - print '%s="%s"' % (varname, myval), - print + print('%s="%s"' % (varname, myval), end=' ') + print() else: unset_vars.append(x) if unset_vars: - print "Unset: "+", ".join(unset_vars) - print + print("Unset: "+", ".join(unset_vars)) + print() if "--debug" in myopts: for x in dir(portage): module = getattr(portage, x) if "cvs_id_string" in dir(module): - print "%s: %s" % (str(x), str(module.cvs_id_string)) + print("%s: %s" % (str(x), str(module.cvs_id_string))) # See if we can find any packages installed matching the strings # passed on the command line @@ -1352,9 +1352,9 @@ def action_info(settings, trees, myopts, myfiles): # Loop through each package # Only print settings if they differ from global settings header_title = "Package Settings" - print header_width * "=" - print header_title.rjust(int(header_width/2 + len(header_title)/2)) - print header_width * "=" + print(header_width * "=") + print(header_title.rjust(int(header_width/2 + len(header_title)/2))) + print(header_width * "=") from portage.output import EOutput out = EOutput() for cpv in mypkgs: @@ -1365,8 +1365,8 @@ def action_info(settings, trees, myopts, myfiles): (metadata.get(x, '') for x in Package.metadata_keys)), root_config=root_config, type_name='installed') - print "\n%s was built with the following:" % \ - colorize("INFORM", str(pkg.cpv)) + print("\n%s was built with the following:" % \ + colorize("INFORM", str(pkg.cpv))) pkgsettings.setcpv(pkg) forced_flags = set(chain(pkgsettings.useforce, @@ -1416,19 +1416,19 @@ def action_info(settings, trees, myopts, myfiles): flags.sort(key=UseFlagDisplay.sort_combined) else: flags.sort(key=UseFlagDisplay.sort_separated) - print '%s="%s"' % (varname, ' '.join(str(f) for f in flags)), - print + print('%s="%s"' % (varname, ' '.join(str(f) for f in flags)), end=' ') + print() for myvar in mydesiredvars: if metadata[myvar].split() != settings.get(myvar, '').split(): - print "%s=\"%s\"" % (myvar, metadata[myvar]) - print + print("%s=\"%s\"" % (myvar, metadata[myvar])) + print() if metadata['DEFINED_PHASES']: if 'info' not in metadata['DEFINED_PHASES'].split(): continue - print ">>> Attempting to run pkg_info() for '%s'" % pkg.cpv + print(">>> Attempting to run pkg_info() for '%s'" % pkg.cpv) ebuildpath = vardb.findname(pkg.cpv) if not ebuildpath or not os.path.exists(ebuildpath): out.ewarn("No ebuild found for '%s'" % pkg.cpv) @@ -1447,10 +1447,9 @@ def action_metadata(settings, portdb, myopts, porttrees=None): if cachedir in ["/", "/bin", "/dev", "/etc", "/home", "/lib", "/opt", "/proc", "/root", "/sbin", "/sys", "/tmp", "/usr", "/var"]: - print >> sys.stderr, "!!! PORTAGE_DEPCACHEDIR IS SET TO A PRIMARY " + \ - "ROOT DIRECTORY ON YOUR SYSTEM." - print >> sys.stderr, \ - "!!! This is ALMOST CERTAINLY NOT what you want: '%s'" % cachedir + print("!!! PORTAGE_DEPCACHEDIR IS SET TO A PRIMARY " + \ + "ROOT DIRECTORY ON YOUR SYSTEM.", file=sys.stderr) + print("!!! This is ALMOST CERTAINLY NOT what you want: '%s'" % cachedir, file=sys.stderr) sys.exit(73) if not os.path.exists(cachedir): os.makedirs(cachedir) @@ -1660,7 +1659,7 @@ def action_metadata(settings, portdb, myopts, porttrees=None): if not quiet: # make sure the final progress is displayed progressHandler.display() - print + print() signal.signal(signal.SIGWINCH, signal.SIG_DFL) sys.stdout.flush() @@ -1687,7 +1686,7 @@ def action_regen(settings, portdb, max_jobs, max_load): def action_search(root_config, myopts, myfiles, spinner): if not myfiles: - print "emerge: no search terms provided." + print("emerge: no search terms provided.") else: searchinstance = search(root_config, spinner, "--searchdesc" in myopts, @@ -1697,7 +1696,7 @@ def action_search(root_config, myopts, myfiles, spinner): try: searchinstance.execute(mysearch) except re.error as comment: - print "\n!!! Regular expression error in \"%s\": %s" % ( mysearch, comment ) + print("\n!!! Regular expression error in \"%s\": %s" % ( mysearch, comment )) sys.exit(1) searchinstance.output() @@ -1717,7 +1716,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): except OSError: st = None if st is None: - print ">>>",myportdir,"not found, creating it." + print(">>>",myportdir,"not found, creating it.") os.makedirs(myportdir,0755) st = os.stat(myportdir) @@ -1756,7 +1755,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): dosyncuri = syncuri updatecache_flg = False if myaction == "metadata": - print "skipping sync" + print("skipping sync") updatecache_flg = True elif ".git" in vcs_dirs: # Update existing git repository, and ignore the syncuri. We are @@ -1793,8 +1792,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): (myportdir, vcs_dir), level=logging.ERROR, noiselevel=-1) return 1 if not os.path.exists("/usr/bin/rsync"): - print "!!! /usr/bin/rsync does not exist, so rsync support is disabled." - print "!!! Type \"emerge net-misc/rsync\" to enable rsync support." + print("!!! /usr/bin/rsync does not exist, so rsync support is disabled.") + print("!!! Type \"emerge net-misc/rsync\" to enable rsync support.") sys.exit(1) mytimeout=180 @@ -1931,7 +1930,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): except SystemExit as e: raise # Needed else can't exit except Exception as e: - print "Notice:",str(e) + print("Notice:",str(e)) dosyncuri=syncuri if ips: @@ -1942,32 +1941,32 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): except SystemExit as e: raise # Needed else can't exit except Exception as e: - print "Notice:",str(e) + print("Notice:",str(e)) dosyncuri=syncuri if (retries==0): if "--ask" in myopts: if userquery("Do you want to sync your Portage tree with the mirror at\n" + blue(dosyncuri) + bold("?"))=="No": - print - print "Quitting." - print + print() + print("Quitting.") + print() sys.exit(0) emergelog(xterm_titles, ">>> Starting rsync with " + dosyncuri) if "--quiet" not in myopts: - print ">>> Starting rsync with "+dosyncuri+"..." + print(">>> Starting rsync with "+dosyncuri+"...") else: emergelog(xterm_titles, ">>> Starting retry %d of %d with %s" % \ (retries,maxretries,dosyncuri)) - print "\n\n>>> Starting retry %d of %d with %s" % (retries,maxretries,dosyncuri) + print("\n\n>>> Starting retry %d of %d with %s" % (retries,maxretries,dosyncuri)) if mytimestamp != 0 and "--quiet" not in myopts: - print ">>> Checking server timestamp ..." + print(">>> Checking server timestamp ...") rsynccommand = ["/usr/bin/rsync"] + rsync_opts + extra_rsync_opts if "--debug" in myopts: - print rsynccommand + print(rsynccommand) exitcode = os.EX_OK servertimestamp = 0 @@ -2010,7 +2009,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): pass except portage.exception.PortageException as e: # timed out - print e + print(e) del e if mypids and os.waitpid(mypids[0], os.WNOHANG) == (0,0): os.kill(mypids[0], signal.SIGTERM) @@ -2036,25 +2035,25 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): if (servertimestamp != 0) and (servertimestamp == mytimestamp): emergelog(xterm_titles, ">>> Cancelling sync -- Already current.") - print - print ">>>" - print ">>> Timestamps on the server and in the local repository are the same." - print ">>> Cancelling all further sync action. You are already up to date." - print ">>>" - print ">>> In order to force sync, remove '%s'." % servertimestampfile - print ">>>" - print + print() + print(">>>") + print(">>> Timestamps on the server and in the local repository are the same.") + print(">>> Cancelling all further sync action. You are already up to date.") + print(">>>") + print(">>> In order to force sync, remove '%s'." % servertimestampfile) + print(">>>") + print() sys.exit(0) elif (servertimestamp != 0) and (servertimestamp < mytimestamp): emergelog(xterm_titles, ">>> Server out of date: %s" % dosyncuri) - print - print ">>>" - print ">>> SERVER OUT OF DATE: %s" % dosyncuri - print ">>>" - print ">>> In order to force sync, remove '%s'." % servertimestampfile - print ">>>" - print + print() + print(">>>") + print(">>> SERVER OUT OF DATE: %s" % dosyncuri) + print(">>>") + print(">>> In order to force sync, remove '%s'." % servertimestampfile) + print(">>>") + print() exitcode = SERVER_OUT_OF_DATE elif (servertimestamp == 0) or (servertimestamp > mytimestamp): # actual sync @@ -2074,7 +2073,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): retries=retries+1 if retries<=maxretries: - print ">>> Retrying..." + print(">>> Retrying...") time.sleep(11) else: # over retries @@ -2116,16 +2115,16 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): sys.exit(exitcode) elif syncuri[:6]=="cvs://": if not os.path.exists("/usr/bin/cvs"): - print "!!! /usr/bin/cvs does not exist, so CVS support is disabled." - print "!!! Type \"emerge dev-util/cvs\" to enable CVS support." + print("!!! /usr/bin/cvs does not exist, so CVS support is disabled.") + print("!!! Type \"emerge dev-util/cvs\" to enable CVS support.") sys.exit(1) cvsroot=syncuri[6:] cvsdir=os.path.dirname(myportdir) if not os.path.exists(myportdir+"/CVS"): #initial checkout - print ">>> Starting initial cvs checkout with "+syncuri+"..." + print(">>> Starting initial cvs checkout with "+syncuri+"...") if os.path.exists(cvsdir+"/gentoo-x86"): - print "!!! existing",cvsdir+"/gentoo-x86 directory; exiting." + print("!!! existing",cvsdir+"/gentoo-x86 directory; exiting.") sys.exit(1) try: os.rmdir(myportdir) @@ -2136,12 +2135,12 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): sys.exit(1) del e if portage.spawn("cd "+cvsdir+"; cvs -z0 -d "+cvsroot+" co -P gentoo-x86",settings,free=1): - print "!!! cvs checkout error; exiting." + print("!!! cvs checkout error; exiting.") sys.exit(1) os.rename(os.path.join(cvsdir, "gentoo-x86"), myportdir) else: #cvs update - print ">>> Starting cvs update with "+syncuri+"..." + print(">>> Starting cvs update with "+syncuri+"...") retval = portage.process.spawn_bash( "cd %s; cvs -z0 -q update -dP" % \ (portage._shell_quote(myportdir),), **spawn_kwargs) @@ -2192,15 +2191,15 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): retval = portage.process.spawn( [postsync, dosyncuri], env=settings.environ()) if retval != os.EX_OK: - print red(" * ") + bold("spawn failed of " + postsync) + print(red(" * ") + bold("spawn failed of " + postsync)) if(mybestpv != mypvs) and not "--quiet" in myopts: - print - print red(" * ")+bold("An update to portage is available.")+" It is _highly_ recommended" - print red(" * ")+"that you update portage now, before any other packages are updated." - print - print red(" * ")+"To update portage, run 'emerge portage' now." - print + print() + print(red(" * ")+bold("An update to portage is available.")+" It is _highly_ recommended") + print(red(" * ")+"that you update portage now, before any other packages are updated.") + print() + print(red(" * ")+"To update portage, run 'emerge portage' now.") + print() display_news_notification(root_config, myopts) return os.EX_OK @@ -2604,16 +2603,16 @@ def chk_updated_cfg_files(target_root, config_protect): portage.util.find_updated_config_files(target_root, config_protect)) for x in result: - print "\n"+colorize("WARN", " * IMPORTANT:"), + print("\n"+colorize("WARN", " * IMPORTANT:"), end=' ') if not x[1]: # it's a protected file - print "config file '%s' needs updating." % x[0] + print("config file '%s' needs updating." % x[0]) else: # it's a protected dir - print "%d config files in '%s' need updating." % (len(x[1]), x[0]) + print("%d config files in '%s' need updating." % (len(x[1]), x[0])) if result: - print " "+yellow("*")+" See the "+colorize("INFORM","CONFIGURATION FILES")\ - + " section of the " + bold("emerge") - print " "+yellow("*")+" man page to learn how to update config files." + print(" "+yellow("*")+" See the "+colorize("INFORM","CONFIGURATION FILES")\ + + " section of the " + bold("emerge")) + print(" "+yellow("*")+" man page to learn how to update config files.") def display_news_notification(root_config, myopts): target_root = root_config.root @@ -2637,15 +2636,15 @@ def display_news_notification(root_config, myopts): if unreadItems: if not newsReaderDisplay: newsReaderDisplay = True - print - print colorize("WARN", " * IMPORTANT:"), - print "%s news items need reading for repository '%s'." % (unreadItems, repo) + print() + print(colorize("WARN", " * IMPORTANT:"), end=' ') + print("%s news items need reading for repository '%s'." % (unreadItems, repo)) if newsReaderDisplay: - print colorize("WARN", " *"), - print "Use " + colorize("GOOD", "eselect news") + " to read news items." - print + print(colorize("WARN", " *"), end=' ') + print("Use " + colorize("GOOD", "eselect news") + " to read news items.") + print() def getgccversion(chost): """ diff --git a/pym/_emerge/countdown.py b/pym/_emerge/countdown.py index 6c97699a3..28352ff43 100644 --- a/pym/_emerge/countdown.py +++ b/pym/_emerge/countdown.py @@ -9,13 +9,13 @@ from portage.output import colorize def countdown(secs=5, doing="Starting"): if secs: - print ">>> Waiting",secs,"seconds before starting..." - print ">>> (Control-C to abort)...\n"+doing+" in: ", + print(">>> Waiting",secs,"seconds before starting...") + print(">>> (Control-C to abort)...\n"+doing+" in: ", end=' ') ticks=range(secs) ticks.reverse() for sec in ticks: sys.stdout.write(colorize("UNMERGE_WARN", str(sec+1)+" ")) sys.stdout.flush() time.sleep(1) - print + print() diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index ea7d1b305..5d90ff0fb 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1064,10 +1064,10 @@ class depgraph(object): if not dep_string: continue if debug: - print - print "Parent: ", jbigkey - print "Depstring:", dep_string - print "Priority:", dep_priority + print() + print("Parent: ", jbigkey) + print("Depstring:", dep_string) + print("Priority:", dep_priority) try: @@ -1126,10 +1126,10 @@ class depgraph(object): strict = pkg.type_name != "installed" if debug: - print - print "Parent: ", pkg - print "Depstring:", dep_string - print "Priority:", dep_priority + print() + print("Parent: ", pkg) + print("Depstring:", dep_string) + print("Priority:", dep_priority) try: selected_atoms = self._select_atoms(dep_root, @@ -1143,7 +1143,7 @@ class depgraph(object): return 0 if debug: - print "Candidates:", selected_atoms + print("Candidates:", selected_atoms) vardb = self._frozen_config.roots[dep_root].trees["vartree"].dbapi @@ -1191,7 +1191,7 @@ class depgraph(object): return 0 if debug: - print "Exiting...", pkg + print("Exiting...", pkg) return 1 @@ -1351,14 +1351,14 @@ class depgraph(object): os.path.join(pkgsettings["PKGDIR"], x)): x = os.path.join(pkgsettings["PKGDIR"], x) else: - print "\n\n!!! Binary package '"+str(x)+"' does not exist." - print "!!! Please ensure the tbz2 exists as specified.\n" + print("\n\n!!! Binary package '"+str(x)+"' does not exist.") + print("!!! Please ensure the tbz2 exists as specified.\n") return 0, myfavorites mytbz2=portage.xpak.tbz2(x) mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0] if os.path.realpath(x) != \ os.path.realpath(self._frozen_config.trees[myroot]["bintree"].getname(mykey)): - print colorize("BAD", "\n*** You need to adjust PKGDIR to emerge this package.\n") + print(colorize("BAD", "\n*** You need to adjust PKGDIR to emerge this package.\n")) return 0, myfavorites pkg = self._pkg(mykey, "binary", root_config, @@ -1383,13 +1383,13 @@ class depgraph(object): if ebuild_path: if ebuild_path != os.path.join(os.path.realpath(tree_root), cp, os.path.basename(ebuild_path)): - print colorize("BAD", "\n*** You need to adjust PORTDIR or PORTDIR_OVERLAY to emerge this package.\n") + print(colorize("BAD", "\n*** You need to adjust PORTDIR or PORTDIR_OVERLAY to emerge this package.\n")) return 0, myfavorites if mykey not in portdb.xmatch( "match-visible", portage.dep_getkey(mykey)): - print colorize("BAD", "\n*** You are emerging a masked package. It is MUCH better to use") - print colorize("BAD", "*** /etc/portage/package.* to accomplish this. See portage(5) man") - print colorize("BAD", "*** page for details.") + print(colorize("BAD", "\n*** You are emerging a masked package. It is MUCH better to use")) + print(colorize("BAD", "*** /etc/portage/package.* to accomplish this. See portage(5) man")) + print(colorize("BAD", "*** page for details.")) countdown(int(self._frozen_config.settings["EMERGE_WARNING_DELAY"]), "Continuing...") else: @@ -1463,8 +1463,8 @@ class depgraph(object): if portage.dep_getkey(atom) == installed_cp] if len(expanded_atoms) > 1: - print - print + print() + print() ambiguous_package_name(x, expanded_atoms, root_config, self._frozen_config.spinner, self._frozen_config.myopts) return False, myfavorites @@ -1695,8 +1695,8 @@ class depgraph(object): except SystemExit as e: raise # Needed else can't exit except Exception as e: - print >> sys.stderr, "\n\n!!! Problem in '%s' dependencies." % atom - print >> sys.stderr, "!!!", str(e), getattr(e, "__module__", None) + print("\n\n!!! Problem in '%s' dependencies." % atom, file=sys.stderr) + print("!!!", str(e), getattr(e, "__module__", None), file=sys.stderr) raise # Now that the root packages have been added to the graph, @@ -1711,9 +1711,9 @@ class depgraph(object): continue if len(xs) >= 4 and xs[0] != "binary" and xs[3] == "merge": if missing == 0: - print + print() missing += 1 - print "Missing binary for:",xs[2] + print("Missing binary for:",xs[2]) try: self.altlist() @@ -2008,31 +2008,31 @@ class depgraph(object): show_missing_use = unmasked_iuse_reasons if show_missing_use: - print "\nemerge: there are no ebuilds built with USE flags to satisfy "+green(xinfo)+"." - print "!!! One of the following packages is required to complete your request:" + print("\nemerge: there are no ebuilds built with USE flags to satisfy "+green(xinfo)+".") + print("!!! One of the following packages is required to complete your request:") for pkg, mreasons in show_missing_use: - print "- "+pkg.cpv+" ("+", ".join(mreasons)+")" + print("- "+pkg.cpv+" ("+", ".join(mreasons)+")") elif masked_packages: - print "\n!!! " + \ + print("\n!!! " + \ colorize("BAD", "All ebuilds that could satisfy ") + \ colorize("INFORM", xinfo) + \ - colorize("BAD", " have been masked.") - print "!!! One of the following masked packages is required to complete your request:" + colorize("BAD", " have been masked.")) + print("!!! One of the following masked packages is required to complete your request:") have_eapi_mask = show_masked_packages(masked_packages) if have_eapi_mask: - print + print() msg = ("The current version of portage supports " + \ "EAPI '%s'. You must upgrade to a newer version" + \ " of portage before EAPI masked packages can" + \ " be installed.") % portage.const.EAPI from textwrap import wrap for line in wrap(msg, 75): - print line - print + print(line) + print() show_mask_docs() else: - print "\nemerge: there are no ebuilds to satisfy "+green(xinfo)+"." + print("\nemerge: there are no ebuilds to satisfy "+green(xinfo)+".") # Show parent nodes and the argument that pulled them in. traversed_nodes = set() @@ -2061,9 +2061,9 @@ class depgraph(object): selected_parent = parent node = selected_parent for line in msg: - print line + print(line) - print + print() def _iter_match_pkgs(self, root_config, pkg_type, atom, onlydeps=False): """ @@ -4418,11 +4418,11 @@ class depgraph(object): out.write("%s\n" % (myprint,)) for x in blockers: - print x + print(x) if verbosity == 3: - print - print counters + print() + print(counters) if show_repos: # In python-2.x, str() can trigger a UnicodeEncodeError here, # so call __str__() directly. @@ -4567,7 +4567,7 @@ class depgraph(object): " The following installed packages are masked:\n") show_masked_packages(masked_packages) show_mask_docs() - print + print() def saveNomergeFavorites(self): """Find atoms in favorites that are not in the mergelist and add them @@ -4618,8 +4618,8 @@ class depgraph(object): all_added.extend(added_favorites) all_added.sort() for a in all_added: - print ">>> Recording %s in \"world\" favorites file..." % \ - colorize("INFORM", str(a)) + print(">>> Recording %s in \"world\" favorites file..." % \ + colorize("INFORM", str(a))) if all_added: world_set.update(all_added) @@ -4997,10 +4997,10 @@ class _dep_check_composite_db(portage.dbapi): def ambiguous_package_name(arg, atoms, root_config, spinner, myopts): if "--quiet" in myopts: - print "!!! The short ebuild name \"%s\" is ambiguous. Please specify" % arg - print "!!! one of the following fully-qualified ebuild names instead:\n" + print("!!! The short ebuild name \"%s\" is ambiguous. Please specify" % arg) + print("!!! one of the following fully-qualified ebuild names instead:\n") for cp in sorted(set(portage.dep_getkey(atom) for atom in atoms)): - print " " + colorize("INFORM", cp) + print(" " + colorize("INFORM", cp)) return s = search(root_config, spinner, "--searchdesc" in myopts, @@ -5013,8 +5013,8 @@ def ambiguous_package_name(arg, atoms, root_config, spinner, myopts): for cp in sorted(set(portage.dep_getkey(atom) for atom in atoms)): s.addCP(cp) s.output() - print "!!! The short ebuild name \"%s\" is ambiguous. Please specify" % arg - print "!!! one of the above fully-qualified ebuild names instead.\n" + print("!!! The short ebuild name \"%s\" is ambiguous. Please specify" % arg) + print("!!! one of the above fully-qualified ebuild names instead.\n") def insert_category_into_atom(atom, category): alphanum = re.search(r'\w', atom) @@ -5193,7 +5193,7 @@ def show_masked_packages(masked_packages): # above via mreasons. pass - print "- "+cpv+" (masked by: "+", ".join(mreasons)+")" + print("- "+cpv+" (masked by: "+", ".join(mreasons)+")") if comment and comment not in shown_comments: writemsg_stdout(filename + ":\n" + comment + "\n", @@ -5206,14 +5206,14 @@ def show_masked_packages(masked_packages): continue msg = ("A copy of the '%s' license" + \ " is located at '%s'.") % (l, l_path) - print msg - print + print(msg) + print() shown_licenses.add(l) return have_eapi_mask def show_mask_docs(): - print "For more information, see the MASKED PACKAGES section in the emerge" - print "man page or refer to the Gentoo Handbook." + print("For more information, see the MASKED PACKAGES section in the emerge") + print("man page or refer to the Gentoo Handbook.") def filter_iuse_defaults(iuse): for flag in iuse: @@ -5223,12 +5223,12 @@ def filter_iuse_defaults(iuse): yield flag def show_blocker_docs_link(): - print - print "For more information about " + bad("Blocked Packages") + ", please refer to the following" - print "section of the Gentoo Linux x86 Handbook (architecture is irrelevant):" - print - print "http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#blocked" - print + print() + print("For more information about " + bad("Blocked Packages") + ", please refer to the following") + print("section of the Gentoo Linux x86 Handbook (architecture is irrelevant):") + print() + print("http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#blocked") + print() def get_masking_status(pkg, pkgsettings, root_config): diff --git a/pym/_emerge/emergelog.py b/pym/_emerge/emergelog.py index 4e9a2e93e..bfe6fb441 100644 --- a/pym/_emerge/emergelog.py +++ b/pym/_emerge/emergelog.py @@ -48,4 +48,4 @@ def emergelog(xterm_titles, mystr, short_msg=None): mylogfile.close() except (IOError,OSError,portage.exception.PortageException) as e: if secpass >= 1: - print >> sys.stderr, "emergelog():",e + print("emergelog():",e, file=sys.stderr) diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 18e4369b6..6e634f0cd 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -5,21 +5,21 @@ from portage.output import bold, turquoise, green def shorthelp(): - print bold("emerge:")+" the other white meat (command-line interface to the Portage system)" - print bold("Usage:") - print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuild")+" | "+turquoise("tbz2")+" | "+turquoise("file")+" | "+turquoise("@set")+" | "+turquoise("atom")+" ] [ ... ]" - print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >" - print " "+turquoise("emerge")+" < "+turquoise("--sync")+" | "+turquoise("--metadata")+" | "+turquoise("--info")+" >" - print " "+turquoise("emerge")+" "+turquoise("--resume")+" [ "+green("--pretend")+" | "+green("--ask")+" | "+green("--skipfirst")+" ]" - print " "+turquoise("emerge")+" "+turquoise("--help")+" [ "+green("--verbose")+" ] " - print bold("Options:")+" "+green("-")+"["+green("abBcCdDefgGhjkKlnNoOpqPsStuvV")+"]" - print " [ " + green("--color")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ] [ "+green("--columns")+" ]" - print " [ "+green("--complete-graph")+" ] [ "+green("--deep")+" ]" - print " [ "+green("--jobs") + " " + turquoise("JOBS")+" ] [ "+green("--keep-going")+" ] [ " + green("--load-average")+" " + turquoise("LOAD") + " ]" - print " [ "+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [ "+green("--nospinner")+" ]" - print " [ "+green("--oneshot")+" ] [ "+green("--onlydeps")+" ]" - print " [ "+green("--reinstall ")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]" - print bold("Actions:")+" [ "+green("--depclean")+" | "+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]" + print(bold("emerge:")+" the other white meat (command-line interface to the Portage system)") + print(bold("Usage:")) + print(" "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuild")+" | "+turquoise("tbz2")+" | "+turquoise("file")+" | "+turquoise("@set")+" | "+turquoise("atom")+" ] [ ... ]") + print(" "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >") + print(" "+turquoise("emerge")+" < "+turquoise("--sync")+" | "+turquoise("--metadata")+" | "+turquoise("--info")+" >") + print(" "+turquoise("emerge")+" "+turquoise("--resume")+" [ "+green("--pretend")+" | "+green("--ask")+" | "+green("--skipfirst")+" ]") + print(" "+turquoise("emerge")+" "+turquoise("--help")+" [ "+green("--verbose")+" ] ") + print(bold("Options:")+" "+green("-")+"["+green("abBcCdDefgGhjkKlnNoOpqPsStuvV")+"]") + print(" [ " + green("--color")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ] [ "+green("--columns")+" ]") + print(" [ "+green("--complete-graph")+" ] [ "+green("--deep")+" ]") + print(" [ "+green("--jobs") + " " + turquoise("JOBS")+" ] [ "+green("--keep-going")+" ] [ " + green("--load-average")+" " + turquoise("LOAD") + " ]") + print(" [ "+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [ "+green("--nospinner")+" ]") + print(" [ "+green("--oneshot")+" ] [ "+green("--onlydeps")+" ]") + print(" [ "+green("--reinstall ")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]") + print(bold("Actions:")+" [ "+green("--depclean")+" | "+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]") def help(myopts, havecolor=1): # TODO: Implement a wrap() that accounts for console color escape codes. @@ -29,42 +29,42 @@ def help(myopts, havecolor=1): desc_width = 80 - desc_left_margin - 5 if "--verbose" not in myopts: shorthelp() - print - print " For more help try 'emerge --help --verbose' or consult the man page." + print() + print(" For more help try 'emerge --help --verbose' or consult the man page.") else: shorthelp() - print - print turquoise("Help (this screen):") - print " "+green("--help")+" ("+green("-h")+" short option)" - print " Displays this help; an additional argument (see above) will tell" - print " emerge to display detailed help." - print - print turquoise("Actions:") - print " "+green("--clean")+" ("+green("-c")+" short option)" - print " Cleans the system by removing outdated packages which will not" - print " remove functionalities or prevent your system from working." - print " The arguments can be in several different formats :" - print " * world " - print " * system or" - print " * 'dependency specification' (in single quotes is best.)" - print " Here are a few examples of the dependency specification format:" - print " "+bold("binutils")+" matches" - print " binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1" - print " "+bold("sys-devel/binutils")+" matches" - print " binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1" - print " "+bold(">sys-devel/binutils-2.11.90.0.7")+" matches" - print " binutils-2.11.92.0.12.3-r1" - print " "+bold(">=sys-devel/binutils-2.11.90.0.7")+" matches" - print " binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1" - print " "+bold("<=sys-devel/binutils-2.11.92.0.12.3-r1")+" matches" - print " binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1" - print - print " "+green("--config") - print " Runs package-specific operations that must be executed after an" - print " emerge process has completed. This usually entails configuration" - print " file setup or other similar setups that the user may wish to run." - print - print " "+green("--depclean") + print() + print(turquoise("Help (this screen):")) + print(" "+green("--help")+" ("+green("-h")+" short option)") + print(" Displays this help; an additional argument (see above) will tell") + print(" emerge to display detailed help.") + print() + print(turquoise("Actions:")) + print(" "+green("--clean")+" ("+green("-c")+" short option)") + print(" Cleans the system by removing outdated packages which will not") + print(" remove functionalities or prevent your system from working.") + print(" The arguments can be in several different formats :") + print(" * world ") + print(" * system or") + print(" * 'dependency specification' (in single quotes is best.)") + print(" Here are a few examples of the dependency specification format:") + print(" "+bold("binutils")+" matches") + print(" binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1") + print(" "+bold("sys-devel/binutils")+" matches") + print(" binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1") + print(" "+bold(">sys-devel/binutils-2.11.90.0.7")+" matches") + print(" binutils-2.11.92.0.12.3-r1") + print(" "+bold(">=sys-devel/binutils-2.11.90.0.7")+" matches") + print(" binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1") + print(" "+bold("<=sys-devel/binutils-2.11.92.0.12.3-r1")+" matches") + print(" binutils-2.11.90.0.7 and binutils-2.11.92.0.12.3-r1") + print() + print(" "+green("--config")) + print(" Runs package-specific operations that must be executed after an") + print(" emerge process has completed. This usually entails configuration") + print(" file setup or other similar setups that the user may wish to run.") + print() + print(" "+green("--depclean")) paragraph = "Cleans the system by removing packages that are " + \ "not associated with explicitly merged packages. Depclean works " + \ @@ -82,8 +82,8 @@ def help(myopts, havecolor=1): "prior to depclean." for line in wrap(paragraph, desc_width): - print desc_indent + line - print + print(desc_indent + line) + print() paragraph = "WARNING: Inexperienced users are advised to use " + \ "--pretend with this option in order to see a preview of which " + \ @@ -93,8 +93,8 @@ def help(myopts, havecolor=1): "depclean, even if they are part of the world set." for line in wrap(paragraph, desc_width): - print desc_indent + line - print + print(desc_indent + line) + print() paragraph = "Depclean serves as a dependency aware version of " + \ "--unmerge. When given one or more atoms, it will unmerge " + \ @@ -102,9 +102,9 @@ def help(myopts, havecolor=1): "--depclean together with --verbose to show reverse dependencies." for line in wrap(paragraph, desc_width): - print desc_indent + line - print - print " " + green("--deselect") + "[=%s]" % turquoise("n") + print(desc_indent + line) + print() + print(" " + green("--deselect") + "[=%s]" % turquoise("n")) paragraph = \ "Remove atoms from the world file. This action is implied " + \ @@ -114,148 +114,148 @@ def help(myopts, havecolor=1): "atoms from the world file." for line in wrap(paragraph, desc_width): - print desc_indent + line - print - print " "+green("--info") - print " Displays important portage variables that will be exported to" - print " ebuild.sh when performing merges. This information is useful" - print " for bug reports and verification of settings. All settings in" - print " make.{conf,globals,defaults} and the environment show up if" - print " run with the '--verbose' flag." - print - print " " + green("--list-sets") + print(desc_indent + line) + print() + print(" "+green("--info")) + print(" Displays important portage variables that will be exported to") + print(" ebuild.sh when performing merges. This information is useful") + print(" for bug reports and verification of settings. All settings in") + print(" make.{conf,globals,defaults} and the environment show up if") + print(" run with the '--verbose' flag.") + print() + print(" " + green("--list-sets")) paragraph = "Displays a list of available package sets." for line in wrap(paragraph, desc_width): - print desc_indent + line - print - print " "+green("--metadata") - print " Transfers metadata cache from ${PORTDIR}/metadata/cache/ to" - print " /var/cache/edb/dep/ as is normally done on the tail end of an" - print " rsync update using " + bold("emerge --sync") + ". This process populates the" - print " cache database that portage uses for pre-parsed lookups of" - print " package data. It does not populate cache for the overlays" - print " listed in PORTDIR_OVERLAY. In order to generate cache for" - print " overlays, use " + bold("--regen") + "." - print - print " "+green("--prune")+" ("+green("-P")+" short option)" - print " "+turquoise("WARNING: This action can remove important packages!") + print(desc_indent + line) + print() + print(" "+green("--metadata")) + print(" Transfers metadata cache from ${PORTDIR}/metadata/cache/ to") + print(" /var/cache/edb/dep/ as is normally done on the tail end of an") + print(" rsync update using " + bold("emerge --sync") + ". This process populates the") + print(" cache database that portage uses for pre-parsed lookups of") + print(" package data. It does not populate cache for the overlays") + print(" listed in PORTDIR_OVERLAY. In order to generate cache for") + print(" overlays, use " + bold("--regen") + ".") + print() + print(" "+green("--prune")+" ("+green("-P")+" short option)") + print(" "+turquoise("WARNING: This action can remove important packages!")) paragraph = "Removes all but the highest installed version of a " + \ "package from your system. Use --prune together with " + \ "--verbose to show reverse dependencies or with --nodeps " + \ "to ignore all dependencies. " for line in wrap(paragraph, desc_width): - print desc_indent + line - print - print " "+green("--regen") - print " Causes portage to check and update the dependency cache of all" - print " ebuilds in the portage tree. This is not recommended for rsync" - print " users as rsync updates the cache using server-side caches." - print " Rsync users should simply 'emerge --sync' to regenerate." + print(desc_indent + line) + print() + print(" "+green("--regen")) + print(" Causes portage to check and update the dependency cache of all") + print(" ebuilds in the portage tree. This is not recommended for rsync") + print(" users as rsync updates the cache using server-side caches.") + print(" Rsync users should simply 'emerge --sync' to regenerate.") desc = "In order to specify parallel --regen behavior, use "+ \ "the ---jobs and --load-average options. If you would like to " + \ "generate and distribute cache for use by others, use egencache(1)." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--resume") - print " Resumes the most recent merge list that has been aborted due to an" - print " error. Please note that this operation will only return an error" - print " on failure. If there is nothing for portage to do, then portage" - print " will exit with a message and a success condition. A resume list" - print " will persist until it has been completed in entirety or until" - print " another aborted merge list replaces it. The resume history is" - print " capable of storing two merge lists. After one resume list" - print " completes, it is possible to invoke --resume once again in order" - print " to resume an older list." - print - print " "+green("--search")+" ("+green("-s")+" short option)" - print " Searches for matches of the supplied string in the current local" - print " portage tree. By default emerge uses a case-insensitive simple " - print " search, but you can enable a regular expression search by " - print " prefixing the search string with %." - print " Prepending the expression with a '@' will cause the category to" - print " be included in the search." - print " A few examples:" - print " "+bold("emerge --search libc") - print " list all packages that contain libc in their name" - print " "+bold("emerge --search '%^kde'") - print " list all packages starting with kde" - print " "+bold("emerge --search '%gcc$'") - print " list all packages ending with gcc" - print " "+bold("emerge --search '%@^dev-java.*jdk'") - print " list all available Java JDKs" - print - print " "+green("--searchdesc")+" ("+green("-S")+" short option)" - print " Matches the search string against the description field as well" - print " the package's name. Take caution as the descriptions are also" - print " matched as regular expressions." - print " emerge -S html" - print " emerge -S applet" - print " emerge -S 'perl.*module'" - print - print " "+green("--sync") - print " Tells emerge to update the Portage tree as specified in" - print " The SYNC variable found in /etc/make.conf. By default, SYNC instructs" - print " emerge to perform an rsync-style update with rsync.gentoo.org." - print - print " 'emerge-webrsync' exists as a helper app to emerge --sync, providing a" - print " method to receive the entire portage tree as a tarball that can be" - print " extracted and used. First time syncs would benefit greatly from this." - print - print " "+turquoise("WARNING:") - print " If using our rsync server, emerge will clean out all files that do not" - print " exist on it, including ones that you may have created. The exceptions" - print " to this are the distfiles, local and packages directories." - print - print " "+green("--unmerge")+" ("+green("-C")+" short option)" - print " "+turquoise("WARNING: This action can remove important packages!") - print " Removes all matching packages. This does no checking of" - print " dependencies, so it may remove packages necessary for the proper" - print " operation of your system. Its arguments can be atoms or" - print " ebuilds. For a dependency aware version of --unmerge, use" - print " --depclean or --prune." - print - print " "+green("--update")+" ("+green("-u")+" short option)" - print " Updates packages to the best version available, which may not" - print " always be the highest version number due to masking for testing" - print " and development. Package atoms specified on the command" - print " line are greedy, meaning that unspecific atoms may match multiple" - print " installed versions of slotted packages." - print - print " "+green("--version")+" ("+green("-V")+" short option)" - print " Displays the currently installed version of portage along with" - print " other information useful for quick reference on a system. See" - print " "+bold("emerge info")+" for more advanced information." - print - print turquoise("Options:") - print " "+green("--alphabetical") - print " When displaying USE and other flag output, combines the enabled" - print " and disabled flags into a single list and sorts it alphabetically." - print " With this option, output such as USE=\"dar -bar -foo\" will instead" - print " be displayed as USE=\"-bar dar -foo\"" - print - print " "+green("--ask")+" ("+green("-a")+" short option)" - print " before performing the merge, display what ebuilds and tbz2s will" - print " be installed, in the same format as when using --pretend; then" - print " ask whether to continue with the merge or abort. Using --ask is" - print " more efficient than using --pretend and then executing the same" - print " command without --pretend, as dependencies will only need to be" - print " calculated once. WARNING: If the \"Enter\" key is pressed at the" - print " prompt (with no other input), it is interpreted as acceptance of" - print " the first choice. Note that the input buffer is not cleared prior" - print " to the prompt, so an accidental press of the \"Enter\" key at any" - print " time prior to the prompt will be interpreted as a choice!" - print - print " " + green("--binpkg-respect-use") + \ - " < " + turquoise("y") + " | " + turquoise("n") + " >" + print(desc_indent + line) + print() + print(" "+green("--resume")) + print(" Resumes the most recent merge list that has been aborted due to an") + print(" error. Please note that this operation will only return an error") + print(" on failure. If there is nothing for portage to do, then portage") + print(" will exit with a message and a success condition. A resume list") + print(" will persist until it has been completed in entirety or until") + print(" another aborted merge list replaces it. The resume history is") + print(" capable of storing two merge lists. After one resume list") + print(" completes, it is possible to invoke --resume once again in order") + print(" to resume an older list.") + print() + print(" "+green("--search")+" ("+green("-s")+" short option)") + print(" Searches for matches of the supplied string in the current local") + print(" portage tree. By default emerge uses a case-insensitive simple ") + print(" search, but you can enable a regular expression search by ") + print(" prefixing the search string with %.") + print(" Prepending the expression with a '@' will cause the category to") + print(" be included in the search.") + print(" A few examples:") + print(" "+bold("emerge --search libc")) + print(" list all packages that contain libc in their name") + print(" "+bold("emerge --search '%^kde'")) + print(" list all packages starting with kde") + print(" "+bold("emerge --search '%gcc$'")) + print(" list all packages ending with gcc") + print(" "+bold("emerge --search '%@^dev-java.*jdk'")) + print(" list all available Java JDKs") + print() + print(" "+green("--searchdesc")+" ("+green("-S")+" short option)") + print(" Matches the search string against the description field as well") + print(" the package's name. Take caution as the descriptions are also") + print(" matched as regular expressions.") + print(" emerge -S html") + print(" emerge -S applet") + print(" emerge -S 'perl.*module'") + print() + print(" "+green("--sync")) + print(" Tells emerge to update the Portage tree as specified in") + print(" The SYNC variable found in /etc/make.conf. By default, SYNC instructs") + print(" emerge to perform an rsync-style update with rsync.gentoo.org.") + print() + print(" 'emerge-webrsync' exists as a helper app to emerge --sync, providing a") + print(" method to receive the entire portage tree as a tarball that can be") + print(" extracted and used. First time syncs would benefit greatly from this.") + print() + print(" "+turquoise("WARNING:")) + print(" If using our rsync server, emerge will clean out all files that do not") + print(" exist on it, including ones that you may have created. The exceptions") + print(" to this are the distfiles, local and packages directories.") + print() + print(" "+green("--unmerge")+" ("+green("-C")+" short option)") + print(" "+turquoise("WARNING: This action can remove important packages!")) + print(" Removes all matching packages. This does no checking of") + print(" dependencies, so it may remove packages necessary for the proper") + print(" operation of your system. Its arguments can be atoms or") + print(" ebuilds. For a dependency aware version of --unmerge, use") + print(" --depclean or --prune.") + print() + print(" "+green("--update")+" ("+green("-u")+" short option)") + print(" Updates packages to the best version available, which may not") + print(" always be the highest version number due to masking for testing") + print(" and development. Package atoms specified on the command") + print(" line are greedy, meaning that unspecific atoms may match multiple") + print(" installed versions of slotted packages.") + print() + print(" "+green("--version")+" ("+green("-V")+" short option)") + print(" Displays the currently installed version of portage along with") + print(" other information useful for quick reference on a system. See") + print(" "+bold("emerge info")+" for more advanced information.") + print() + print(turquoise("Options:")) + print(" "+green("--alphabetical")) + print(" When displaying USE and other flag output, combines the enabled") + print(" and disabled flags into a single list and sorts it alphabetically.") + print(" With this option, output such as USE=\"dar -bar -foo\" will instead") + print(" be displayed as USE=\"-bar dar -foo\"") + print() + print(" "+green("--ask")+" ("+green("-a")+" short option)") + print(" before performing the merge, display what ebuilds and tbz2s will") + print(" be installed, in the same format as when using --pretend; then") + print(" ask whether to continue with the merge or abort. Using --ask is") + print(" more efficient than using --pretend and then executing the same") + print(" command without --pretend, as dependencies will only need to be") + print(" calculated once. WARNING: If the \"Enter\" key is pressed at the") + print(" prompt (with no other input), it is interpreted as acceptance of") + print(" the first choice. Note that the input buffer is not cleared prior") + print(" to the prompt, so an accidental press of the \"Enter\" key at any") + print(" time prior to the prompt will be interpreted as a choice!") + print() + print(" " + green("--binpkg-respect-use") + \ + " < " + turquoise("y") + " | " + turquoise("n") + " >") desc = "Tells emerge to ignore binary packages if their use flags" + \ " don't match the current configuration. (default: 'n')" for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--buildpkg")+" ("+green("-b")+" short option)" + print(desc_indent + line) + print() + print(" "+green("--buildpkg")+" ("+green("-b")+" short option)") desc = "Tells emerge to build binary packages for all ebuilds processed in" + \ " addition to actually merging the packages. Useful for maintainers" + \ " or if you administrate multiple Gentoo Linux systems (build once," + \ @@ -265,29 +265,29 @@ def help(myopts, havecolor=1): " packages is to use quickpkg(1) which creates a tbz2 from the" + \ " live filesystem." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--buildpkgonly")+" ("+green("-B")+" short option)" - print " Creates a binary package, but does not merge it to the" - print " system. This has the restriction that unsatisfied dependencies" - print " must not exist for the desired package as they cannot be used if" - print " they do not exist on the system." - print - print " "+green("--changelog")+" ("+green("-l")+" short option)" - print " When pretending, also display the ChangeLog entries for packages" - print " that will be upgraded." - print - print " "+green("--color") + " < " + turquoise("y") + " | "+ turquoise("n")+" >" - print " Enable or disable color output. This option will override NOCOLOR" - print " (see make.conf(5)) and may also be used to force color output when" - print " stdout is not a tty (by default, color is disabled unless stdout" - print " is a tty)." - print - print " "+green("--columns") - print " Display the pretend output in a tabular form. Versions are" - print " aligned vertically." - print - print " "+green("--complete-graph") + "[=%s]" % turquoise("n") + print(desc_indent + line) + print() + print(" "+green("--buildpkgonly")+" ("+green("-B")+" short option)") + print(" Creates a binary package, but does not merge it to the") + print(" system. This has the restriction that unsatisfied dependencies") + print(" must not exist for the desired package as they cannot be used if") + print(" they do not exist on the system.") + print() + print(" "+green("--changelog")+" ("+green("-l")+" short option)") + print(" When pretending, also display the ChangeLog entries for packages") + print(" that will be upgraded.") + print() + print(" "+green("--color") + " < " + turquoise("y") + " | "+ turquoise("n")+" >") + print(" Enable or disable color output. This option will override NOCOLOR") + print(" (see make.conf(5)) and may also be used to force color output when") + print(" stdout is not a tty (by default, color is disabled unless stdout") + print(" is a tty).") + print() + print(" "+green("--columns")) + print(" Display the pretend output in a tabular form. Versions are") + print(" aligned vertically.") + print() + print(" "+green("--complete-graph") + "[=%s]" % turquoise("n")) desc = "This causes emerge to consider the deep dependencies of all" + \ " packages from the system and world sets. With this option enabled," + \ " emerge will bail out if it determines that the given operation will" + \ @@ -298,59 +298,59 @@ def help(myopts, havecolor=1): " --complete-graph option does not cause any more packages to" + \ " be updated than would have otherwise been updated with the option disabled." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--config-root=DIR") + print(desc_indent + line) + print() + print(" "+green("--config-root=DIR")) desc = "Set the PORTAGE_CONFIGROOT environment variable " + \ "which is documented in the emerge(1) man page." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--debug")+" ("+green("-d")+" short option)" - print " Tell emerge to run the ebuild command in --debug mode. In this" - print " mode, the bash build environment will run with the -x option," - print " causing it to output verbose debug information print to stdout." - print " --debug is great for finding bash syntax errors as providing" - print " very verbose information about the dependency and build process." - print - print " "+green("--deep") + " " + turquoise("[DEPTH]") + \ - " (" + green("-D") + " short option)" - print " This flag forces emerge to consider the entire dependency tree of" - print " packages, instead of checking only the immediate dependencies of" - print " the packages. As an example, this catches updates in libraries" - print " that are not directly listed in the dependencies of a package." - print " Also see --with-bdeps for behavior with respect to build time" - print " dependencies that are not strictly required." - print - print " "+green("--emptytree")+" ("+green("-e")+" short option)" - print " Virtually tweaks the tree of installed packages to contain" - print " nothing. This is great to use together with --pretend. This makes" - print " it possible for developers to get a complete overview of the" - print " complete dependency tree of a certain package." - print - print " "+green("--fetchonly")+" ("+green("-f")+" short option)" - print " Instead of doing any package building, just perform fetches for" - print " all packages (main package as well as all dependencies.) When" - print " used in combination with --pretend all the SRC_URIs will be" - print " displayed multiple mirrors per line, one line per file." - print - print " "+green("--fetch-all-uri")+" ("+green("-F")+" short option)" - print " Same as --fetchonly except that all package files, including those" - print " not required to build the package, will be processed." - print - print " "+green("--getbinpkg")+ "[=%s]" % turquoise("n") + " ("+green("-g")+" short option)" - print " Using the server and location defined in PORTAGE_BINHOST, portage" - print " will download the information from each binary file there and it" - print " will use that information to help build the dependency list. This" - print " option implies '-k'. (Use -gK for binary-only merging.)" - print - print " "+green("--getbinpkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-G")+" short option)" - print " This option is identical to -g, as above, except it will not use" - print " ANY information from the local machine. All binaries will be" - print " downloaded from the remote server without consulting packages" - print " existing in the packages directory." - print - print " " + green("--jobs") + " " + turquoise("[JOBS]") + " ("+green("-j")+" short option)" + print(desc_indent + line) + print() + print(" "+green("--debug")+" ("+green("-d")+" short option)") + print(" Tell emerge to run the ebuild command in --debug mode. In this") + print(" mode, the bash build environment will run with the -x option,") + print(" causing it to output verbose debug information print to stdout.") + print(" --debug is great for finding bash syntax errors as providing") + print(" very verbose information about the dependency and build process.") + print() + print(" "+green("--deep") + " " + turquoise("[DEPTH]") + \ + " (" + green("-D") + " short option)") + print(" This flag forces emerge to consider the entire dependency tree of") + print(" packages, instead of checking only the immediate dependencies of") + print(" the packages. As an example, this catches updates in libraries") + print(" that are not directly listed in the dependencies of a package.") + print(" Also see --with-bdeps for behavior with respect to build time") + print(" dependencies that are not strictly required.") + print() + print(" "+green("--emptytree")+" ("+green("-e")+" short option)") + print(" Virtually tweaks the tree of installed packages to contain") + print(" nothing. This is great to use together with --pretend. This makes") + print(" it possible for developers to get a complete overview of the") + print(" complete dependency tree of a certain package.") + print() + print(" "+green("--fetchonly")+" ("+green("-f")+" short option)") + print(" Instead of doing any package building, just perform fetches for") + print(" all packages (main package as well as all dependencies.) When") + print(" used in combination with --pretend all the SRC_URIs will be") + print(" displayed multiple mirrors per line, one line per file.") + print() + print(" "+green("--fetch-all-uri")+" ("+green("-F")+" short option)") + print(" Same as --fetchonly except that all package files, including those") + print(" not required to build the package, will be processed.") + print() + print(" "+green("--getbinpkg")+ "[=%s]" % turquoise("n") + " ("+green("-g")+" short option)") + print(" Using the server and location defined in PORTAGE_BINHOST, portage") + print(" will download the information from each binary file there and it") + print(" will use that information to help build the dependency list. This") + print(" option implies '-k'. (Use -gK for binary-only merging.)") + print() + print(" "+green("--getbinpkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-G")+" short option)") + print(" This option is identical to -g, as above, except it will not use") + print(" ANY information from the local machine. All binaries will be") + print(" downloaded from the remote server without consulting packages") + print(" existing in the packages directory.") + print() + print(" " + green("--jobs") + " " + turquoise("[JOBS]") + " ("+green("-j")+" short option)") desc = "Specifies the number of packages " + \ "to build simultaneously. If this option is " + \ "given without an argument, emerge will not " + \ @@ -358,9 +358,9 @@ def help(myopts, havecolor=1): "can run simultaneously. Also see " + \ "the related --load-average option." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " " + green("--keep-going") + "[=%s]" % turquoise("n") + print(desc_indent + line) + print() + print(" " + green("--keep-going") + "[=%s]" % turquoise("n")) desc = "Continue as much as possible after " + \ "an error. When an error occurs, " + \ "dependencies are recalculated for " + \ @@ -369,9 +369,9 @@ def help(myopts, havecolor=1): "automatically dropped. Also see " + \ "the related --skipfirst option." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " " + green("--load-average") + " " + turquoise("LOAD") + print(desc_indent + line) + print() + print(" " + green("--load-average") + " " + turquoise("LOAD")) desc = "Specifies that no new builds should " + \ "be started if there are other builds " + \ "running and the load average is at " + \ @@ -384,77 +384,77 @@ def help(myopts, havecolor=1): "configured via MAKEOPTS in " + \ "make.conf(5)." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--newuse")+" ("+green("-N")+" short option)" - print " Tells emerge to include installed packages where USE flags have " - print " changed since installation." - print - print " "+green("--noconfmem") - print " Portage keeps track of files that have been placed into" - print " CONFIG_PROTECT directories, and normally it will not merge the" - print " same file more than once, as that would become annoying. This" - print " can lead to problems when the user wants the file in the case" - print " of accidental deletion. With this option, files will always be" - print " merged to the live fs instead of silently dropped." - print - print " "+green("--nodeps")+" ("+green("-O")+" short option)" - print " Merge specified packages, but don't merge any dependencies." - print " Note that the build may fail if deps aren't satisfied." - print - print " "+green("--noreplace")+" ("+green("-n")+" short option)" - print " Skip the packages specified on the command-line that have" - print " already been installed. Without this option, any packages," - print " ebuilds, or deps you specify on the command-line *will* cause" - print " Portage to remerge the package, even if it is already installed." - print " Note that Portage won't remerge dependencies by default." + print(desc_indent + line) + print() + print(" "+green("--newuse")+" ("+green("-N")+" short option)") + print(" Tells emerge to include installed packages where USE flags have ") + print(" changed since installation.") + print() + print(" "+green("--noconfmem")) + print(" Portage keeps track of files that have been placed into") + print(" CONFIG_PROTECT directories, and normally it will not merge the") + print(" same file more than once, as that would become annoying. This") + print(" can lead to problems when the user wants the file in the case") + print(" of accidental deletion. With this option, files will always be") + print(" merged to the live fs instead of silently dropped.") + print() + print(" "+green("--nodeps")+" ("+green("-O")+" short option)") + print(" Merge specified packages, but don't merge any dependencies.") + print(" Note that the build may fail if deps aren't satisfied.") + print() + print(" "+green("--noreplace")+" ("+green("-n")+" short option)") + print(" Skip the packages specified on the command-line that have") + print(" already been installed. Without this option, any packages,") + print(" ebuilds, or deps you specify on the command-line *will* cause") + print(" Portage to remerge the package, even if it is already installed.") + print(" Note that Portage won't remerge dependencies by default.") desc = "Also note that this option takes " + \ "precedence over options such as --newuse, preventing a package " + \ "from being reinstalled even though the corresponding USE flag settings " + \ "may have changed." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--nospinner") - print " Disables the spinner regardless of terminal type." - print - print " "+green("--oneshot")+" ("+green("-1")+" short option)" - print " Emerge as normal, but don't add packages to the world profile." - print " This package will only be updated if it is depended upon by" - print " another package." - print - print " "+green("--onlydeps")+" ("+green("-o")+" short option)" - print " Only merge (or pretend to merge) the dependencies of the" - print " specified packages, not the packages themselves." - print - print " "+green("--pretend")+" ("+green("-p")+" short option)" - print " Instead of actually performing the merge, simply display what" - print " ebuilds and tbz2s *would* have been installed if --pretend" - print " weren't used. Using --pretend is strongly recommended before" - print " installing an unfamiliar package. In the printout, N = new," - print " U = updating, R = replacing, F = fetch restricted, B = blocked" - print " by an already installed package, D = possible downgrading," - print " S = slotted install. --verbose causes affecting use flags to be" - print " printed out accompanied by a '+' for enabled and a '-' for" - print " disabled USE flags." - print - print " "+green("--quiet")+" ("+green("-q")+" short option)" - print " Effects vary, but the general outcome is a reduced or condensed" - print " output from portage's displays." - print - print " "+green("--reinstall ") + turquoise("changed-use") - print " Tells emerge to include installed packages where USE flags have" - print " changed since installation. Unlike --newuse, this option does" - print " not trigger reinstallation when flags that the user has not" - print " enabled are added or removed." - print - print " "+green("--root=DIR") + print(desc_indent + line) + print() + print(" "+green("--nospinner")) + print(" Disables the spinner regardless of terminal type.") + print() + print(" "+green("--oneshot")+" ("+green("-1")+" short option)") + print(" Emerge as normal, but don't add packages to the world profile.") + print(" This package will only be updated if it is depended upon by") + print(" another package.") + print() + print(" "+green("--onlydeps")+" ("+green("-o")+" short option)") + print(" Only merge (or pretend to merge) the dependencies of the") + print(" specified packages, not the packages themselves.") + print() + print(" "+green("--pretend")+" ("+green("-p")+" short option)") + print(" Instead of actually performing the merge, simply display what") + print(" ebuilds and tbz2s *would* have been installed if --pretend") + print(" weren't used. Using --pretend is strongly recommended before") + print(" installing an unfamiliar package. In the printout, N = new,") + print(" U = updating, R = replacing, F = fetch restricted, B = blocked") + print(" by an already installed package, D = possible downgrading,") + print(" S = slotted install. --verbose causes affecting use flags to be") + print(" printed out accompanied by a '+' for enabled and a '-' for") + print(" disabled USE flags.") + print() + print(" "+green("--quiet")+" ("+green("-q")+" short option)") + print(" Effects vary, but the general outcome is a reduced or condensed") + print(" output from portage's displays.") + print() + print(" "+green("--reinstall ") + turquoise("changed-use")) + print(" Tells emerge to include installed packages where USE flags have") + print(" changed since installation. Unlike --newuse, this option does") + print(" not trigger reinstallation when flags that the user has not") + print(" enabled are added or removed.") + print() + print(" "+green("--root=DIR")) desc = "Set the ROOT environment variable " + \ "which is documented in the emerge(1) man page." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--root-deps[=rdeps]") + print(desc_indent + line) + print() + print(" "+green("--root-deps[=rdeps]")) desc = "If no argument is given then build-time dependencies of packages for " + \ "ROOT are installed to " + \ "ROOT instead of /. If the rdeps argument is given then discard " + \ @@ -465,18 +465,18 @@ def help(myopts, havecolor=1): "DEPEND variable. However, behavior may change for new " + \ "EAPIs when related extensions are added in the future." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " " + green("--selective") + "[=%s]" % turquoise("n") + print(desc_indent + line) + print() + print(" " + green("--selective") + "[=%s]" % turquoise("n")) desc = "This is similar to the --noreplace option, except that it " + \ "does not take precedence over options such as --newuse. " + \ "Some options, such as --update, imply --selective. " + \ "Use --selective=n if you want to forcefully disable " + \ "--selective, regardless of options like --update." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--skipfirst") + print(desc_indent + line) + print() + print(" "+green("--skipfirst")) desc = "This option is only valid when " + \ "used with --resume. It removes the " + \ "first package in the resume list. " + \ @@ -487,35 +487,35 @@ def help(myopts, havecolor=1): "Also see the related " + \ "--keep-going option." for line in wrap(desc, desc_width): - print desc_indent + line - print - print " "+green("--tree")+" ("+green("-t")+" short option)" - print " Shows the dependency tree using indentation for dependencies." - print " The packages are also listed in reverse merge order so that" - print " a package's dependencies follow the package. Only really useful" - print " in combination with --emptytree, --update or --deep." - print - print " "+green("--usepkg")+ "[=%s]" % turquoise("n") + " ("+green("-k")+" short option)" - print " Tell emerge to use binary packages (from $PKGDIR) if they are" - print " available, thus possibly avoiding some time-consuming compiles." - print " This option is useful for CD installs; you can export" - print " PKGDIR=/mnt/cdrom/packages and then use this option to have" - print " emerge \"pull\" binary packages from the CD in order to satisfy" - print " dependencies." - print - print " "+green("--usepkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-K")+" short option)" - print " Like --usepkg above, except this only allows the use of binary" - print " packages, and it will abort the emerge if the package is not" - print " available at the time of dependency calculation." - print - print " "+green("--verbose")+" ("+green("-v")+" short option)" - print " Effects vary, but the general outcome is an increased or expanded" - print " display of content in portage's displays." - print - print " "+green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" >" - print " In dependency calculations, pull in build time dependencies that" - print " are not strictly required. This defaults to 'n' for installation" - print " actions and 'y' for the --depclean action. This setting can be" - print " added to EMERGE_DEFAULT_OPTS (see make.conf(5)) and later" - print " overridden via the command line." - print + print(desc_indent + line) + print() + print(" "+green("--tree")+" ("+green("-t")+" short option)") + print(" Shows the dependency tree using indentation for dependencies.") + print(" The packages are also listed in reverse merge order so that") + print(" a package's dependencies follow the package. Only really useful") + print(" in combination with --emptytree, --update or --deep.") + print() + print(" "+green("--usepkg")+ "[=%s]" % turquoise("n") + " ("+green("-k")+" short option)") + print(" Tell emerge to use binary packages (from $PKGDIR) if they are") + print(" available, thus possibly avoiding some time-consuming compiles.") + print(" This option is useful for CD installs; you can export") + print(" PKGDIR=/mnt/cdrom/packages and then use this option to have") + print(" emerge \"pull\" binary packages from the CD in order to satisfy") + print(" dependencies.") + print() + print(" "+green("--usepkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-K")+" short option)") + print(" Like --usepkg above, except this only allows the use of binary") + print(" packages, and it will abort the emerge if the package is not") + print(" available at the time of dependency calculation.") + print() + print(" "+green("--verbose")+" ("+green("-v")+" short option)") + print(" Effects vary, but the general outcome is an increased or expanded") + print(" display of content in portage's displays.") + print() + print(" "+green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" >") + print(" In dependency calculations, pull in build time dependencies that") + print(" are not strictly required. This defaults to 'n' for installation") + print(" actions and 'y' for the --depclean action. This setting can be") + print(" added to EMERGE_DEFAULT_OPTS (see make.conf(5)) and later") + print(" overridden via the command line.") + print() diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 0df815a02..70fb3e177 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -198,12 +198,12 @@ def display_preserved_libs(vardbapi, myopts): if vardbapi.plib_registry.hasEntries(): if "--quiet" in myopts: - print - print colorize("WARN", "!!!") + " existing preserved libs found" + print() + print(colorize("WARN", "!!!") + " existing preserved libs found") return else: - print - print colorize("WARN", "!!!") + " existing preserved libs:" + print() + print(colorize("WARN", "!!!") + " existing preserved libs:") plibdata = vardbapi.plib_registry.getPreservedLibs() linkmap = vardbapi.linkmap @@ -239,7 +239,7 @@ def display_preserved_libs(vardbapi, myopts): owners = vardbapi._owners.getFileOwnerMap(search_for_owners) for cpv in plibdata: - print colorize("WARN", ">>>") + " package: %s" % cpv + print(colorize("WARN", ">>>") + " package: %s" % cpv) samefile_map = {} for f in plibdata[cpv]: obj_key = linkmap._obj_key(f) @@ -252,19 +252,19 @@ def display_preserved_libs(vardbapi, myopts): for alt_paths in samefile_map.itervalues(): alt_paths = sorted(alt_paths) for p in alt_paths: - print colorize("WARN", " * ") + " - %s" % (p,) + print(colorize("WARN", " * ") + " - %s" % (p,)) f = alt_paths[0] consumers = consumer_map.get(f, []) for c in consumers[:MAX_DISPLAY]: - print colorize("WARN", " * ") + " used by %s (%s)" % \ - (c, ", ".join(x.mycpv for x in owners.get(c, []))) + print(colorize("WARN", " * ") + " used by %s (%s)" % \ + (c, ", ".join(x.mycpv for x in owners.get(c, [])))) if len(consumers) == MAX_DISPLAY + 1: - print colorize("WARN", " * ") + " used by %s (%s)" % \ + print(colorize("WARN", " * ") + " used by %s (%s)" % \ (consumers[MAX_DISPLAY], ", ".join(x.mycpv \ - for x in owners.get(consumers[MAX_DISPLAY], []))) + for x in owners.get(consumers[MAX_DISPLAY], [])))) elif len(consumers) > MAX_DISPLAY: - print colorize("WARN", " * ") + " used by %d other files" % (len(consumers) - MAX_DISPLAY) - print "Use " + colorize("GOOD", "emerge @preserved-rebuild") + " to rebuild packages using these libraries" + print(colorize("WARN", " * ") + " used by %d other files" % (len(consumers) - MAX_DISPLAY)) + print("Use " + colorize("GOOD", "emerge @preserved-rebuild") + " to rebuild packages using these libraries") def post_emerge(root_config, myopts, mtimedb, retval): """ @@ -872,7 +872,7 @@ def expand_set_arguments(myfiles, myaction, root_config): # display errors that occured while loading the SetConfig instance for e in setconfig.errors: - print colorize("BAD", "Error during set creation: %s" % e) + print(colorize("BAD", "Error during set creation: %s" % e)) # emerge relies on the existance of sets with names "world" and "system" required_sets = ("world", "system") @@ -921,13 +921,13 @@ def expand_set_arguments(myfiles, myaction, root_config): "not support unmerge operations\n") retval = 1 elif not set_atoms: - print "emerge: '%s' is an empty set" % s + print("emerge: '%s' is an empty set" % s) elif myaction not in do_not_expand: newargs.extend(set_atoms) else: newargs.append(SETPREFIX+s) for e in sets[s].errors: - print e + print(e) else: newargs.append(a) return (newargs, retval) @@ -1095,7 +1095,7 @@ def emerge_main(): del mytrees, mydb if "moo" in myfiles: - print """ + print(""" Larry loves Gentoo (""" + platform.system() + """) @@ -1108,12 +1108,12 @@ def emerge_main(): ||----w | || || -""" +""") for x in myfiles: ext = os.path.splitext(x)[1] if (ext == ".ebuild" or ext == ".tbz2") and os.path.exists(os.path.abspath(x)): - print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n") + print(colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n")) break root_config = trees[settings["ROOT"]]["root_config"] @@ -1131,11 +1131,11 @@ def emerge_main(): # Need to handle empty sets specially, otherwise emerge will react # with the help message for empty argument lists if oldargs and not myfiles: - print "emerge: no targets left after set expansion" + print("emerge: no targets left after set expansion") return 0 if ("--tree" in myopts) and ("--columns" in myopts): - print "emerge: can't specify both of \"--tree\" and \"--columns\"." + print("emerge: can't specify both of \"--tree\" and \"--columns\".") return 1 if '--emptytree' in myopts and '--noreplace' in myopts: @@ -1207,17 +1207,17 @@ def emerge_main(): spinner.update = spinner.update_basic if myaction == 'version': - print getportageversion(settings["PORTDIR"], settings["ROOT"], + print(getportageversion(settings["PORTDIR"], settings["ROOT"], settings.profile_path, settings["CHOST"], - trees[settings["ROOT"]]["vartree"].dbapi) + trees[settings["ROOT"]]["vartree"].dbapi)) return 0 elif myaction == "help": _emerge.help.help(myopts, portage.output.havecolor) return 0 if "--debug" in myopts: - print "myaction", myaction - print "myopts", myopts + print("myaction", myaction) + print("myopts", myopts) if not myaction and not myfiles and "--resume" not in myopts: _emerge.help.help(myopts, portage.output.havecolor) @@ -1249,8 +1249,8 @@ def emerge_main(): if "--ask" in myopts: myopts["--pretend"] = True del myopts["--ask"] - print ("%s access is required... " + \ - "adding --pretend to options\n") % access_desc + print(("%s access is required... " + \ + "adding --pretend to options\n") % access_desc) if portage.secpass < 1 and not need_superuser: portage_group_warning() else: diff --git a/pym/_emerge/search.py b/pym/_emerge/search.py index 9f0811dea..1b43fbb80 100644 --- a/pym/_emerge/search.py +++ b/pym/_emerge/search.py @@ -185,7 +185,7 @@ class search(object): else: self.searchdesc=0 self.matches = {"pkg":[], "set":[]} - print "Searching... ", + print("Searching... ", end=' ') regexsearch = False if self.searchkey.startswith('%'): @@ -225,7 +225,7 @@ class search(object): full_desc = self.portdb.aux_get( full_package, ["DESCRIPTION"])[0] except KeyError: - print "emerge: search: aux_get() failed, skipping" + print("emerge: search: aux_get() failed, skipping") continue if self.searchre.search(full_desc): self.matches["desc"].append([full_package,masked]) @@ -261,9 +261,9 @@ class search(object): def output(self): """Outputs the results of the search.""" - print "\b\b \n[ Results for search key : "+white(self.searchkey)+" ]" - print "[ Applications found : "+white(str(self.mlen))+" ]" - print " " + print("\b\b \n[ Results for search key : "+white(self.searchkey)+" ]") + print("[ Applications found : "+white(str(self.mlen))+" ]") + print(" ") vardb = self.vartree.dbapi for mtype in self.matches: for match,masked in self.matches[mtype]: @@ -294,12 +294,12 @@ class search(object): desc, homepage, license = self.portdb.aux_get( full_package, ["DESCRIPTION","HOMEPAGE","LICENSE"]) except KeyError: - print "emerge: search: aux_get() failed, skipping" + print("emerge: search: aux_get() failed, skipping") continue if masked: - print green("*")+" "+white(match)+" "+red("[ Masked ]") + print(green("*")+" "+white(match)+" "+red("[ Masked ]")) else: - print green("*")+" "+white(match) + print(green("*")+" "+white(match)) myversion = self.getVersion(full_package, search.VERSION_RELEASE) mysum = [0,0] @@ -350,11 +350,11 @@ class search(object): if self.verbose: msg = [] if available: - print " ", darkgreen("Latest version available:"),myversion - print " ", self.getInstallationStatus(mycat+'/'+mypkg) + print(" ", darkgreen("Latest version available:"),myversion) + print(" ", self.getInstallationStatus(mycat+'/'+mypkg)) if myebuild: - print " %s %s" % \ - (darkgreen("Size of files:"), file_size_str) + print(" %s %s" % \ + (darkgreen("Size of files:"), file_size_str)) msg.append(" " + darkgreen("Homepage:") + \ " " + homepage + "\n") msg.append(" " + darkgreen("Description:") \ diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py index 76b379581..f9ad50606 100644 --- a/pym/_emerge/unmerge.py +++ b/pym/_emerge/unmerge.py @@ -74,9 +74,9 @@ def unmerge(root_config, myopts, unmerge_action, if not unmerge_files: if unmerge_action == "unmerge": - print - print bold("emerge unmerge") + " can only be used with specific package names" - print + print() + print(bold("emerge unmerge") + " can only be used with specific package names") + print() return 0 else: global_unmerge = 1 @@ -90,7 +90,7 @@ def unmerge(root_config, myopts, unmerge_action, else: #we've got command-line arguments if not unmerge_files: - print "\nNo packages to unmerge have been provided.\n" + print("\nNo packages to unmerge have been provided.\n") return 0 for x in unmerge_files: arg_parts = x.split('/') @@ -99,14 +99,14 @@ def unmerge(root_config, myopts, unmerge_action, #possible cat/pkg or dep; treat as such candidate_catpkgs.append(x) elif unmerge_action in ["prune","clean"]: - print "\n!!! Prune and clean do not accept individual" + \ - " ebuilds as arguments;\n skipping.\n" + print("\n!!! Prune and clean do not accept individual" + \ + " ebuilds as arguments;\n skipping.\n") continue else: # it appears that the user is specifying an installed # ebuild and we're in "unmerge" mode, so it's ok. if not os.path.exists(x): - print "\n!!! The path '"+x+"' doesn't exist.\n" + print("\n!!! The path '"+x+"' doesn't exist.\n") return 0 absx = os.path.abspath(x) @@ -124,26 +124,26 @@ def unmerge(root_config, myopts, unmerge_action, sp_vdb_len = len(sp_vdb) if not os.path.exists(absx+"/CONTENTS"): - print "!!! Not a valid db dir: "+str(absx) + print("!!! Not a valid db dir: "+str(absx)) return 0 if sp_absx_len <= sp_vdb_len: # The Path is shorter... so it can't be inside the vdb. - print sp_absx - print absx - print "\n!!!",x,"cannot be inside "+ \ - vdb_path+"; aborting.\n" + print(sp_absx) + print(absx) + print("\n!!!",x,"cannot be inside "+ \ + vdb_path+"; aborting.\n") return 0 for idx in range(0,sp_vdb_len): if idx >= sp_absx_len or sp_vdb[idx] != sp_absx[idx]: - print sp_absx - print absx - print "\n!!!", x, "is not inside "+\ - vdb_path+"; aborting.\n" + print(sp_absx) + print(absx) + print("\n!!!", x, "is not inside "+\ + vdb_path+"; aborting.\n") return 0 - print "="+"/".join(sp_absx[sp_vdb_len:]) + print("="+"/".join(sp_absx[sp_vdb_len:])) candidate_catpkgs.append( "="+"/".join(sp_absx[sp_vdb_len:])) @@ -172,13 +172,13 @@ def unmerge(root_config, myopts, unmerge_action, try: mymatch = vartree.dbapi.match(x) except portage.exception.AmbiguousPackageName as errpkgs: - print "\n\n!!! The short ebuild name \"" + \ - x + "\" is ambiguous. Please specify" - print "!!! one of the following fully-qualified " + \ - "ebuild names instead:\n" + print("\n\n!!! The short ebuild name \"" + \ + x + "\" is ambiguous. Please specify") + print("!!! one of the following fully-qualified " + \ + "ebuild names instead:\n") for i in errpkgs[0]: - print " " + green(i) - print + print(" " + green(i)) + print() sys.exit(1) if not mymatch and x[0] not in "<>=~": @@ -379,9 +379,9 @@ def unmerge(root_config, myopts, unmerge_action, #print colorize("WARN", "Package %s is going to be unmerged," % cpv) #print colorize("WARN", "but still listed in the following package sets:") #print " %s\n" % ", ".join(parents) - print colorize("WARN", "Not unmerging package %s as it is" % cpv) - print colorize("WARN", "still referenced by the following package sets:") - print " %s\n" % ", ".join(parents) + print(colorize("WARN", "Not unmerging package %s as it is" % cpv)) + print(colorize("WARN", "still referenced by the following package sets:")) + print(" %s\n" % ", ".join(parents)) # adjust pkgmap so the display output is correct pkgmap[cp]["selected"].remove(cpv) all_selected.remove(cpv) @@ -484,9 +484,9 @@ def unmerge(root_config, myopts, unmerge_action, if userquery("Would you like to unmerge these packages?")=="No": # enter pretend mode for correct formatting of results myopts["--pretend"] = True - print - print "Quitting." - print + print() + print("Quitting.") + print() return 0 #the real unmerging begins, after a short delay.... if clean_delay and not autoclean: diff --git a/pym/_emerge/userquery.py b/pym/_emerge/userquery.py index 8b5fb4c1c..9a62551df 100644 --- a/pym/_emerge/userquery.py +++ b/pym/_emerge/userquery.py @@ -33,7 +33,7 @@ def userquery(prompt, responses=None, colours=None): elif colours is None: colours=[bold] colours=(colours*len(responses))[:len(responses)] - print bold(prompt), + print(bold(prompt), end=' ') try: while True: response=raw_input("["+"/".join([colours[i](responses[i]) for i in range(len(responses))])+"] ") @@ -41,8 +41,8 @@ def userquery(prompt, responses=None, colours=None): # An empty response will match the first value in responses. if response.upper()==key[:len(response)].upper(): return key - print "Sorry, response '%s' not understood." % response, + print("Sorry, response '%s' not understood." % response, end=' ') except (EOFError, KeyboardInterrupt): - print "Interrupted." + print("Interrupted.") sys.exit(1) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index f2a810531..290da2e09 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4143,7 +4143,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", if ("mirror" in features) and ("lmirror" not in features): # lmirror should allow you to bypass mirror restrictions. # XXX: This is not a good thing, and is temporary at best. - print _(">>> \"mirror\" mode desired and \"mirror\" restriction found; skipping fetch.") + print(_(">>> \"mirror\" mode desired and \"mirror\" restriction found; skipping fetch.")) return 1 # Generally, downloading the same file repeatedly from @@ -4905,7 +4905,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", # from another mirror... verified_ok,reason = portage.checksum.verify_all(mysettings["DISTDIR"]+"/"+myfile, mydigests[myfile]) if not verified_ok: - print reason + print(reason) writemsg(_("!!! Fetched file: %s VERIFY FAILED!\n") % myfile, noiselevel=-1) writemsg(_("!!! Reason: %s\n") % reason[0], @@ -7071,7 +7071,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, myebuild=mysettings["EBUILD"], mytree=tree, mydbapi=mydbapi, vartree=vartree, prev_mtimes=prev_mtimes) else: - print _("!!! Unknown mydo: %s") % mydo + print(_("!!! Unknown mydo: %s") % mydo) return 1 return retval @@ -7184,8 +7184,8 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, except SystemExit as e: raise except Exception as e: - print _("!!! Stating source file failed... movefile()") - print "!!!",e + print(_("!!! Stating source file failed... movefile()")) + print("!!!",e) return None destexists=1 @@ -7233,9 +7233,9 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, except SystemExit as e: raise except Exception as e: - print _("!!! failed to properly create symlink:") - print "!!!",dest,"->",target - print "!!!",e + print(_("!!! failed to properly create symlink:")) + print("!!!",dest,"->",target) + print("!!!",e) return None hardlinked = False @@ -7287,8 +7287,8 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, except Exception as e: if e[0]!=errno.EXDEV: # Some random error. - print _("!!! Failed to move %(src)s to %(dest)s") % {"src": src, "dest": dest} - print "!!!",e + print(_("!!! Failed to move %(src)s to %(dest)s") % {"src": src, "dest": dest}) + print("!!!",e) return None # Invalid cross-device-link 'bind' mounted or actually Cross-Device if renamefailed: @@ -7305,8 +7305,8 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, except SystemExit as e: raise except Exception as e: - print _('!!! copy %(src)s -> %(dest)s failed.') % {"src": src, "dest": dest} - print "!!!",e + print(_('!!! copy %(src)s -> %(dest)s failed.') % {"src": src, "dest": dest}) + print("!!!",e) return None else: #we don't yet handle special, so we need to fall back to /bin/mv @@ -7329,9 +7329,9 @@ def movefile(src, dest, newmtime=None, sstat=None, mysettings=None, except SystemExit as e: raise except Exception as e: - print _("!!! Failed to chown/chmod/unlink in movefile()") - print "!!!",dest - print "!!!",e + print(_("!!! Failed to chown/chmod/unlink in movefile()")) + print("!!!",dest) + print("!!!",e) return None try: @@ -8405,7 +8405,7 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, if vartree is None: vartree = db[myroot]["vartree"] if mytbz2[-5:]!=".tbz2": - print _("!!! Not a .tbz2 file") + print(_("!!! Not a .tbz2 file")) return 1 tbz2_lock = None @@ -8697,8 +8697,8 @@ def _global_updates(trees, prev_mtimes): # Update progress above is indicated by characters written to stdout so # we print a couple new lines here to separate the progress output from # what follows. - print - print + print() + print() if do_upgrade_packagesmessage and bindb and \ bindb.cpv_all(): diff --git a/pym/portage/cache/sql_template.py b/pym/portage/cache/sql_template.py index a4580bdc7..ff9d273ed 100644 --- a/pym/portage/cache/sql_template.py +++ b/pym/portage/cache/sql_template.py @@ -284,7 +284,7 @@ class SQLDatabase(template.database): else: query = '' - print "query = SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % (self.label, query) + print("query = SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % (self.label, query)) try: self.con.execute("SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % \ (self.label, query)) diff --git a/pym/portage/cache/util.py b/pym/portage/cache/util.py index 7b2f1026a..8eee5971d 100644 --- a/pym/portage/cache/util.py +++ b/pym/portage/cache/util.py @@ -161,9 +161,9 @@ class quiet_mirroring(object): class non_quiet_mirroring(quiet_mirroring): call_update_min=1 - def update(self,key,*arg): print "processed",key - def exception(self, key, *arg): print "exec",key,arg - def missing(self,key): print "key %s is missing", key - def corruption(self,key,*arg): print "corrupt %s:" % key,arg - def eclass_stale(self,key,*arg):print "stale %s:"%key,arg + def update(self,key,*arg): print("processed",key) + def exception(self, key, *arg): print("exec",key,arg) + def missing(self,key): print("key %s is missing", key) + def corruption(self,key,*arg): print("corrupt %s:" % key,arg) + def eclass_stale(self,key,*arg):print("stale %s:"%key,arg) diff --git a/pym/portage/cvstree.py b/pym/portage/cvstree.py index c3f5d3045..de448fdd1 100644 --- a/pym/portage/cvstree.py +++ b/pym/portage/cvstree.py @@ -219,7 +219,7 @@ def getentries(mydir,recursive=0): break mysplit=line.split("/") if len(mysplit)!=6: - print "Confused:",mysplit + print("Confused:",mysplit) continue if mysplit[0]=="D": entries["dirs"][mysplit[1]]={"dirs":{},"files":{},"status":[]} @@ -249,7 +249,7 @@ def getentries(mydir,recursive=0): if file=="CVS": continue if file=="digest-framerd-2.4.3": - print mydir,file + print(mydir,file) if os.path.isdir(mydir+"/"+file): if file not in entries["dirs"]: # It's normal for a directory to be unlisted in Entries @@ -264,49 +264,49 @@ def getentries(mydir,recursive=0): entries["dirs"][file]["status"]=["exists"] elif os.path.isfile(mydir+"/"+file): if file=="digest-framerd-2.4.3": - print "isfile" + print("isfile") if file not in entries["files"]: entries["files"][file]={"revision":"","date":"","flags":"","tags":""} if "status" in entries["files"][file]: if file=="digest-framerd-2.4.3": - print "has status" + print("has status") if "exists" not in entries["files"][file]["status"]: if file=="digest-framerd-2.4.3": - print "no exists in status" + print("no exists in status") entries["files"][file]["status"]+=["exists"] else: if file=="digest-framerd-2.4.3": - print "no status" + print("no status") entries["files"][file]["status"]=["exists"] try: if file=="digest-framerd-2.4.3": - print "stat'ing" + print("stat'ing") mystat=os.stat(mydir+"/"+file) mytime = time.asctime(time.gmtime(long(mystat.st_mtime))) if "status" not in entries["files"][file]: if file=="digest-framerd-2.4.3": - print "status not set" + print("status not set") entries["files"][file]["status"]=[] if file=="digest-framerd-2.4.3": - print "date:",entries["files"][file]["date"] - print "sdate:",mytime + print("date:",entries["files"][file]["date"]) + print("sdate:",mytime) if mytime==entries["files"][file]["date"]: entries["files"][file]["status"]+=["current"] if file=="digest-framerd-2.4.3": - print "stat done" + print("stat done") del mystat except SystemExit as e: raise except Exception as e: - print "failed to stat",file - print e + print("failed to stat",file) + print(e) return else: - print - print "File of unknown type:",mydir+"/"+file - print + print() + print("File of unknown type:",mydir+"/"+file) + print() return entries #class cvstree: diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 3c96a375a..5dbd1ad70 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -1068,7 +1068,7 @@ class binarytree(object): def gettbz2(self, pkgname): """Fetches the package from a remote site, if necessary. Attempts to resume if the file appears to be partially downloaded.""" - print "Fetching '"+str(pkgname)+"'" + print("Fetching '"+str(pkgname)+"'") tbz2_path = self.getname(pkgname) tbz2name = os.path.basename(tbz2_path) resume = False diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 7d37f365f..4ed907d7b 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -774,7 +774,7 @@ class portdbapi(dbapi): checksums = mf.getDigests() if not checksums: if debug: - print "[empty/missing/bad digest]: "+mypkg + print("[empty/missing/bad digest]: "+mypkg) return None filesdict={} myfiles = self.getFetchMap(mypkg, useflags=useflags) @@ -1043,7 +1043,7 @@ class portdbapi(dbapi): else: myval = list(self._iter_match(mydep, self.cp_list(mykey))) else: - print "ERROR: xmatch doesn't handle", level, "query!" + print("ERROR: xmatch doesn't handle", level, "query!") raise KeyError if self.frozen and (level not in ["match-list", "bestmatch-list"]): diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 45686ee00..88c18142d 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -514,19 +514,19 @@ class LinkageMap(object): # XXX This is most often due to soname symlinks not in # a library's directory. We could catalog symlinks in # LinkageMap to avoid checking for this edge case here. - print _("Found provider outside of findProviders:"), \ + print(_("Found provider outside of findProviders:"), \ os.path.join(directory, soname), "->", \ - self._obj_properties[cachedKey][4], libraries + self._obj_properties[cachedKey][4], libraries) # A valid library has been found, so there is no need to # continue. break if debug and cachedArch == arch and \ cachedKey in self._obj_properties: - print _("Broken symlink or missing/bad soname: %(dir_soname)s -> %(cachedKey)s " + print(_("Broken symlink or missing/bad soname: %(dir_soname)s -> %(cachedKey)s " "with soname %(cachedSoname)s but expecting %(soname)s") % \ {"dir_soname":os.path.join(directory, soname), "cachedKey": self._obj_properties[cachedKey], - "cachedSoname": cachedSoname, "soname":soname} + "cachedSoname": cachedSoname, "soname":soname}) # This conditional checks if there are no libraries to satisfy the # soname (empty set). if not validLibraries: @@ -542,10 +542,10 @@ class LinkageMap(object): rValue.setdefault(lib, set()).add(soname) if debug: if not os.path.isfile(lib): - print _("Missing library:"), lib + print(_("Missing library:"), lib) else: - print _("Possibly missing symlink:"), \ - os.path.join(os.path.dirname(lib), soname) + print(_("Possibly missing symlink:"), \ + os.path.join(os.path.dirname(lib), soname)) return rValue def listProviders(self): diff --git a/pym/portage/dispatch_conf.py b/pym/portage/dispatch_conf.py index e9b220a39..e18eb34fa 100644 --- a/pym/portage/dispatch_conf.py +++ b/pym/portage/dispatch_conf.py @@ -25,7 +25,7 @@ def read_config(mandatory_opts): '/etc/dispatch-conf.conf', None) opts, errors = loader.load() if not opts: - print >> sys.stderr, _('dispatch-conf: Error reading /etc/dispatch-conf.conf; fatal') + print(_('dispatch-conf: Error reading /etc/dispatch-conf.conf; fatal'), file=sys.stderr) sys.exit(1) # Handle quote removal here, since KeyValuePairFileLoader doesn't do that. @@ -39,12 +39,12 @@ def read_config(mandatory_opts): if key == "merge": opts["merge"] = "sdiff --suppress-common-lines --output='%s' '%s' '%s'" else: - print >> sys.stderr, _('dispatch-conf: Missing option "%s" in /etc/dispatch-conf.conf; fatal') % (key,) + print(_('dispatch-conf: Missing option "%s" in /etc/dispatch-conf.conf; fatal') % (key,), file=sys.stderr) if not os.path.exists(opts['archive-dir']): os.mkdir(opts['archive-dir']) elif not os.path.isdir(opts['archive-dir']): - print >> sys.stderr, _('dispatch-conf: Config archive dir [%s] must exist; fatal') % (opts['archive-dir'],) + print(_('dispatch-conf: Config archive dir [%s] must exist; fatal') % (opts['archive-dir'],), file=sys.stderr) sys.exit(1) return opts @@ -65,8 +65,8 @@ def rcs_archive(archive, curconf, newconf, mrgconf): try: shutil.copy2(curconf, archive) except(IOError, os.error) as why: - print >> sys.stderr, _('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \ - {"curconf": curconf, "archive": archive, "reason": str(why)} + print(_('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \ + {"curconf": curconf, "archive": archive, "reason": str(why)}, file=sys.stderr) if os.path.exists(archive + ',v'): os.system(RCS_LOCK + ' ' + archive) os.system(RCS_PUT + ' ' + archive) @@ -81,8 +81,8 @@ def rcs_archive(archive, curconf, newconf, mrgconf): try: shutil.copy2(newconf, archive) except(IOError, os.error) as why: - print >> sys.stderr, _('dispatch-conf: Error copying %(newconf)s to %(archive)s: %(reason)s; fatal') % \ - {"newconf": newconf, "archive": archive, "reason": str(why)} + print(_('dispatch-conf: Error copying %(newconf)s to %(archive)s: %(reason)s; fatal') % \ + {"newconf": newconf, "archive": archive, "reason": str(why)}, file=sys.stderr) if has_branch: if mrgconf != '': @@ -124,16 +124,16 @@ def file_archive(archive, curconf, newconf, mrgconf): try: shutil.copy2(curconf, archive) except(IOError, os.error) as why: - print >> sys.stderr, _('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \ - {"curconf": curconf, "archive": archive, "reason": str(why)} + print(_('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \ + {"curconf": curconf, "archive": archive, "reason": str(why)}, file=sys.stderr) if newconf != '': # Save off new config file in the archive dir with .dist.new suffix try: shutil.copy2(newconf, archive + '.dist.new') except(IOError, os.error) as why: - print >> sys.stderr, _('dispatch-conf: Error copying %(newconf)s to %(archive)s: %(reason)s; fatal') % \ - {"newconf": newconf, "archive": archive + '.dist.new', "reason": str(why)} + print(_('dispatch-conf: Error copying %(newconf)s to %(archive)s: %(reason)s; fatal') % \ + {"newconf": newconf, "archive": archive + '.dist.new', "reason": str(why)}, file=sys.stderr) ret = 0 if mrgconf != '' and os.path.exists(archive + '.dist'): diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py index e0b9383c5..30b83ea3d 100644 --- a/pym/portage/eclass_cache.py +++ b/pym/portage/eclass_cache.py @@ -61,13 +61,13 @@ class cache(object): def close_caches(self): import traceback traceback.print_stack() - print "%s close_cache is deprecated" % self.__class__ + print("%s close_cache is deprecated" % self.__class__) self.eclasses.clear() def flush_cache(self): import traceback traceback.print_stack() - print "%s flush_cache is deprecated" % self.__class__ + print("%s flush_cache is deprecated" % self.__class__) self.update_eclasses() diff --git a/pym/portage/elog/mod_echo.py b/pym/portage/elog/mod_echo.py index 445b4308b..f699e630c 100644 --- a/pym/portage/elog/mod_echo.py +++ b/pym/portage/elog/mod_echo.py @@ -19,14 +19,14 @@ def finalize(mysettings=None): global _items printer = EOutput() for root, key, logentries in _items: - print + print() if root == "/": printer.einfo(_("Messages for package %s:") % colorize("INFORM", key)) else: printer.einfo(_("Messages for package %(pkg)s merged to %(root)s:") % {"pkg": colorize("INFORM", key), "root": root}) - print + print() for phase in EBUILD_PHASES: if phase not in logentries: continue diff --git a/pym/portage/localization.py b/pym/portage/localization.py index f02439ffd..25a15e81f 100644 --- a/pym/portage/localization.py +++ b/pym/portage/localization.py @@ -11,11 +11,11 @@ def _(mystr): def localization_example(): # Dict references allow translators to rearrange word order. - print _("You can use this string for translating.") - print _("Strings can be formatted with %(mystr)s like this.") % {"mystr": "VALUES"} + print(_("You can use this string for translating.")) + print(_("Strings can be formatted with %(mystr)s like this.") % {"mystr": "VALUES"}) a_value = "value.of.a" b_value = 123 c_value = [1,2,3,4] - print _("A: %(a)s -- B: %(b)s -- C: %(c)s") % {"a":a_value,"b":b_value,"c":c_value} + print(_("A: %(a)s -- B: %(b)s -- C: %(c)s") % {"a":a_value,"b":b_value,"c":c_value}) diff --git a/pym/portage/mail.py b/pym/portage/mail.py index a8b384969..c2c7354d4 100644 --- a/pym/portage/mail.py +++ b/pym/portage/mail.py @@ -79,7 +79,7 @@ def send_mail(mysettings, message): try: mymailuser,mymailpasswd = myauthdata.split(":") except ValueError: - print _("!!! invalid SMTP AUTH configuration, trying unauthenticated ...") + print(_("!!! invalid SMTP AUTH configuration, trying unauthenticated ...")) else: myconndata = mymailuri if ":" in myconndata: diff --git a/pym/portage/sets/__init__.py b/pym/portage/sets/__init__.py index 3b8084ab3..6c5f850ad 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/sets/__init__.py @@ -201,8 +201,8 @@ if __name__ == "__main__": sc = load_default_config(portage.settings, portage.db["/"]) l, e = sc.getSets() for x in l: - print x+":" - print "DESCRIPTION = %s" % l[x].getMetadata("Description") + print(x+":") + print("DESCRIPTION = %s" % l[x].getMetadata("Description")) for n in sorted(l[x].getAtoms()): - print "- "+n - print + print("- "+n) + print() diff --git a/pym/portage/sets/libs.py b/pym/portage/sets/libs.py index cbaf57c27..ede122725 100644 --- a/pym/portage/sets/libs.py +++ b/pym/portage/sets/libs.py @@ -65,10 +65,10 @@ class PreservedLibraryConsumerSet(LibraryConsumerSet): for libs in plib_dict.itervalues(): for lib in libs: if self.debug: - print lib + print(lib) for x in sorted(self.dbapi.linkmap.findConsumers(lib)): - print " ", x - print "-"*40 + print(" ", x) + print("-"*40) consumers.update(self.dbapi.linkmap.findConsumers(lib)) # Don't rebuild packages just because they contain preserved # libs that happen to be consumers of other preserved libs. diff --git a/pym/portage/versions.py b/pym/portage/versions.py index bbea9b7c9..e77e22b2a 100644 --- a/pym/portage/versions.py +++ b/pym/portage/versions.py @@ -20,7 +20,7 @@ def ververify(myver, silent=1): return 1 else: if not silent: - print _("!!! syntax error in version: %s") % myver + print(_("!!! syntax error in version: %s") % myver) return 0 vercmp_cache = {} @@ -61,11 +61,11 @@ def vercmp(ver1, ver2, silent=1): # checking that the versions are valid if not match1 or not match1.groups(): if not silent: - print _("!!! syntax error in version: %s") % ver1 + print(_("!!! syntax error in version: %s") % ver1) return None if not match2 or not match2.groups(): if not silent: - print _("!!! syntax error in version: %s") % ver2 + print(_("!!! syntax error in version: %s") % ver2) return None # shortcut for cvs ebuilds (new style) @@ -221,7 +221,7 @@ def pkgsplit(mypkg,silent=1): if len(myparts)<2: if not silent: - print _("!!! Name error in %s: missing a version or name part.") % mypkg + print(_("!!! Name error in %s: missing a version or name part.") % mypkg) pkgcache[mypkg]=None return None diff --git a/pym/portage/xpak.py b/pym/portage/xpak.py index 54d2eb880..29c28af32 100644 --- a/pym/portage/xpak.py +++ b/pym/portage/xpak.py @@ -190,7 +190,7 @@ def getboth(infile): def listindex(myindex): """Print to the terminal the filenames listed in the indexglob passed in.""" for x in getindex_mem(myindex): - print x + print(x) def getindex_mem(myindex): """Returns the filenames listed in the indexglob passed in.""" diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index 18480294c..a65e57d51 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -309,7 +309,7 @@ def get_commit_message_with_stdin(): @rtype: string or None @returns: A string on success or None if an error occurs. """ - print "Please enter a commit message. Use Ctrl-d to finish or Ctrl-c to abort." + print("Please enter a commit message. Use Ctrl-d to finish or Ctrl-c to abort.") commitmessage = [] while True: commitmessage.append(sys.stdin.readline()) -- cgit v1.2.3-1-g7c22