]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: follow gnulib-tool changes, part 14
authorBruno Haible <bruno@clisp.org>
Sat, 9 Sep 2017 12:40:10 +0000 (14:40 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 9 Sep 2017 15:28:03 +0000 (17:28 +0200)
Follow gnulib-tool change
2015-08-20  Daiki Ueno  <ueno@gnu.org>
gnulib-tool: don't transform binary files with sed

pygnulib/GLFileSystem.py

index 1e752068d44d991efab2baa89f7ba881c5e6e761..d5e253f9655459ae47a838cb1f6e4299d1882148 100644 (file)
@@ -341,26 +341,28 @@ class GLFileAssistant(object):
             shutil.copy(lookedup, tmpfile)
         except Exception as error:
             raise(GLError(15, lookedup))
-        transformer = string()
-        if original.startswith('lib/'):
-            if sed_transform_main_lib_file:
-                transformer = sed_transform_main_lib_file
-        elif original.startswith('build-aux/'):
-            if sed_transform_build_aux_file:
-                transformer = sed_transform_build_aux_file
-        elif original.startswith('tests=lib/'):
-            if sed_transform_testsrelated_lib_file:
-                transformer = sed_transform_testsrelated_lib_file
-        if transformer:
-            args = ['sed', '-e', transformer]
-            stdin = codecs.open(lookedup, 'rb', 'UTF-8')
-            try:  # Try to transform file
-                data = sp.check_output(args, stdin=stdin, shell=False)
-                data = data.decode("UTF-8")
-            except Exception as error:
-                raise(GLError(16, lookedup))
-            with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
-                file.write(data)
+        # Don't process binary files with sed.
+        if not (original.endswith(".class") or original.endswith(".mo")):
+            transformer = string()
+            if original.startswith('lib/'):
+                if sed_transform_main_lib_file:
+                    transformer = sed_transform_main_lib_file
+            elif original.startswith('build-aux/'):
+                if sed_transform_build_aux_file:
+                    transformer = sed_transform_build_aux_file
+            elif original.startswith('tests=lib/'):
+                if sed_transform_testsrelated_lib_file:
+                    transformer = sed_transform_testsrelated_lib_file
+            if transformer:
+                args = ['sed', '-e', transformer]
+                stdin = codecs.open(lookedup, 'rb', 'UTF-8')
+                try:  # Try to transform file
+                    data = sp.check_output(args, stdin=stdin, shell=False)
+                    data = data.decode("UTF-8")
+                except Exception as error:
+                    raise(GLError(16, lookedup))
+                with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
+                    file.write(data)
         path = joinpath(self.config['destdir'], rewritten)
         if isfile(path):
             self.update(lookedup, tmpflag, tmpfile, already_present)