changeset 19133:24e302467db0

gnulib-tool.py: fix errors on building wget2; use UTF-8 in subprocess
author Dmitry Selyutin <ghostmansd@gmail.com>
date Tue, 05 Sep 2017 10:04:18 +0300
parents 63d86d9e3f96
children 794612159e29
files gnulib-tool.py pygnulib/GLEmiter.py pygnulib/GLFileSystem.py pygnulib/GLInfo.py pygnulib/GLModuleSystem.py pygnulib/GLTestDir.py
diffstat 6 files changed, 30 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/gnulib-tool.py	Mon Aug 21 21:40:46 2017 +0300
+++ b/gnulib-tool.py	Tue Sep 05 10:04:18 2017 +0300
@@ -118,7 +118,7 @@
   parser.add_argument('-i', '--import',
     dest='mode_import',
     default=None,
-    nargs='+')
+    nargs='*')
   # add-import
   parser.add_argument('-a', '--add-import',
     dest='mode_add_import',
@@ -213,6 +213,11 @@
     dest='mode_xmaintainer',
     default=None,
     nargs='*')
+  # no-changelog
+  parser.add_argument('--no-changelog',
+    dest='changelog',
+    default=None,
+    action='store_false')
   # destdir
   parser.add_argument('-d', '--destdir',
     dest='destdir',
@@ -241,6 +246,11 @@
     dest='inctests',
     default=None,
     action='store_true')
+  # makefile
+  parser.add_argument("--makefile-name",
+    dest="makefile",
+    default=None,
+    type=str)
   # obsolete
   parser.add_argument('--with-obsolete',
     dest='obsolete',
@@ -281,6 +291,11 @@
     dest='libname',
     default=None,
     nargs=1)
+  # libtool
+  parser.add_argument("--libtool",
+    dest=libtool,
+    default=False,
+    action="store_true")
   # sourcebase
   parser.add_argument('-sb', '--source-base',
     dest='sourcebase',
@@ -489,6 +504,8 @@
         elif index == 6:
           testflags += [constants.TESTS['all-tests']]
   lgpl = cmdargs.lgpl
+  libtool = cmdargs.libtool
+  makefile = cmdargs.makefile
   if lgpl == None:
     lgpl = True
   avoids = cmdargs.avoids
@@ -922,6 +939,8 @@
 if __name__ == '__main__':
   try: # Try to execute
     main()
+  except:
+    raise
   except BaseException as error:
     errmode = 0 # gnulib-style errors
     errno = error.errno
--- a/pygnulib/GLEmiter.py	Mon Aug 21 21:40:46 2017 +0300
+++ b/pygnulib/GLEmiter.py	Tue Sep 05 10:04:18 2017 +0300
@@ -172,7 +172,7 @@
           file.write(snippet)
         stdin = codecs.open(path, 'rb', 'UTF-8')
         snippet = sp.check_output(args, stdin=stdin, shell=False)
-        snippet = snippet.decode(ENCS['shell'])
+        snippet = snippet.decode("UTF-8")
         os.remove(path)
       if disable_libtool:
         snippet = snippet.replace('$gl_cond_libtool', 'false')
--- a/pygnulib/GLFileSystem.py	Mon Aug 21 21:40:46 2017 +0300
+++ b/pygnulib/GLFileSystem.py	Tue Sep 05 10:04:18 2017 +0300
@@ -302,7 +302,7 @@
           try: # Try to move file
             if os.path.exists(basepath):
               os.remove(basepath)
-            shutil.move(tmpfile, rewritten)
+            shutil.copy(tmpfile, rewritten)
           except Exception as error:
             raise(GLError(17, original))
       else: # if self.config['dryrun']
@@ -352,7 +352,7 @@
       stdin = codecs.open(lookedup, 'rb', 'UTF-8')
       try: # Try to transform file
         data = sp.check_output(args, stdin=stdin, shell=False)
-        data = data.decode(ENCS['shell'])
+        data = data.decode("UTF-8")
       except Exception as error:
         raise(GLError(16, lookedup))
       with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
--- a/pygnulib/GLInfo.py	Mon Aug 21 21:40:46 2017 +0300
+++ b/pygnulib/GLInfo.py	Tue Sep 05 10:04:18 2017 +0300
@@ -97,7 +97,7 @@
       counter = int() # Create counter
       result = string() # Create string
       args = ['git', 'log']
-      result = sp.check_output(args).decode(ENCS['shell'])
+      result = sp.check_output(args).decode("UTF-8")
       # Get date as "Fri Mar 21 07:16:51 2008 -0600" from string
       pattern = re.compile('Date:[\t ]*(.*?)$', re.S | re.M)
       result = pattern.findall(result)[0]
@@ -107,7 +107,7 @@
       # Use GNU date to compute the time in GMT
       args = ['date', '-d', result, '-u', '+%Y-%m-%d %H:%M:%S']
       proc = sp.check_output(args)
-      result = string(proc, ENCS['shell'])
+      result = string(proc, "UTF-8")
       result = result.rstrip(os.linesep)
       return(result)
     
@@ -294,7 +294,7 @@
     if isdir(DIRS['git']):
       version_gen = joinpath(DIRS['build-aux'], 'git-version-gen')
       args = [version_gen, DIRS['root']]
-      result = sp.check_output(args).decode(ENCS['shell'])
+      result = sp.check_output(args).decode("UTF-8")
       result = result.strip()
       if result == 'UNKNOWN':
         result = string()
--- a/pygnulib/GLModuleSystem.py	Mon Aug 21 21:40:46 2017 +0300
+++ b/pygnulib/GLModuleSystem.py	Tue Sep 05 10:04:18 2017 +0300
@@ -151,13 +151,13 @@
     # Read modules from gnulib root directory.
     os.chdir(constants.DIRS['root'])
     find = sp.Popen(find_args, stdout=sp.PIPE)
-    result += find.stdout.read().decode(ENCS['shell'])
+    result += find.stdout.read().decode("UTF-8")
     
     # Read modules from local directory.
     if localdir and isdir(joinpath(localdir, 'modules')):
       os.chdir(localdir)
       find = sp.Popen(find_args, stdout=sp.PIPE)
-      result += find.stdout.read().decode(ENCS['shell'])
+      result += find.stdout.read().decode("UTF-8")
       sed_args += ['-e', r's,\.diff$,,']
     
     # Save the list of the modules to file.
@@ -169,7 +169,7 @@
     # Filter the list of the modules.
     stdin = codecs.open(path, 'rb', 'UTF-8')
     sed = sp.Popen(sed_args, stdin=stdin, stdout=sp.PIPE)
-    result = sed.stdout.read().decode(ENCS['shell'])
+    result = sed.stdout.read().decode("UTF-8")
     stdin.close(); os.remove(path)
     listing = [line for line in result.split('\n') if line.strip()]
     listing = sorted(set(listing))
--- a/pygnulib/GLTestDir.py	Mon Aug 21 21:40:46 2017 +0300
+++ b/pygnulib/GLTestDir.py	Tue Sep 05 10:04:18 2017 +0300
@@ -903,7 +903,7 @@
       vc_witness = joinpath(DIRS['root'], '.git', 'refs', 'heads', 'master')
     mdate_sh = joinpath(DIRS['root'], 'build-aux', 'mdate-sh')
     args = ['sh', mdate_sh, vc_witness]
-    cvsdate = sp.check_output(args).decode(ENCS['shell']).strip()
+    cvsdate = sp.check_output(args).decode("UTF-8").strip()
     for key in repdict:
       if len(key) > 3:
         cvsdate = cvsdate.replace(key, repdict[key])