solenv/bin/generate-tokens.py |   22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

New commits:
commit c9bb5c1396671a146da218f288cfd77913f7ae8a
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Apr 4 09:52:25 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Apr 4 11:17:29 2025 +0200

    drop python2 compat code in generate-tokens.py
    
    which should speed it up a little too
    
    Change-Id: I7d78108392f6dd7e319289c97957979fadaae796
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183697
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/solenv/bin/generate-tokens.py b/solenv/bin/generate-tokens.py
index 40b6b12aae9b..f1e01dc0d6db 100644
--- a/solenv/bin/generate-tokens.py
+++ b/solenv/bin/generate-tokens.py
@@ -23,9 +23,10 @@ idfile_out_name = sys.argv[2]
 namefile_out_name = sys.argv[3]
 gperffile_out_name = sys.argv[4]
 
-idfile = open(idfile_out_name, 'w')
-namefile = open(namefile_out_name, 'w')
-gperffile = open(gperffile_out_name, 'w')
+# Gperf requires LF newlines, not CRLF, even on Windows.
+idfile = open(idfile_out_name, 'w', newline = '
')
+namefile = open(namefile_out_name, 'w', newline = '
')
+gperffile = open(gperffile_out_name, 'w', newline = '
')
 
 gperffile.write("""%language=C++
 %global-table
@@ -64,18 +65,3 @@ gperffile.write("%%
")
 idfile.close()
 namefile.close()
 gperffile.close()
-
-def fix_linefeeds(fname):
-    # Gperf requires LF newlines, not CRLF, even on Windows.
-    # Making this work on both Python 2 and 3 is difficult.
-    # When Python 2 is dropped, delete this and add
-    # newline = '
' to the open() calls above.
-    with open(fname, 'rb') as ifile:
-        d = ifile.read()
-    d = d.replace(b' ', b'')
-    with open(fname, 'wb') as ofile:
-        ofile.write(d)
-
-fix_linefeeds(idfile_out_name)
-fix_linefeeds(namefile_out_name)
-fix_linefeeds(gperffile_out_name)

Reply via email to