]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Finish implementing option --po-domain.
authorBruno Haible <bruno@clisp.org>
Sat, 6 Aug 2022 01:06:51 +0000 (03:06 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 6 Aug 2022 01:06:51 +0000 (03:06 +0200)
* gnulib-tool.py (main): Accept option --po-domain.
* pygnulib/GLEmiter.py (GLEmiter.po_POTFILES_in): Fix variable
reference.
* pygnulib/GLImport.py (GLImport.execute): Don't delete Makefile.in.in
from the gnulib directory. Don't require a shell when invoking wget.
After invoking wget, restore the current directory.

ChangeLog
gnulib-tool.py
gnulib-tool.py.TODO
pygnulib/GLEmiter.py
pygnulib/GLImport.py

index 16d17a6232fd025e636000208d6975057e55d63a..fde81debeab2ae0caa788fa60f73e1a811302e21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2022-08-05  Bruno Haible  <bruno@clisp.org>
 
+       gnulib-tool.py: Finish implementing option --po-domain.
+       * gnulib-tool.py (main): Accept option --po-domain.
+       * pygnulib/GLEmiter.py (GLEmiter.po_POTFILES_in): Fix variable
+       reference.
+       * pygnulib/GLImport.py (GLImport.execute): Don't delete Makefile.in.in
+       from the gnulib directory. Don't require a shell when invoking wget.
+       After invoking wget, restore the current directory.
+
        gnulib-tool.py: Finish implementing option --macro-prefix.
        * gnulib-tool.py (main): Accept option --macro-prefix.
 
index 030e3caf733ae8bea82d6bd11009b05a1e819f11..8dbf2d06a8a4ce71c3adaf1d0efefdacc0feed44 100755 (executable)
@@ -379,6 +379,11 @@ def main():
                         dest='macro_prefix',
                         default=None,
                         nargs=1)
+    # po-domain
+    parser.add_argument('--po-domain',
+                        dest='podomain',
+                        default=None,
+                        nargs=1)
     # single-configure
     parser.add_argument('--single-configure',
                         dest='single_configure',
@@ -565,13 +570,23 @@ def main():
                  or cmdargs.excl_unportable_tests != None
                  or cmdargs.avoids != None or cmdargs.lgpl != None
                  or cmdargs.makefile_name != None
-                 or cmdargs.macro_prefix != None))):
+                 or cmdargs.macro_prefix != None or cmdargs.podomain != None))):
         message = '%s: *** ' % constants.APP['name']
         message += 'invalid options for --%s mode\n' % mode
         message += 'Try \'gnulib-tool --help\' for more information.\n'
         message += '%s: *** Stop.\n' % constants.APP['name']
         sys.stderr.write(message)
         sys.exit(1)
+    if cmdargs.pobase != None and cmdargs.podomain == None:
+        message = '%s: *** ' % constants.APP['name']
+        message += 'together with --po-base, you need to specify --po-domain\n'
+        message += 'Try \'gnulib-tool --help\' for more information.\n'
+        message += '%s: *** Stop.\n' % constants.APP['name']
+        sys.stderr.write(message)
+        sys.exit(1)
+    if cmdargs.pobase == None and cmdargs.podomain != None:
+        message = '%s: warning: --po-domain has no effect without a --po-base option\n' % constants.APP['name']
+        sys.stderr.write(message)
 
     # Determine specific settings.
     destdir = cmdargs.destdir
@@ -645,6 +660,9 @@ def main():
     macro_prefix = cmdargs.macro_prefix
     if macro_prefix != None:
         macro_prefix = macro_prefix[0]
+    podomain = cmdargs.podomain
+    if podomain != None:
+        podomain = podomain[0]
     avoids = cmdargs.avoids
     if avoids != None:
         avoids = [ module
index 87438c5a16c2d851c24c8222cd87a581886f5f2a..b59e89cc59ca4ee6c97e1e026ef89dec39cae342 100644 (file)
@@ -29,7 +29,6 @@ Implement the options:
   --gnu-make
   --tests-makefile-name
   --automake-subdir
-  --po-domain
   --witness-c-macro
   --vc-files
   --no-vc-files
index 9d9ca458eed9af69d41bcd3eaf62759a74066703..b6c31fa603d21f04ea1a4c3a719fff8068985262 100644 (file)
@@ -444,8 +444,7 @@ USE_MSGCTXT = no\n"""
         Emit the file list to be passed to xgettext.
         GLConfig: sourcebase.'''
         emit = ''
-        sourcebase = self.config['sourcebase']
-        sourcebase = '%s%s' % (self.sourcebase, os.path.sep)
+        sourcebase = self.config['sourcebase'] + os.path.sep
         files = [ constants.substart('lib/', sourcebase, file)
                   for file in files ]
         files = [ file
index dda10c1b76bb16d257a25231b9f999b6679f3e51..9de4b3b93cde1043674f1697e50fdd76aabfbaab 100644 (file)
@@ -42,10 +42,12 @@ __copyright__ = constants.__copyright__
 #===============================================================================
 # Define global constants
 #===============================================================================
+DIRS = constants.DIRS
 MODES = constants.MODES
 TESTS = constants.TESTS
 joinpath = constants.joinpath
 cleaner = constants.cleaner
+copyfile = constants.copyfile
 copyfile2 = constants.copyfile2
 movefile = constants.movefile
 isabs = os.path.isabs
@@ -1161,7 +1163,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
                 tmpfile = self.assistant.tmpfilename(joinpath(pobase, file))
                 path = joinpath('build-aux', 'po', file)
                 lookedup, flag = filesystem.lookup(path)
-                movefile(lookedup, tmpfile)
+                copyfile(lookedup, tmpfile)
                 basename = joinpath(pobase, file)
                 filename, backup, flag = self.assistant.super_update(basename, tmpfile)
                 if flag == 1:
@@ -1227,7 +1229,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
                 os.chdir(joinpath(destdir, pobase))
                 args = ['wget', '--no-verbose', '--mirror', '--level=1', '-nd', '-A.po', '-P', '.',
                         '%sgnulib/' % TP_URL]
-                sp.call(args, shell=True)
+                sp.call(args)
+                os.chdir(DIRS['cwd'])
             else:  # if self.config['dryrun']
                 print('Fetch gnulib PO files from %s' % TP_URL)
 
@@ -1236,8 +1239,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
             if not self.config['dryrun']:
                 tmpfile = self.assistant.tmpfilename(basename)
                 data = '# Set of available languages.\n'
-                files = [constants.subend('.po', '', file)
-                         for file in os.listdir(joinpath(destdir, pobase))]
+                files = [ constants.subend('.po', '', file)
+                          for file in os.listdir(joinpath(destdir, pobase)) ]
                 data += '\n'.join(files)
                 with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
                     file.write(data)