summaryrefslogtreecommitdiffstats
path: root/bin
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 /bin
parent7cb8fb941f09d1ac646be334745f90e16ebd46eb (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
Diffstat (limited to 'bin')
-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
13 files changed, 218 insertions, 219 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)