diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-09-20 11:08:30 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-09-20 11:08:30 +0000 |
commit | 15b8a5bbdf3fb81edc6eac707bd2bd78d54394cf (patch) | |
tree | dbb60d5bbf670f1872539fca80263f17352f5c26 /pym/portage | |
parent | Update syntax of 'except' statements for compatibility with Python 3. (diff) | |
download | portage-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 'pym/portage')
-rw-r--r-- | pym/portage/__init__.py | 36 | ||||
-rw-r--r-- | pym/portage/cache/sql_template.py | 2 | ||||
-rw-r--r-- | pym/portage/cache/util.py | 10 | ||||
-rw-r--r-- | pym/portage/cvstree.py | 32 | ||||
-rw-r--r-- | pym/portage/dbapi/bintree.py | 2 | ||||
-rw-r--r-- | pym/portage/dbapi/porttree.py | 4 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 14 | ||||
-rw-r--r-- | pym/portage/dispatch_conf.py | 22 | ||||
-rw-r--r-- | pym/portage/eclass_cache.py | 4 | ||||
-rw-r--r-- | pym/portage/elog/mod_echo.py | 4 | ||||
-rw-r--r-- | pym/portage/localization.py | 6 | ||||
-rw-r--r-- | pym/portage/mail.py | 2 | ||||
-rw-r--r-- | pym/portage/sets/__init__.py | 8 | ||||
-rw-r--r-- | pym/portage/sets/libs.py | 6 | ||||
-rw-r--r-- | pym/portage/versions.py | 8 | ||||
-rw-r--r-- | pym/portage/xpak.py | 2 |
16 files changed, 81 insertions, 81 deletions
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.""" |