]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: fix errors on building wget2; use UTF-8 in subprocess
authorDmitry Selyutin <ghostmansd@gmail.com>
Tue, 5 Sep 2017 07:04:18 +0000 (10:04 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 5 Sep 2017 20:16:10 +0000 (23:16 +0300)
gnulib-tool.py [changed mode: 0644->0755]
pygnulib/GLEmiter.py
pygnulib/GLFileSystem.py
pygnulib/GLInfo.py
pygnulib/GLModuleSystem.py
pygnulib/GLTestDir.py

old mode 100644 (file)
new mode 100755 (executable)
index 8137ea3..d76901d
@@ -118,7 +118,7 @@ def main():
   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 @@ def main():
     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 @@ def main():
     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 @@ def main():
     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 @@ def main():
         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 @@ def main():
 if __name__ == '__main__':
   try: # Try to execute
     main()
+  except:
+    raise
   except BaseException as error:
     errmode = 0 # gnulib-style errors
     errno = error.errno
index 3a6ee00980a68ce42a5165efc6437fcfb9e7163a..3895f4d514401048653812f702b2f87ead1adfac 100644 (file)
@@ -172,7 +172,7 @@ class GLEmiter(object):
           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')
index 6ccdc0b7edbd7674d247643226d073ade24aef74..588df95ceaa9612db27c5e4d706e55a2788fc774 100644 (file)
@@ -302,7 +302,7 @@ class GLFileAssistant(object):
           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 @@ class GLFileAssistant(object):
       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:
index dd6b2675c4b8a4ea023941d7d7eb6123ce0aead8..646b20cf6593787e69d830b06ba4f24fcdae33ae 100644 (file)
@@ -97,7 +97,7 @@ class GLInfo(object):
       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 @@ class GLInfo(object):
       # 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 @@ Report bugs to <bug-gnulib@gnu.org>.'''
     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()
index 53fe0a2712041effce0418b181cf4437afbfc573..34501e20e2bcfaba2762fa09405aeb3cc6cf3a1c 100644 (file)
@@ -151,13 +151,13 @@ class GLModuleSystem(object):
     # 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 @@ class GLModuleSystem(object):
     # 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))
index 8652d1ffc3a24671361b0226d2ffc162e9dc4bdb..58663eab00264b8a5bd5005ca42bbb0bf4d841fb 100644 (file)
@@ -903,7 +903,7 @@ class GLMegaTestDir(object):
       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])