From 6aaafb6c05840389f1dd9139da9694f3b43c57df Mon Sep 17 00:00:00 2001 From: Yasuhito FUTATSUKI at POEM Date: Mon, 22 Feb 2016 17:51:37 +0900 Subject: Importing locale patch for command line utils, from RHEL6 rpm source (for -japan-poem, originally imported from 2.1.12-18 package for RHEL6 rpm source) --- bin/update | 90 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'bin/update') diff --git a/bin/update b/bin/update index d74cae92..0ac5ffe8 100755 --- a/bin/update +++ b/bin/update @@ -52,7 +52,7 @@ from Mailman import MailList from Mailman import Message from Mailman import Pending from Mailman.LockFile import TimeOutError -from Mailman.i18n import _ +from Mailman.i18n import C_ from Mailman.Queue.Switchboard import Switchboard from Mailman.OldStyleMemberships import OldStyleMemberships from Mailman.MemberAdaptor import BYBOUNCE, ENABLED @@ -104,7 +104,7 @@ def make_varabs(relpath): def move_language_templates(mlist): listname = mlist.internal_name() - print _('Fixing language templates: %(listname)s') + print C_('Fixing language templates: %(listname)s') # Mailman 2.1 has a new cascading search for its templates, defined and # described in Utils.py:maketext(). Putting templates in the top level # templates/ subdir or the lists/ subdir is deprecated and no @@ -193,8 +193,8 @@ def dolist(listname): try: mlist.Lock(0.5) except TimeOutError: - print >> sys.stderr, _('WARNING: could not acquire lock for list: ' - '%(listname)s') + print >> sys.stderr, C_('WARNING: could not acquire lock for list: ' + '%(listname)s') return 1 # Sanity check the invariant that every BYBOUNCE disabled member must have @@ -212,13 +212,13 @@ def dolist(listname): # re-disable them if necessary. n = len(noinfo) if n > 0: - print _( + print C_( 'Resetting %(n)s BYBOUNCEs disabled addrs with no bounce info') for addr in noinfo.keys(): mlist.setDeliveryStatus(addr, ENABLED) # Update the held requests database - print _("""Updating the held requests database.""") + print C_("""Updating the held requests database.""") mlist._UpdateRecords() mbox_dir = make_varabs('archives/private/%s.mbox' % (listname)) @@ -240,7 +240,7 @@ def dolist(listname): else: # this shouldn't happen, but hey, just in case if not os.path.isdir(mbox_dir): - print _("""\ + print C_("""\ For some reason, %(mbox_dir)s exists as a file. This won't work with b6, so I'm renaming it to %(mbox_dir)s.tmp and proceeding.""") os.rename(mbox_dir, "%s.tmp" % (mbox_dir)) @@ -252,7 +252,7 @@ b6, so I'm renaming it to %(mbox_dir)s.tmp and proceeding.""") # private one existing if os.path.isfile(o_pri_mbox_file) and os.path.isfile(o_pub_mbox_file): if mlist.archive_private: - print _("""\ + print C_("""\ %(listname)s has both public and private mbox archives. Since this list currently uses private archiving, I'm installing the private mbox archive @@ -267,7 +267,7 @@ script. o_pub_mbox_file) os.rename(o_pub_mbox_file, "%s.preb6" % (o_pub_mbox_file)) else: - print _("""\ + print C_("""\ %s has both public and private mbox archives. Since this list currently uses public archiving, I'm installing the public mbox file archive file (%s) as the active one, and renaming @@ -284,7 +284,7 @@ script. # move private archive mbox there if it's around # and take into account all sorts of absurdities # - print _('- updating old private mbox file') + print C_('- updating old private mbox file') if os.path.exists(o_pri_mbox_file): if os.path.isfile(o_pri_mbox_file): os.rename(o_pri_mbox_file, mbox_file) @@ -292,21 +292,21 @@ script. newname = "%s.mm_install-dunno_what_this_was_but_its_in_the_way" \ % o_pri_mbox_file os.rename(o_pri_mbox_file, newname) - print _("""\ + print C_("""\ unknown file in the way, moving %(o_pri_mbox_file)s to %(newname)s""") else: # directory - print _('Nothing to do.') + print C_('Nothing to do.') # # move public archive mbox there if it's around # and take into account all sorts of absurdities. # - print _('- updating old public mbox file') + print C_('- updating old public mbox file') if os.path.exists(o_pub_mbox_file): if os.path.isfile(o_pub_mbox_file): os.rename(o_pub_mbox_file, mbox_file) @@ -314,13 +314,13 @@ script. newname = "%s.mm_install-dunno_what_this_was_but_its_in_the_way" \ % o_pub_mbox_file os.rename(o_pub_mbox_file, newname) - print _("""\ + print C_("""\ unknown file in the way, moving %(o_pub_mbox_file)s to %(newname)s""") else: # directory - print _('Nothing to do.') + print C_('Nothing to do.') # # move the html archives there @@ -350,7 +350,7 @@ script. b4_tmpl_dir = os.path.join(tmpl_dir, mlist._internal_name) new_tmpl_dir = os.path.join(list_dir, mlist._internal_name) if os.path.exists(b4_tmpl_dir): - print _("""\ + print C_("""\ - This list looks like it might have <= b4 list templates around""") for f in os.listdir(b4_tmpl_dir): o_tmpl = os.path.join(b4_tmpl_dir, f) @@ -358,12 +358,12 @@ script. if os.path.exists(o_tmpl): if not os.path.exists(n_tmpl): os.rename(o_tmpl, n_tmpl) - print _('- moved %(o_tmpl)s to %(n_tmpl)s') + print C_('- moved %(o_tmpl)s to %(n_tmpl)s') else: - print _("""\ + print C_("""\ - both %(o_tmpl)s and %(n_tmpl)s exist, leaving untouched""") else: - print _("""\ + print C_("""\ - %(o_tmpl)s doesn't exist, leaving untouched""") # # Move all the templates to the en language subdirectory as required for @@ -393,23 +393,23 @@ def remove_old_sources(module): src = '%s/%s' % (mm_cfg.PREFIX, module) pyc = src + "c" if os.path.isdir(src): - print _('removing directory %(src)s and everything underneath') + print C_('removing directory %(src)s and everything underneath') shutil.rmtree(src) elif os.path.exists(src): - print _('removing %(src)s') + print C_('removing %(src)s') try: os.unlink(src) except os.error, rest: - print _("Warning: couldn't remove %(src)s -- %(rest)s") + print C_("Warning: couldn't remove %(src)s -- %(rest)s") if module.endswith('.py') and os.path.exists(pyc): try: os.unlink(pyc) except os.error, rest: - print _("couldn't remove old file %(pyc)s -- %(rest)s") + print C_("couldn't remove old file %(pyc)s -- %(rest)s") def update_qfiles(): - print _('updating old qfiles') + print C_('updating old qfiles') prefix = `time.time()` + '+' # Be sure the qfiles/in directory exists (we don't really need the # switchboard object, but it's convenient for creating the directory). @@ -527,7 +527,7 @@ def dequeue(filebase): # This message was unparsable, most likely because its # MIME encapsulation was broken. For now, there's not # much we can do about it. - print _('message is unparsable: %(filebase)s') + print C_('message is unparsable: %(filebase)s') msgfp.close() msgfp = None if mm_cfg.QRUNNER_SAVE_BAD_MESSAGES: @@ -560,7 +560,7 @@ def update_pending(): except IOError, e: if e.errno <> errno.ENOENT: raise else: - print _('Updating Mailman 2.0 pending_subscriptions.db database') + print C_('Updating Mailman 2.0 pending_subscriptions.db database') db = marshal.load(fp) # Convert to the pre-Mailman 2.1.5 format db = Pending._update(db) @@ -571,10 +571,10 @@ def update_pending(): except IOError, e: if e.errno <> errno.ENOENT: raise else: - print _('Updating Mailman 2.1.4 pending.pck database') + print C_('Updating Mailman 2.1.4 pending.pck database') db = cPickle.load(fp) if db is None: - print _('Nothing to do.') + print C_('Nothing to do.') return # Now upgrade the database to the 2.1.5 format. Each list now has its own # pending.pck file, but only the RE_ENABLE operation actually recorded the @@ -595,7 +595,7 @@ def update_pending(): op = val[0] data = val[1:] except (IndexError, ValueError): - print _('Ignoring bad pended data: %(key)s: %(val)s') + print C_('Ignoring bad pended data: %(key)s: %(val)s') continue if op in (Pending.UNSUBSCRIPTION, Pending.CHANGE_OF_ADDRESS): # data[0] is the address being unsubscribed @@ -611,7 +611,7 @@ def update_pending(): # data[0] is the hold id. There better only be one entry per id id = data[0] if holds_by_id.has_key(id): - print _('WARNING: Ignoring duplicate pending ID: %(id)s.') + print C_('WARNING: Ignoring duplicate pending ID: %(id)s.') else: holds_by_id[id] = (key, val) # Now we have to lock every list and re-pend all the appropriate @@ -664,7 +664,7 @@ def update_pending(): def main(): errors = 0 # get rid of old stuff - print _('getting rid of old source files') + print C_('getting rid of old source files') for mod in ('Mailman/Archiver.py', 'Mailman/HyperArch.py', 'Mailman/HyperDatabase.py', 'Mailman/pipermail.py', 'Mailman/smtplib.py', 'Mailman/Cookie.py', @@ -674,29 +674,29 @@ def main(): remove_old_sources(mod) listnames = Utils.list_names() if not listnames: - print _('no lists == nothing to do, exiting') + print C_('no lists == nothing to do, exiting') return # # for people with web archiving, make sure the directories # in the archiving are set with proper perms for b6. # if os.path.isdir("%s/public_html/archives" % mm_cfg.PREFIX): - print _("""\ + print C_("""\ fixing all the perms on your old html archives to work with b6 If your archives are big, this could take a minute or two...""") os.path.walk("%s/public_html/archives" % mm_cfg.PREFIX, archive_path_fixer, "") - print _('done') + print C_('done') for listname in listnames: - print _('Updating mailing list: %(listname)s') + print C_('Updating mailing list: %(listname)s') errors = errors + dolist(listname) print - print _('Updating Usenet watermarks') + print C_('Updating Usenet watermarks') wmfile = os.path.join(mm_cfg.DATA_DIR, 'gate_watermarks') try: fp = open(wmfile) except IOError: - print _('- nothing to update here') + print C_('- nothing to update here') else: d = marshal.load(fp) fp.close() @@ -708,7 +708,7 @@ If your archives are big, this could take a minute or two...""") try: mlist.Lock(0.5) except TimeOutError: - print >> sys.stderr, _( + print >> sys.stderr, C_( 'WARNING: could not acquire lock for list: %(listname)s') errors = errors + 1 else: @@ -719,7 +719,7 @@ If your archives are big, this could take a minute or two...""") mlist.Save() mlist.Unlock() os.unlink(wmfile) - print _('- usenet watermarks updated and gate_watermarks removed') + print C_('- usenet watermarks updated and gate_watermarks removed') # In Mailman 2.1, the pending database format and file name changed, but # in Mailman 2.1.5 it changed again. This should update all existing # files to the 2.1.5 format. @@ -733,7 +733,7 @@ If your archives are big, this could take a minute or two...""") # There's no good way of figuring this out for releases prior to 2.0beta2 # :( if lastversion == NOTFRESH: - print _(""" + print C_(""" NOTE NOTE NOTE NOTE NOTE @@ -760,7 +760,7 @@ def usage(code, msg=''): fd = sys.stderr else: fd = sys.stdout - print >> fd, _(__doc__) % globals() + print >> fd, C_(__doc__) % globals() if msg: print >> sys.stderr, msg sys.exit(code) @@ -790,15 +790,15 @@ if __name__ == '__main__': hextversion = hex(thisversion) if lastversion == thisversion and not force: # nothing to do - print _('No updates are necessary.') + print C_('No updates are necessary.') sys.exit(0) if lastversion > thisversion and not force: - print _("""\ + print C_("""\ Downgrade detected, from version %(hexlversion)s to version %(hextversion)s This is probably not safe. Exiting.""") sys.exit(1) - print _('Upgrading from version %(hexlversion)s to %(hextversion)s') + print C_('Upgrading from version %(hexlversion)s to %(hextversion)s') errors = main() if not errors: # Record the version we just upgraded to @@ -807,7 +807,7 @@ Exiting.""") fp.close() else: lockdir = mm_cfg.LOCK_DIR - print _('''\ + print C_('''\ ERROR: -- cgit v1.2.3