Simplify .po file generation

We can generate the file with the cirrect line endings directly instead of
calling a helper script to convert them.
This commit is contained in:
Georg Baum 2016-05-10 07:03:54 +02:00 committed by Richard Heck
parent 4002c6af72
commit 2d708bd7cf
4 changed files with 8 additions and 22 deletions

View File

@ -159,7 +159,6 @@ cmake/modules/PCHSupport_26.cmake \
cmake/modules/ProjectSourceGroup.cmake \
cmake/pcheaders.h \
cmake/po/cat.py \
cmake/po/dos2unix.py \
cmake/po/unix2dos.py \
cmake/post_install/CMakeLists.txt \
cmake/scripts/LyXCreateImagesResource.cmake \

View File

@ -25,11 +25,17 @@ for (opt, param) in options:
out = sys.stdout
if outfile:
out = open(outfile, "w")
# always write unix line endings, even on windows
out = open(outfile, "wb")
for f in args:
fil = open(f, "r")
# accept both windows and unix line endings, since it can happen that we
# are on unix, but the file has been written on windows or vice versa.
fil = open(f, "rU")
for l in fil:
# this does always write unix line endings since the file has
# been opened in binary mode. This is needed since both gettext
# and our .pot file manipulation scripts assume unix line ends.
out.write(l)
fil.close()

View File

@ -1,17 +0,0 @@
#! /usr/bin/env python
###############
import sys
for fname in sys.argv[1:]:
infile = open( fname, "r" )
instr = infile.read()
infile.close()
outstr = instr.replace( "\r\n", "\n" ).replace( "\r", "\n" )
if outstr == instr:
continue
outfile = open( fname , "w" )
outfile.write( outstr )
outfile.close()

View File

@ -90,8 +90,6 @@ ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
COMMAND ${LYX_PYTHON_EXECUTABLE}
ARGS "${TOP_CMAKE_PATH}/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat_tmp.pot"
COMMAND ${LYX_PYTHON_EXECUTABLE}
ARGS "${TOP_CMAKE_PATH}/po/dos2unix.py" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat_tmp.pot"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat_tmp.pot" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
DEPENDS ${_py_sources}