aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-09-20 11:08:30 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-09-20 11:08:30 +0000
commit15b8a5bbdf3fb81edc6eac707bd2bd78d54394cf (patch)
treedbb60d5bbf670f1872539fca80263f17352f5c26
parentUpdate syntax of 'except' statements for compatibility with Python 3. (diff)
downloadportage-15b8a5bbdf3fb81edc6eac707bd2bd78d54394cf.tar.gz
portage-15b8a5bbdf3fb81edc6eac707bd2bd78d54394cf.tar.bz2
portage-15b8a5bbdf3fb81edc6eac707bd2bd78d54394cf.zip
Update syntax of calls to print() for compatibility with Python 3.
(2to3-3.1 -f print -nw ${FILES}) svn path=/main/trunk/; revision=14290
-rwxr-xr-xbin/archive-conf4
-rwxr-xr-xbin/check-implicit-pointer-usage.py4
-rwxr-xr-xbin/clean_locks24
-rwxr-xr-xbin/dispatch-conf55
-rwxr-xr-xbin/ebuild18
-rwxr-xr-xbin/ebuild-helpers/dohtml32
-rwxr-xr-xbin/emaint14
-rwxr-xr-xbin/env-update10
-rwxr-xr-xbin/fixpackages6
-rwxr-xr-xbin/portageq86
-rwxr-xr-xbin/quickpkg6
-rwxr-xr-xbin/regenworld14
-rwxr-xr-xbin/repoman164
-rw-r--r--pym/_emerge/Scheduler.py10
-rw-r--r--pym/_emerge/actions.py295
-rw-r--r--pym/_emerge/countdown.py6
-rw-r--r--pym/_emerge/depgraph.py114
-rw-r--r--pym/_emerge/emergelog.py2
-rw-r--r--pym/_emerge/help.py724
-rw-r--r--pym/_emerge/main.py52
-rw-r--r--pym/_emerge/search.py24
-rw-r--r--pym/_emerge/unmerge.py58
-rw-r--r--pym/_emerge/userquery.py6
-rw-r--r--pym/portage/__init__.py36
-rw-r--r--pym/portage/cache/sql_template.py2
-rw-r--r--pym/portage/cache/util.py10
-rw-r--r--pym/portage/cvstree.py32
-rw-r--r--pym/portage/dbapi/bintree.py2
-rw-r--r--pym/portage/dbapi/porttree.py4
-rw-r--r--pym/portage/dbapi/vartree.py14
-rw-r--r--pym/portage/dispatch_conf.py22
-rw-r--r--pym/portage/eclass_cache.py4
-rw-r--r--pym/portage/elog/mod_echo.py4
-rw-r--r--pym/portage/localization.py6
-rw-r--r--pym/portage/mail.py2
-rw-r--r--pym/portage/sets/__init__.py8
-rw-r--r--pym/portage/sets/libs.py6
-rw-r--r--pym/portage/versions.py8
-rw-r--r--pym/portage/xpak.py2
-rw-r--r--pym/repoman/utilities.py2
40 files changed, 945 insertions, 947 deletions
diff --git a/bin/archive-conf b/bin/archive-conf
index 680a99cb5..227bcece2 100755
--- a/bin/archive-conf
+++ b/bin/archive-conf
@@ -73,7 +73,7 @@ def archive_conf():
try:
contents = open(file, "r")
except IOError as e:
- print >> sys.stderr, 'archive-conf: Unable to open %s: %s' % (file, e)
+ print('archive-conf: Unable to open %s: %s' % (file, e), file=sys.stderr)
sys.exit(1)
lines = contents.readlines()
for line in lines:
@@ -106,4 +106,4 @@ def archive_conf():
if len(sys.argv) > 1:
archive_conf()
else:
- print >> sys.stderr, 'Usage: archive-conf /CONFIG/FILE [/CONFIG/FILE...]'
+ print('Usage: archive-conf /CONFIG/FILE [/CONFIG/FILE...]', file=sys.stderr)
diff --git a/bin/check-implicit-pointer-usage.py b/bin/check-implicit-pointer-usage.py
index c462329e4..c50424b83 100755
--- a/bin/check-implicit-pointer-usage.py
+++ b/bin/check-implicit-pointer-usage.py
@@ -51,6 +51,6 @@ while True:
pointer_linenum = int(m.group(2))
if (last_implicit_filename == pointer_filename
and last_implicit_linenum == pointer_linenum):
- print "Function `%s' implicitly converted to pointer at " \
+ print(("Function `%s' implicitly converted to pointer at " \
"%s:%d" % (last_implicit_func, last_implicit_filename,
- last_implicit_linenum)
+ last_implicit_linenum)))
diff --git a/bin/clean_locks b/bin/clean_locks
index ec593a311..eaeedda33 100755
--- a/bin/clean_locks
+++ b/bin/clean_locks
@@ -15,15 +15,15 @@ from portage import os
if not sys.argv[1:] or "--help" in sys.argv or "-h" in sys.argv:
import portage
- print
- print "You must specify directories with hardlink-locks to clean."
- print "You may optionally specify --force, which will remove all"
- print "of the locks, even if we can't establish if they are in use."
- print "Please attempt cleaning without force first."
- print
- print "%s %s/.locks" % (sys.argv[0], portage.settings["DISTDIR"])
- print "%s --force %s/.locks" % (sys.argv[0], portage.settings["DISTDIR"])
- print
+ print()
+ print("You must specify directories with hardlink-locks to clean.")
+ print("You may optionally specify --force, which will remove all")
+ print("of the locks, even if we can't establish if they are in use.")
+ print("Please attempt cleaning without force first.")
+ print()
+ print("%s %s/.locks" % (sys.argv[0], portage.settings["DISTDIR"]))
+ print("%s --force %s/.locks" % (sys.argv[0], portage.settings["DISTDIR"]))
+ print()
sys.exit(1)
force = False
@@ -35,12 +35,12 @@ for x in sys.argv[1:]:
continue
try:
for y in portage.locks.hardlock_cleanup(x, remove_all_locks=force):
- print y
- print
+ print(y)
+ print()
except OSError as e:
if e.errno in (errno.ENOENT, errno.ENOTDIR):
- print "!!! %s is not a directory or does not exist" % x
+ print("!!! %s is not a directory or does not exist" % x)
else:
raise
sys.exit(e.errno)
diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index d0309701e..2ef55a908 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -104,9 +104,8 @@ class dispatch:
if self.options['use-rcs'] == 'yes':
for rcs_util in ("rcs", "ci", "co", "rcsmerge"):
if not find_binary(rcs_util):
- print >> sys.stderr, \
- 'dispatch-conf: Error finding all RCS utils and " + \
- "use-rcs=yes in config; fatal'
+ print('dispatch-conf: Error finding all RCS utils and " + \
+ "use-rcs=yes in config; fatal', file=sys.stderr)
return False
@@ -225,9 +224,9 @@ class dispatch:
cmd = self.options['diff'] % (conf['current'], newconf)
spawn_shell(cmd)
- print
- print '>> (%i of %i) -- %s' % (count, len(confs), conf ['current'])
- print '>> q quit, h help, n next, e edit-new, z zap-new, u use-new\n m merge, t toggle-merge, l look-merge: ',
+ print()
+ print('>> (%i of %i) -- %s' % (count, len(confs), conf ['current']))
+ print('>> q quit, h help, n next, e edit-new, z zap-new, u use-new\n m merge, t toggle-merge, l look-merge: ', end=' ')
# In some cases getch() will return some spurious characters
# that do not represent valid input. If we don't validate the
@@ -255,10 +254,10 @@ class dispatch:
break
elif c == 'm':
merged = SCRATCH_DIR+"/"+os.path.basename(conf['current'])
- print
+ print()
ret = os.system (self.options['merge'] % (merged, conf ['current'], newconf))
if ret:
- print "Failure running 'merge' command"
+ print("Failure running 'merge' command")
continue
shutil.copyfile(merged, mrgconf)
os.remove(merged)
@@ -292,12 +291,12 @@ class dispatch:
raise AssertionError("Invalid Input: %s" % c)
if auto_zapped:
- print
- print " One or more updates are frozen and have been automatically zapped:"
- print
+ print()
+ print(" One or more updates are frozen and have been automatically zapped:")
+ print()
for frozen in auto_zapped:
- print " * '%s'" % frozen
- print
+ print(" * '%s'" % frozen)
+ print()
def replace (self, newconf, curconf):
"""Replace current config with the new/merged version. Also logs
@@ -306,8 +305,8 @@ class dispatch:
try:
os.rename(newconf, curconf)
except (IOError, os.error) as why:
- print >> sys.stderr, 'dispatch-conf: Error renaming %s to %s: %s; fatal' % \
- (newconf, curconf, str(why))
+ print('dispatch-conf: Error renaming %s to %s: %s; fatal' % \
+ (newconf, curconf, str(why)), file=sys.stderr)
def post_process(self, curconf):
@@ -354,19 +353,19 @@ class dispatch:
def do_help (self):
- print; print
-
- print ' u -- update current config with new config and continue'
- print ' z -- zap (delete) new config and continue'
- print ' n -- skip to next config, leave all intact'
- print ' e -- edit new config'
- print ' m -- interactively merge current and new configs'
- print ' l -- look at diff between pre-merged and merged configs'
- print ' t -- toggle new config between merged and pre-merged state'
- print ' h -- this screen'
- print ' q -- quit'
-
- print; print 'press any key to return to diff...',
+ print(); print
+
+ print(' u -- update current config with new config and continue')
+ print(' z -- zap (delete) new config and continue')
+ print(' n -- skip to next config, leave all intact')
+ print(' e -- edit new config')
+ print(' m -- interactively merge current and new configs')
+ print(' l -- look at diff between pre-merged and merged configs')
+ print(' t -- toggle new config between merged and pre-merged state')
+ print(' h -- this screen')
+ print(' q -- quit')
+
+ print(); print('press any key to return to diff...', end=' ')
getch ()
diff --git a/bin/ebuild b/bin/ebuild
index e41764b8e..fa7c3d536 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -51,7 +51,7 @@ if len(pargs) < 2:
parser.error("missing required args")
if "merge" in pargs:
- print "Disabling noauto in features... merge disables it. (qmerge doesn't)"
+ print("Disabling noauto in features... merge disables it. (qmerge doesn't)")
os.environ["FEATURES"] = os.environ.get("FEATURES", "") + " -noauto"
os.environ["PORTAGE_CALLER"]="ebuild"
@@ -117,7 +117,7 @@ ebuild = os.path.join(ebuild_portdir, *ebuild.split(os.path.sep)[-3:])
if ebuild_portdir not in portage.portdb.porttrees:
os.environ["PORTDIR_OVERLAY"] = \
os.environ.get("PORTDIR_OVERLAY","") + " " + ebuild_portdir
- print "Appending %s to PORTDIR_OVERLAY..." % ebuild_portdir
+ print("Appending %s to PORTDIR_OVERLAY..." % ebuild_portdir)
portage.close_portdbapi_caches()
reload(portage)
del portage.portdb.porttrees[1:]
@@ -125,14 +125,14 @@ if ebuild_portdir != portage.portdb.porttree_root:
portage.portdb.porttrees.append(ebuild_portdir)
if not os.path.exists(ebuild):
- print "'%s' does not exist." % ebuild
+ print("'%s' does not exist." % ebuild)
sys.exit(1)
ebuild_split = ebuild.split("/")
cpv = "%s/%s" % (ebuild_split[-3], pf)
if not portage.catpkgsplit(cpv):
- print "!!! %s does not follow correct package syntax." % (cpv)
+ print("!!! %s does not follow correct package syntax." % (cpv))
sys.exit(1)
if ebuild.startswith(os.path.join(portage.root, portage.const.VDB_PATH)):
@@ -141,7 +141,7 @@ if ebuild.startswith(os.path.join(portage.root, portage.const.VDB_PATH)):
portage_ebuild = portage.db[portage.root][mytree].dbapi.findname(cpv)
if os.path.realpath(portage_ebuild) != ebuild:
- print "!!! Portage seems to think that %s is at %s" % (cpv, portage_ebuild)
+ print("!!! Portage seems to think that %s is at %s" % (cpv, portage_ebuild))
sys.exit(1)
else:
@@ -150,11 +150,11 @@ else:
portage_ebuild = portage.portdb.findname(cpv)
if not portage_ebuild or portage_ebuild != ebuild:
- print "!!! %s does not seem to have a valid PORTDIR structure." % ebuild
+ print("!!! %s does not seem to have a valid PORTDIR structure." % ebuild)
sys.exit(1)
if len(pargs) > 1 and "config" in pargs:
- print "config must be called on it's own, not combined with any other phase"
+ print("config must be called on it's own, not combined with any other phase")
sys.exit(1)
def discard_digests(myebuild, mysettings, mydbapi):
@@ -250,7 +250,7 @@ for arg in pargs:
a = portage.doebuild(ebuild, arg, portage.root, tmpsettings,
debug=debug, tree=mytree)
except KeyboardInterrupt:
- print "Interrupted."
+ print("Interrupted.")
a = 1
except KeyError:
# aux_get error
@@ -269,7 +269,7 @@ for arg in pargs:
portage.writemsg("!!! Permission Denied: %s\n" % (e,), noiselevel=-1)
a = 1
if a == None:
- print "Could not run the required binary?"
+ print("Could not run the required binary?")
a = 127
if a:
sys.exit(a)
diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
index be3716d8e..f672a9a0c 100755
--- a/bin/ebuild-helpers/dohtml
+++ b/bin/ebuild-helpers/dohtml
@@ -106,19 +106,19 @@ class OptionsClass:
def print_help():
opts = OptionsClass()
- print "dohtml [-a .foo,.bar] [-A .foo,.bar] [-f foo,bar] [-x foo,bar]"
- print " [-r] [-V] <file> [file ...]"
- print
- print " -a Set the list of allowed to those that are specified."
- print " Default:", ",".join(opts.allowed_exts)
- print " -A Extend the list of allowed file types."
- print " -f Set list of allowed extensionless file names."
- print " -x Set directories to be excluded from recursion."
- print " Default:", ",".join(opts.disallowed_dirs)
- print " -p Set a document prefix for installed files (empty by default)."
- print " -r Install files and directories recursively."
- print " -V Be verbose."
- print
+ print("dohtml [-a .foo,.bar] [-A .foo,.bar] [-f foo,bar] [-x foo,bar]")
+ print(" [-r] [-V] <file> [file ...]")
+ print()
+ print(" -a Set the list of allowed to those that are specified.")
+ print(" Default:", ",".join(opts.allowed_exts))
+ print(" -A Extend the list of allowed file types.")
+ print(" -f Set list of allowed extensionless file names.")
+ print(" -x Set directories to be excluded from recursion.")
+ print(" Default:", ",".join(opts.disallowed_dirs))
+ print(" -p Set a document prefix for installed files (empty by default).")
+ print(" -r Install files and directories recursively.")
+ print(" -V Be verbose.")
+ print()
def parse_args():
options = OptionsClass()
@@ -163,9 +163,9 @@ def main():
(options, args) = parse_args()
if options.verbose:
- print "Allowed extensions:", options.allowed_exts
- print "Document prefix : '" + options.doc_prefix + "'"
- print "Allowed files :", options.allowed_files
+ print("Allowed extensions:", options.allowed_exts)
+ print("Document prefix : '" + options.doc_prefix + "'")
+ print("Allowed files :", options.allowed_files)
success = False
diff --git a/bin/emaint b/bin/emaint
index ac791c14c..2dd6d1407 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -518,7 +518,7 @@ def emaint_main(myargv):
if parser.action:
action = parser.action
else:
- print "Defaulting to --check"
+ print("Defaulting to --check")
action = "-c/--check"
if args[0] == "all":
@@ -536,7 +536,7 @@ def emaint_main(myargv):
isatty = sys.stdout.isatty()
for task in tasks:
- print status % task.name()
+ print(status % task.name())
inst = task()
onProgress = None
if isatty:
@@ -554,14 +554,14 @@ def emaint_main(myargv):
if isatty:
# make sure the final progress is displayed
progressHandler.display()
- print
+ print()
signal.signal(signal.SIGWINCH, signal.SIG_DFL)
if result:
- print
- print "\n".join(result)
- print "\n"
+ print()
+ print("\n".join(result))
+ print("\n")
- print "Finished"
+ print("Finished")
if __name__ == "__main__":
emaint_main(sys.argv[1:])
diff --git a/bin/env-update b/bin/env-update
index 3fa21c7fa..912602f7b 100755
--- a/bin/env-update
+++ b/bin/env-update
@@ -6,9 +6,9 @@
import sys, errno
def usage(status):
- print "Usage: env-update [--no-ldconfig]"
- print ""
- print "See the env-update(1) man page for more info"
+ print("Usage: env-update [--no-ldconfig]")
+ print("")
+ print("See the env-update(1) man page for more info")
sys.exit(status)
if "-h" in sys.argv or "--help" in sys.argv:
@@ -20,7 +20,7 @@ if "--no-ldconfig" in sys.argv:
sys.argv.pop(sys.argv.index("--no-ldconfig"))
if len(sys.argv) > 1:
- print "!!! Invalid command line options!\n"
+ print("!!! Invalid command line options!\n")
usage(1)
try:
@@ -33,7 +33,7 @@ try:
portage.env_update(makelinks)
except IOError as e:
if e.errno == errno.EACCES:
- print "env-update: Need superuser access"
+ print("env-update: Need superuser access")
sys.exit(1)
else:
raise
diff --git a/bin/fixpackages b/bin/fixpackages
index dc7a5d24f..a85277f0e 100755
--- a/bin/fixpackages
+++ b/bin/fixpackages
@@ -27,6 +27,6 @@ except (OSError, ValueError) as e:
portage._global_updates(mytrees, mtimedb["updates"])
-print
-print "Done."
-print
+print()
+print("Done.")
+print()
diff --git a/bin/portageq b/bin/portageq
index 04c0ca034..0e26be01c 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -70,7 +70,7 @@ def has_version(argv):
Return code 0 if it's available, 1 otherwise.
"""
if (len(argv) < 2):
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
sys.exit(2)
if atom_validate_strict and not portage.isvalidatom(argv[1]):
portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
@@ -92,7 +92,7 @@ def best_version(argv):
Returns category/package-version (without .ebuild).
"""
if (len(argv) < 2):
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
sys.exit(2)
if atom_validate_strict and not portage.isvalidatom(argv[1]):
portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1],
@@ -100,7 +100,7 @@ def best_version(argv):
return 2
try:
mylist=portage.db[argv[0]]["vartree"].dbapi.match(argv[1])
- print portage.best(mylist)
+ print(portage.best(mylist))
except KeyError:
sys.exit(1)
best_version.uses_root = True
@@ -111,12 +111,12 @@ def mass_best_version(argv):
Returns category/package-version (without .ebuild).
"""
if (len(argv) < 2):
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
sys.exit(2)
try:
for pack in argv[1:]:
mylist=portage.db[argv[0]]["vartree"].dbapi.match(pack)
- print pack+":"+portage.best(mylist)
+ print(pack+":"+portage.best(mylist))
except KeyError:
sys.exit(1)
mass_best_version.uses_root = True
@@ -126,7 +126,7 @@ def metadata(argv):
Returns metadata values for the specified package.
"""
if (len(argv) < 4):
- print >> sys.stderr, "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!", file=sys.stderr)
sys.exit(2)
root, pkgtype, pkgspec = argv[0:3]
@@ -136,7 +136,7 @@ def metadata(argv):
"binary":"bintree",
"installed":"vartree"}
if pkgtype not in type_map:
- print >> sys.stderr, "Unrecognized package type: '%s'" % pkgtype
+ print("Unrecognized package type: '%s'" % pkgtype, file=sys.stderr)
sys.exit(1)
trees = portage.db
if os.path.realpath(root) == os.path.realpath(portage.settings["ROOT"]):
@@ -146,7 +146,7 @@ def metadata(argv):
pkgspec, metakeys)
writemsg_stdout(''.join('%s\n' % x for x in values), noiselevel=-1)
except KeyError:
- print >> sys.stderr, "Package not found: '%s'" % pkgspec
+ print("Package not found: '%s'" % pkgspec, file=sys.stderr)
sys.exit(1)
metadata.uses_root = True
@@ -158,7 +158,7 @@ def contents(argv):
<root>.
"""
if len(argv) != 2:
- print "ERROR: expected 2 parameters, got %d!" % len(argv)
+ print("ERROR: expected 2 parameters, got %d!" % len(argv))
return 2
root, cpv = argv
@@ -350,13 +350,13 @@ def best_visible(argv):
Returns category/package-version (without .ebuild).
"""
if (len(argv) < 2):
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
sys.exit(2)
try:
mylist=portage.db[argv[0]]["porttree"].dbapi.match(argv[1])
visible=portage.best(mylist)
if visible:
- print visible
+ print(visible)
sys.exit(0)
else:
sys.exit(1)
@@ -370,12 +370,12 @@ def mass_best_visible(argv):
Returns category/package-version (without .ebuild).
"""
if (len(argv) < 2):
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
sys.exit(2)
try:
for pack in argv[1:]:
mylist=portage.db[argv[0]]["porttree"].dbapi.match(pack)
- print pack+":"+portage.best(mylist)
+ print(pack+":"+portage.best(mylist))
except KeyError:
sys.exit(1)
mass_best_visible.uses_root = True
@@ -386,13 +386,13 @@ def all_best_visible(argv):
Returns all best_visible packages (without .ebuild).
"""
if (len(argv) < 1):
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
#print portage.db[argv[0]]["porttree"].dbapi.cp_all()
for pkg in portage.db[argv[0]]["porttree"].dbapi.cp_all():
mybest=portage.best(portage.db[argv[0]]["porttree"].dbapi.match(pkg))
if mybest:
- print mybest
+ print(mybest)
all_best_visible.uses_root = True
@@ -403,7 +403,7 @@ def match(argv):
be listed.
"""
if len(argv) != 2:
- print "ERROR: expected 2 parameters, got %d!" % len(argv)
+ print("ERROR: expected 2 parameters, got %d!" % len(argv))
sys.exit(2)
root, atom = argv
if atom:
@@ -416,7 +416,7 @@ def match(argv):
results = portage.db[root]["vartree"].dbapi.cpv_all()
results.sort()
for cpv in results:
- print cpv
+ print(cpv)
match.uses_root = True
@@ -434,49 +434,49 @@ def gentoo_mirrors(argv):
"""
Returns the mirrors set to use in the portage configuration.
"""
- print portage.settings["GENTOO_MIRRORS"]
+ print(portage.settings["GENTOO_MIRRORS"])
def portdir(argv):
"""
Returns the PORTDIR path.
"""
- print portage.settings["PORTDIR"]
+ print(portage.settings["PORTDIR"])
def config_protect(argv):
"""
Returns the CONFIG_PROTECT paths.
"""
- print portage.settings["CONFIG_PROTECT"]
+ print(portage.settings["CONFIG_PROTECT"])
def config_protect_mask(argv):
"""
Returns the CONFIG_PROTECT_MASK paths.
"""
- print portage.settings["CONFIG_PROTECT_MASK"]
+ print(portage.settings["CONFIG_PROTECT_MASK"])
def portdir_overlay(argv):
"""
Returns the PORTDIR_OVERLAY path.
"""
- print portage.settings["PORTDIR_OVERLAY"]
+ print(portage.settings["PORTDIR_OVERLAY"])
def pkgdir(argv):
"""
Returns the PKGDIR path.
"""
- print portage.settings["PKGDIR"]
+ print(portage.settings["PKGDIR"])
def distdir(argv):
"""
Returns the DISTDIR path.
"""
- print portage.settings["DISTDIR"]
+ print(portage.settings["DISTDIR"])
def envvar(argv):
@@ -489,33 +489,33 @@ def envvar(argv):
argv.pop(argv.index("-v"))
if len(argv) == 0:
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
sys.exit(2)
for arg in argv:
if verbose:
- print arg +"='"+ portage.settings[arg] +"'"
+ print(arg +"='"+ portage.settings[arg] +"'")
else:
- print portage.settings[arg]
+ print(portage.settings[arg])
def get_repos(argv):
"""<root>
Returns all repos with names (repo_name file) argv[0] = $ROOT
"""
if len(argv) < 1:
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
sys.exit(2)
- print " ".join(portage.db[argv[0]]["porttree"].dbapi.getRepositories())
+ print(" ".join(portage.db[argv[0]]["porttree"].dbapi.getRepositories()))
def get_repo_path(argv):
"""<root> <repo_id>+
Returns the path to the repo named argv[1], argv[0] = $ROOT
"""
if len(argv) < 2:
- print "ERROR: insufficient parameters!"
+ print("ERROR: insufficient parameters!")
sys.exit(2)
for arg in argv[1:]:
- print portage.db[argv[0]]["porttree"].dbapi.getRepositoryPath(arg)
+ print(portage.db[argv[0]]["porttree"].dbapi.getRepositoryPath(arg))
def list_preserved_libs(argv):
"""<root>
@@ -525,7 +525,7 @@ def list_preserved_libs(argv):
"""
if len(argv) != 1:
- print "ERROR: wrong number of arguments"
+ print("ERROR: wrong number of arguments")
sys.exit(2)
mylibs = portage.db[argv[0]]["vartree"].dbapi.plib_registry.getPreservedLibs()
rValue = 0
@@ -546,11 +546,11 @@ list_preserved_libs.uses_root = True
#
def usage(argv):
- print ">>> Portage information query tool"
- print ">>> $Id$"
- print ">>> Usage: portageq <command> [<option> ...]"
- print ""
- print "Available commands:"
+ print(">>> Portage information query tool")
+ print(">>> $Id$")
+ print(">>> Usage: portageq <command> [<option> ...]")
+ print("")
+ print("Available commands:")
#
# Show our commands -- we do this by scanning the functions in this
@@ -567,20 +567,20 @@ def usage(argv):
doc = obj.__doc__
if (doc == None):
- print " "+name
- print " MISSING DOCUMENTATION!"
- print ""
+ print(" "+name)
+ print(" MISSING DOCUMENTATION!")
+ print("")
continue
lines = doc.split("\n")
- print " "+name+" "+lines[0].strip()
+ print(" "+name+" "+lines[0].strip())
if (len(sys.argv) > 1):
if ("--help" not in sys.argv):
lines = lines[:-1]
for line in lines[1:]:
- print " "+line.strip()
+ print(" "+line.strip())
if (len(sys.argv) == 1):
- print "\nRun portageq with --help for info"
+ print("\nRun portageq with --help for info")
atom_validate_strict = "EBUILD_PHASE" in os.environ
diff --git a/bin/quickpkg b/bin/quickpkg
index e0aaf63bd..496a68325 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -159,7 +159,7 @@ def quickpkg_main(options, args, eout):
if not successes:
eout.eerror("No packages found")
return 1
- print
+ print()
eout.einfo("Packages now in '%s':" % bintree.pkgdir)
import math
units = {10:'K', 20:'M', 30:'G', 40:'T',
@@ -183,11 +183,11 @@ def quickpkg_main(options, args, eout):
size_str = str(size)
eout.einfo("%s: %s" % (cpv, size_str))
if config_files_excluded:
- print
+ print()
eout.ewarn("Excluded config files: %d" % config_files_excluded)
eout.ewarn("See --help if you would like to include config files.")
if missing:
- print
+ print()
eout.ewarn("The following packages could not be found:")
eout.ewarn(" ".join(missing))
return 2
diff --git a/bin/regenworld b/bin/regenworld
index 932995d5a..ae359cf38 100755
--- a/bin/regenworld
+++ b/bin/regenworld
@@ -49,10 +49,10 @@ world_file = os.path.join("/", portage.WORLD_FILE)
# show a little description if we have arguments
if len(sys.argv) >= 2 and sys.argv[1] in ["-h", "--help"]:
- print "This script regenerates the portage world file by checking the portage"
- print "logfile for all actions that you've done in the past. It ignores any"
- print "arguments except --help. It is recommended that you make a backup of"
- print "your existing world file (%s) before using this tool." % world_file
+ print("This script regenerates the portage world file by checking the portage")
+ print("logfile for all actions that you've done in the past. It ignores any")
+ print("arguments except --help. It is recommended that you make a backup of")
+ print("your existing world file (%s) before using this tool." % world_file)
sys.exit(0)
worldlist = portage.grabfile(os.path.join("/", portage.WORLD_FILE))
@@ -88,15 +88,15 @@ for mykey in biglist:
mylist=portage.db["/"]["vartree"].dbapi.match(mykey)
except (portage.exception.InvalidAtom, KeyError):
if "--debug" in sys.argv:
- print "* ignoring broken log entry for %s (likely injected)" % mykey
+ print("* ignoring broken log entry for %s (likely injected)" % mykey)
except ValueError as e:
- print "* %s is an ambigous package name, candidates are:\n%s" % (mykey, e)
+ print("* %s is an ambigous package name, candidates are:\n%s" % (mykey, e))
continue
if mylist:
#print "mylist:",mylist
myfavkey=portage.cpv_getkey(mylist[0])
if (myfavkey not in realsyslist) and (myfavkey not in worldlist):
- print "add to world:",myfavkey
+ print("add to world:",myfavkey)
worldlist.append(myfavkey)
portage.write_atomic(os.path.join("/", portage.WORLD_FILE),
diff --git a/bin/repoman b/bin/repoman
index 570c0b936..52f15780c 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -90,7 +90,7 @@ if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
nocolor()
def warn(txt):
- print "repoman: " + txt
+ print("repoman: " + txt)
def err(txt):
warn(txt)
@@ -436,7 +436,7 @@ no_exec = frozenset(["Manifest","ChangeLog","metadata.xml"])
options, arguments = ParseArgs(sys.argv, qahelp)
if options.version:
- print "Portage", portage.VERSION
+ print("Portage", portage.VERSION)
sys.exit(0)
# Set this to False when an extraordinary issue (generally
@@ -482,7 +482,7 @@ if vcs == "cvs" and \
prefix = bad(" * ")
from textwrap import wrap
for line in wrap(msg, 70):
- print prefix + line
+ print(prefix + line)
sys.exit(1)
del repo_lines
@@ -541,10 +541,10 @@ repolevel = len(reposplit)
# Reason for this is if they're trying to commit in just $FILESDIR/*, the Manifest needs updating.
# this check ensures that repoman knows where it is, and the manifest recommit is at least possible.
if options.mode == 'commit' and repolevel not in [1,2,3]:
- print red("***")+" Commit attempts *must* be from within a vcs co, category, or package directory."
- print red("***")+" Attempting to commit from a packages files directory will be blocked for instance."
- print red("***")+" This is intended behaviour, to ensure the manifest is recommited for a package."
- print red("***")
+ print(red("***")+" Commit attempts *must* be from within a vcs co, category, or package directory.")
+ print(red("***")+" Attempting to commit from a packages files directory will be blocked for instance.")
+ print(red("***")+" This is intended behaviour, to ensure the manifest is recommited for a package.")
+ print(red("***"))
err("Unable to identify level we're commiting from for %s" % '/'.join(reposplit))
startdir = normalize_path(mydir)
@@ -672,10 +672,10 @@ for x in repoman_settings.archlist():
if x[0] == "~":
continue
if x not in profiles:
- print red("\""+x+"\" doesn't have a valid profile listed in profiles.desc.")
- print red("You need to either \"cvs update\" your profiles dir or follow this")
- print red("up with the "+x+" team.")
- print
+ print(red("\""+x+"\" doesn't have a valid profile listed in profiles.desc."))
+ print(red("You need to either \"cvs update\" your profiles dir or follow this"))
+ print(red("up with the "+x+" team."))
+ print()
if not liclist:
logging.fatal("Couldn't find licenses?")
@@ -760,9 +760,9 @@ metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd')
if options.mode == "manifest":
pass
elif not find_binary('xmllint'):
- print red("!!! xmllint not found. Can't check metadata.xml.\n")
+ print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
if options.xml_parse or repolevel==3:
- print red("!!!")+" sorry, xmllint is needed. failing\n"
+ print(red("!!!")+" sorry, xmllint is needed. failing\n")
sys.exit(1)
else:
#hardcoded paths/urls suck. :-/
@@ -780,13 +780,13 @@ else:
except (OSError,IOError) as e:
if e.errno != 2:
- print red("!!!")+" caught exception '%s' for %s/metadata.dtd, bailing" % (str(e), portage.CACHE_PATH)
+ print(red("!!!")+" caught exception '%s' for %s/metadata.dtd, bailing" % (str(e), portage.CACHE_PATH))
sys.exit(1)
if must_fetch:
- print
- print green("***")+" the local copy of metadata.dtd needs to be refetched, doing that now"
- print
+ print()
+ print(green("***")+" the local copy of metadata.dtd needs to be refetched, doing that now")
+ print()
val = 0
try:
try:
@@ -801,12 +801,12 @@ else:
except SystemExit as e:
raise # Need to propogate this
except Exception as e:
- print
- print red("!!!")+" attempting to fetch 'http://www.gentoo.org/dtd/metadata.dtd', caught"
- print red("!!!")+" exception '%s' though." % str(e)
+ print()
+ print(red("!!!")+" attempting to fetch 'http://www.gentoo.org/dtd/metadata.dtd', caught")
+ print(red("!!!")+" exception '%s' though." % str(e))
val=0
if not val:
- print red("!!!")+" fetching new metadata.dtd failed, aborting"
+ print(red("!!!")+" fetching new metadata.dtd failed, aborting")
sys.exit(1)
#this can be problematic if xmllint changes their output
xmllint_capable=True
@@ -817,9 +817,9 @@ if options.mode == 'commit' and vcs:
if options.mode == "manifest":
pass
elif options.pretend:
- print green("\nRepoMan does a once-over of the neighborhood...")
+ print(green("\nRepoMan does a once-over of the neighborhood..."))
else:
- print green("\nRepoMan scours the neighborhood...")
+ print(green("\nRepoMan scours the neighborhood..."))
new_ebuilds = set()
modified_changelogs = set()
@@ -908,7 +908,7 @@ for x in scanlist:
repoman_settings["O"] = checkdir
if not portage.digestgen([], repoman_settings, myportdb=portdb):
- print "Unable to generate manifest."
+ print("Unable to generate manifest.")
dofail = 1
if options.mode == "manifest":
if not dofail and options.force and auto_assumed and \
@@ -1188,9 +1188,9 @@ for x in scanlist:
"xmllint --nonet --noout --dtdvalid '%s' '%s'" % \
(metadata_dtd, os.path.join(checkdir, "metadata.xml")))
if st != os.EX_OK:
- print red("!!!") + " metadata.xml is invalid:"
+ print(red("!!!") + " metadata.xml is invalid:")
for z in out.splitlines():
- print red("!!! ")+z
+ print(red("!!! ")+z)
stats["metadata.bad"]+=1
fails["metadata.bad"].append(x+"/metadata.xml")
@@ -1230,7 +1230,7 @@ for x in scanlist:
fails["ebuild.invalidname"].append(x+"/"+y+".ebuild")
continue
elif myesplit[0]!=pkgdir:
- print pkgdir,myesplit[0]
+ print(pkgdir,myesplit[0])
stats["ebuild.namenomatch"]=stats["ebuild.namenomatch"]+1
fails["ebuild.namenomatch"].append(x+"/"+y+".ebuild")
continue
@@ -1792,41 +1792,41 @@ if have_dev_keywords and not options.include_dev:
suggest_include_dev = True
if suggest_ignore_masked or suggest_include_dev:
- print
+ print()
if suggest_ignore_masked:
- print bold("Note: use --without-mask to check " + \
- "KEYWORDS on dependencies of masked packages")
+ print(bold("Note: use --without-mask to check " + \
+ "KEYWORDS on dependencies of masked packages"))
if suggest_include_dev:
- print bold("Note: use --include-dev (-d) to check " + \
- "dependencies for 'dev' profiles")
- print
+ print(bold("Note: use --include-dev (-d) to check " + \
+ "dependencies for 'dev' profiles"))
+ print()
if options.mode != 'commit':
if dofull:
- print bold("Note: type \"repoman full\" for a complete listing.")
+ print(bold("Note: type \"repoman full\" for a complete listing."))
if dowarn and not dofail:
- print green("RepoMan sez:"),"\"You're only giving me a partial QA payment?\n I'll take it this time, but I'm not happy.\""
+ print(green("RepoMan sez:"),"\"You're only giving me a partial QA payment?\n I'll take it this time, but I'm not happy.\"")
elif not dofail:
- print green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\""
+ print(green("RepoMan sez:"),"\"If everyone were like you, I'd be out of business!\"")
elif dofail:
- print turquoise("Please fix these important QA issues first.")
- print green("RepoMan sez:"),"\"Make your QA payment on time and you'll never see the likes of me.\"\n"
+ print(turquoise("Please fix these important QA issues first."))
+ print(green("RepoMan sez:"),"\"Make your QA payment on time and you'll never see the likes of me.\"\n")
sys.exit(1)
else:
if dofail and can_force and options.force and not options.pretend:
- print green("RepoMan sez:") + \
+ print(green("RepoMan sez:") + \
" \"You want to commit even with these QA issues?\n" + \
- " I'll take it this time, but I'm not happy.\"\n"
+ " I'll take it this time, but I'm not happy.\"\n")
elif dofail:
if options.force and not can_force:
- print bad("The --force option has been disabled due to extraordinary issues.")
- print turquoise("Please fix these important QA issues first.")
- print green("RepoMan sez:"),"\"Make your QA payment on time and you'll never see the likes of me.\"\n"
+ print(bad("The --force option has been disabled due to extraordinary issues."))
+ print(turquoise("Please fix these important QA issues first."))
+ print(green("RepoMan sez:"),"\"Make your QA payment on time and you'll never see the likes of me.\"\n")
sys.exit(1)
if options.pretend:
- print green("RepoMan sez:"), "\"So, you want to play it safe. Good call.\"\n"
+ print(green("RepoMan sez:"), "\"So, you want to play it safe. Good call.\"\n")
myunadded = []
if vcs == "cvs":
@@ -1856,7 +1856,7 @@ else:
for x in range(len(myunadded)-1,-1,-1):
xs=myunadded[x].split("/")
if xs[-1]=="files":
- print "!!! files dir is not added! Please correct this."
+ print("!!! files dir is not added! Please correct this.")
sys.exit(-1)
elif xs[-1]=="Manifest":
# It's a manifest... auto add
@@ -1864,14 +1864,14 @@ else:
del myunadded[x]
if myautoadd:
- print ">>> Auto-Adding missing Manifest(s)..."
+ print(">>> Auto-Adding missing Manifest(s)...")
if options.pretend:
if vcs == "cvs":
- print "(cvs add "+" ".join(myautoadd)+")"
+ print("(cvs add "+" ".join(myautoadd)+")")
if vcs == "svn":
- print "(svn add "+" ".join(myautoadd)+")"
+ print("(svn add "+" ".join(myautoadd)+")")
elif vcs == "git":
- print "(git add "+" ".join(myautoadd)+")"
+ print("(git add "+" ".join(myautoadd)+")")
retval=0
else:
if vcs == "cvs":
@@ -1886,12 +1886,12 @@ else:
sys.exit(retval)
if myunadded:
- print red("!!! The following files are in your local tree but are not added to the master")
- print red("!!! tree. Please remove them from the local tree or add them to the master tree.")
+ print(red("!!! The following files are in your local tree but are not added to the master"))
+ print(red("!!! tree. Please remove them from the local tree or add them to the master tree."))
for x in myunadded:
- print " ",x
- print
- print
+ print(" ",x)
+ print()
+ print()
sys.exit(1)
if vcs == "cvs":
@@ -1946,10 +1946,10 @@ else:
if vcs:
if not (mychanged or mynew or myremoved):
- print green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\""
- print
- print "(Didn't find any changed files...)"
- print
+ print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
+ print()
+ print("(Didn't find any changed files...)")
+ print()
sys.exit(1)
# Manifests need to be regenerated after all other commits, so don't commit
@@ -1985,16 +1985,16 @@ else:
if myout[0] == 0:
myheaders.append(myfile)
- print "* %s files being committed..." % green(str(len(myupdates))),
+ print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
if vcs == 'git':
# With git, there's never any keyword expansion, so there's
# no need to regenerate manifests and all files will be
# committed in one big commit at the end.
- print
+ print()
else:
- print "%s have headers that will change." % green(str(len(myheaders)))
- print "* Files with headers will cause the " + \
- "manifests to be made and recommited."
+ print("%s have headers that will change." % green(str(len(myheaders))))
+ print("* Files with headers will cause the " + \
+ "manifests to be made and recommited.")
logging.info("myupdates: %s", myupdates)
logging.info("myheaders: %s", myheaders)
@@ -2023,7 +2023,7 @@ else:
except KeyboardInterrupt:
exithandler()
if not commitmessage or not commitmessage.strip():
- print "* no commit message? aborting commit."
+ print("* no commit message? aborting commit.")
sys.exit(1)
commitmessage = commitmessage.rstrip()
portage_version = getattr(portage, "VERSION", None)
@@ -2051,12 +2051,12 @@ else:
mymsg.write(commitmessage)
mymsg.close()
- print
- print green("Using commit message:")
- print green("------------------------------------------------------------------------------")
- print commitmessage
- print green("------------------------------------------------------------------------------")
- print
+ print()
+ print(green("Using commit message:"))
+ print(green("------------------------------------------------------------------------------"))
+ print(commitmessage)
+ print(green("------------------------------------------------------------------------------"))
+ print()
# Having a leading ./ prefix on file paths can trigger a bug in
# the cvs server when committing files to multiple directories,
@@ -2072,7 +2072,7 @@ else:
try:
if options.pretend:
- print "(%s)" % (" ".join(commit_cmd),)
+ print("(%s)" % (" ".join(commit_cmd),))
else:
retval = spawn(commit_cmd, env=os.environ)
if retval != os.EX_OK:
@@ -2109,7 +2109,7 @@ else:
if "PORTAGE_GPG_DIR" in repoman_settings:
gpgcmd += " --homedir "+repoman_settings["PORTAGE_GPG_DIR"]
if options.pretend:
- print "("+gpgcmd+" "+filename+")"
+ print("("+gpgcmd+" "+filename+")")
else:
rValue = os.system(gpgcmd+" "+filename)
if rValue == os.EX_OK:
@@ -2161,7 +2161,7 @@ else:
portage.digestgen([], repoman_settings, manifestonly=1,
myportdb=portdb)
elif repolevel==1: # repo-cvsroot
- print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n"
+ print(green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n")
for x in myfiles:
xs=x.split("/")
if len(xs) < 4-repolevel:
@@ -2177,7 +2177,7 @@ else:
portage.digestgen([], repoman_settings, manifestonly=1,
myportdb=portdb)
else:
- print red("I'm confused... I don't know where I am!")
+ print(red("I'm confused... I don't know where I am!"))
sys.exit(1)
# Force an unsigned commit when more than one Manifest needs to be signed.
@@ -2198,7 +2198,7 @@ else:
try:
if options.pretend:
- print "(%s)" % (" ".join(commit_cmd),)
+ print("(%s)" % (" ".join(commit_cmd),))
else:
retval = spawn(commit_cmd, env=os.environ)
if retval:
@@ -2237,7 +2237,7 @@ else:
continue
gpgsign(os.path.join(repoman_settings["O"], "Manifest"))
elif repolevel==1: # repo-cvsroot
- print green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n"
+ print(green("RepoMan sez:"), "\"You're rather crazy... doing the entire repository.\"\n")
mydone=[]
for x in myfiles:
xs=x.split("/")
@@ -2269,7 +2269,7 @@ else:
update_index_cmd = ["git", "update-index"]
update_index_cmd.extend(f.lstrip("./") for f in myfiles)
if options.pretend:
- print "(%s)" % (" ".join(update_index_cmd),)
+ print("(%s)" % (" ".join(update_index_cmd),))
else:
retval = spawn(update_index_cmd, env=os.environ)
if retval != os.EX_OK:
@@ -2309,7 +2309,7 @@ else:
try:
if options.pretend:
- print "(%s)" % (" ".join(commit_cmd),)
+ print("(%s)" % (" ".join(commit_cmd),))
else:
retval = spawn(commit_cmd, env=os.environ)
if retval != os.EX_OK:
@@ -2323,11 +2323,11 @@ else:
except OSError:
pass
- print
+ print()
if vcs:
- print "Commit complete."
+ print("Commit complete.")
else:
- print "repoman was too scared by not seeing any familiar version control file that he forgot to commit anything"
- print green("RepoMan sez:"), "\"If everyone were like you, I'd be out of business!\"\n"
+ print("repoman was too scared by not seeing any familiar version control file that he forgot to commit anything")
+ print(green("RepoMan sez:"), "\"If everyone were like you, I'd be out of business!\"\n")
sys.exit(0)
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())