summaryrefslogtreecommitdiff
path: root/pygnulib/GLFileSystem.py
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2017-09-09 14:40:10 +0200
committerBruno Haible <bruno@clisp.org>2017-09-09 17:28:03 +0200
commit07a187be7f66d3ced66587405f18205971c762e9 (patch)
treece07d3f46ca2c19a83953093f2f5337e9dbffd1d /pygnulib/GLFileSystem.py
parent2f0f4bea3c62b9c3c39cd3ec762564c8dc0c86da (diff)
downloadgnulib-07a187be7f66d3ced66587405f18205971c762e9.tar.gz
gnulib-tool.py: follow gnulib-tool changes, part 14
Follow gnulib-tool change 2015-08-20 Daiki Ueno <ueno@gnu.org> gnulib-tool: don't transform binary files with sed
Diffstat (limited to 'pygnulib/GLFileSystem.py')
-rw-r--r--pygnulib/GLFileSystem.py42
1 files changed, 22 insertions, 20 deletions
diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py
index 1e752068d4..d5e253f965 100644
--- a/pygnulib/GLFileSystem.py
+++ b/pygnulib/GLFileSystem.py
@@ -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)