changeset fe691bbb63e6 in tryton-tools:default
details: https://hg.tryton.org/tryton-tools?cmd=changeset;node=fe691bbb63e6
description:
        Update hgacl.py to Python 3 and remove language support
diffstat:

 hgacl.py |  47 +++++------------------------------------------
 1 files changed, 5 insertions(+), 42 deletions(-)

diffs (80 lines):

diff -r 64e93fa66525 -r fe691bbb63e6 hgacl.py
--- a/hgacl.py  Sat Jun 06 14:04:55 2020 +0200
+++ b/hgacl.py  Wed Jun 10 12:20:08 2020 +0200
@@ -1,26 +1,10 @@
 #!/usr/bin/env python
 import os
 from optparse import OptionParser
-from ConfigParser import SafeConfigParser, NoOptionError
-
-language2name = {
-    'bg_BG': 'bulgarian',
-    'ca_ES': 'catalan',
-    'cs_CZ': 'czech',
-    'de_DE': 'german',
-    'es_AR': 'spanish',
-    'es_CO': 'spanish',
-    'es_EC': 'spanish',
-    'es_ES': 'spanish',
-    'fr_FR': 'french',
-    'lt_LT': 'lithuanian',
-    'nl_NL': 'dutch',
-    'ru_RU': 'russian',
-    'sl_SI': 'slovenian',
-    }
+from configparser import ConfigParser, NoOptionError
 
 
-class ConfigParser(SafeConfigParser):
+class ConfigParser(ConfigParser):
 
     def optionxform(self, optionstr):
         return optionstr
@@ -51,34 +35,16 @@
     update(config, option, users, set.difference_update)
 
 
-def main(repositories, operation, users, language=None):
+def main(repositories, operation, users):
     for repository in repositories:
         config = ConfigParser()
         filename = os.path.join(repository, '.hg', 'hgrc')
         config.read(filename)
-        repo_name = os.path.basename(repository.rstrip(os.path.sep))
-        if not language:
-            operation(config, '**', users)
-        else:
-            if repo_name == 'trytond':
-                options = (
-                    '**/%s.po' % language,
-                    'doc/%s/*.po' % language,
-                    'doc/%s/*.rst' % language)
-            elif repo_name == 'tryton':
-                options = (
-                    'tryton.desktop',
-                    'share/locale/%s/LC_MESSAGES/tryton.po' % language,
-                    'doc/%s/*.{po,rst}' % language,
-                    '%s.nsh' % language2name[language],
-                    )
-            else:
-                options = ('locale/%s.po' % language,)
-            for option in options:
-                operation(config, option, users)
+        operation(config, '**', users)
         with open(filename, 'w') as fileobject:
             config.write(fileobject)
 
+
 if __name__ == '__main__':
     parser = OptionParser(usage='Usage: %prog [options]... <repository>...')
     parser.add_option('-a', '--append', action='store_const', dest='operation',
@@ -86,9 +52,6 @@
     parser.add_option('-r', '--remove', action='store_const', dest='operation',
         const=remove, help='remove')
     parser.add_option('-u', '--user', action='append', dest='users')
-    parser.add_option('-l', '--language', dest='language', default=None)
     options, repositories = parser.parse_args()
-    if options.language and options.language not in language2name:
-        parser.error('language %s is not supported' % options.language)
     if options.users:
         main(repositories, options.operation, options.users, options.language)

Reply via email to