From da46f6566a50c5ab2962952a9a813eca1be12e9e Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Wed, 11 Mar 2015 20:54:28 +0100 Subject: [PATCH] Preparation to support translations with python3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Thanks to José. --- development/cmake/doc/ReplaceValues.py | 4 +++- development/cmake/po/cat.py | 4 +++- development/cmake/po/dos2unix.py | 8 ++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/development/cmake/doc/ReplaceValues.py b/development/cmake/doc/ReplaceValues.py index a25972c59d..f07ce80bc9 100755 --- a/development/cmake/doc/ReplaceValues.py +++ b/development/cmake/doc/ReplaceValues.py @@ -1,5 +1,7 @@ #! /usr/bin/env python +from __future__ import print_function + # file ReplaceValues.py # # This file is part of LyX, the document processor. @@ -32,7 +34,7 @@ def SubstituteDataInLine(line): def SubstituteDataInFile(InFile): for line in open(InFile): - print SubstituteDataInLine(line[:-1]) + print(SubstituteDataInLine(line[:-1])) ########################################## diff --git a/development/cmake/po/cat.py b/development/cmake/po/cat.py index be8f4b2e90..02655dc564 100644 --- a/development/cmake/po/cat.py +++ b/development/cmake/po/cat.py @@ -1,5 +1,7 @@ #! /usr/bin/env python +from __future__ import print_function + import sys from getopt import getopt @@ -18,7 +20,7 @@ for (opt, param) in options: if opt == "-o": outfile = param elif opt == "-h": - print usage + print(usage) sys.exit(0) out = sys.stdout diff --git a/development/cmake/po/dos2unix.py b/development/cmake/po/dos2unix.py index 1ba822b4c6..a5b6431429 100644 --- a/development/cmake/po/dos2unix.py +++ b/development/cmake/po/dos2unix.py @@ -4,14 +4,14 @@ import sys for fname in sys.argv[1:]: - infile = open( fname, "rb" ) + infile = open( fname, "r" ) instr = infile.read() infile.close() outstr = instr.replace( "\r\n", "\n" ).replace( "\r", "\n" ) - if len(outstr) == len(instr): + if outstr == instr: continue - outfile = open( fname , "wb" ) + outfile = open( fname , "w" ) outfile.write( outstr ) - outfile.close() \ No newline at end of file + outfile.close() -- 2.39.2