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/actions.py | 295 ++++++++++++++++++++++++------------------------- 1 file changed, 147 insertions(+), 148 deletions(-) (limited to 'pym/_emerge/actions.py') 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): """ -- cgit v1.2.3-1-g7c22