[Libreoffice-commits] core.git: solenv/bin

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 3 09:28:47 UTC 2020


 solenv/bin/gentoken.py |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 0d4aa17ee7b6a02100dc2b10c328dc6be4f184cf
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Mar 3 09:27:15 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Mar 3 10:28:14 2020 +0100

    Make sure gentoken.py always writes a file with Unix-style line ends
    
    ...in a way that hopefully works for each of our "any Python >= 2.7 used during
    the build" scenarios (thanks to vmiklos for suggesting the actual changes to
    gentoken.py).  This is a necessary prerequisite for
    <https://gerrit.libreoffice.org/c/core/+/89828> "Fix call of Python", which
    would otherwise on Windows generate *.gperf files with DOS-style line ends, but
    where the Cygwin gperf expects them to have Unix-style line ends and fails with
    
    > C:/cygwin/home/tdf/lode/jenkins/workspace/gerrit_windows/workdir/CustomTarget/editeng/generated/tokens.gperf:9: warning: junk after %% is ignored
    > unsupported language option C++
    > , defaulting to ANSI-C
    > C:/cygwin/home/tdf/lode/jenkins/workspace/gerrit_windows/workdir/CustomTarget/editeng/generated/tokens.gperf:2: junk after declaration
    > make[1]: *** [C:/cygwin/home/tdf/lode/jenkins/workspace/gerrit_windows/editeng/CustomTarget_generated.mk:22: C:/cygwin/home/tdf/lode/jenkins/workspace/gerrit_windows/workdir/CustomTarget/editeng/generated/tokens.cxx] Error 1
    
    (<https://ci.libreoffice.org/job/gerrit_windows/58956/console>)
    
    Change-Id: I0cc420e4f8342225bd01ee326b1e517fdc57005e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89865
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/solenv/bin/gentoken.py b/solenv/bin/gentoken.py
index 55438a1be040..f85aec2cce3e 100755
--- a/solenv/bin/gentoken.py
+++ b/solenv/bin/gentoken.py
@@ -44,12 +44,12 @@ with open(token_input_file) as ifile:
             token = token.replace("+", "PLUS")
             tokens[line] = token.upper()
 
-with open(gperf_output_file, "w") as gperf:
-    gperf.write(gperf_header)
+with open(gperf_output_file, "wb") as gperf:
+    gperf.write(gperf_header.encode("utf-8"))
 
     for token in sorted(tokens.keys()):
-        gperf.write("{},{}\n".format(token, tokens[token]))
+        gperf.write("{},{}\n".format(token, tokens[token]).encode("utf-8"))
 
-    gperf.write("%%\n")
+    gperf.write("%%\n".encode("utf-8"))
 
 # vim: set noet sw=4 ts=4:


More information about the Libreoffice-commits mailing list