Kornel,
while investigating the .po file line end problem I noticed that the .pot
file generation with cmake does first write windows line ends and then a
converter is called to create unix line ends.
I would like to simplify this in 2.3-staging (see attached). OK?
Georg
diff --git a/development/Makefile.am b/development/Makefile.am
index 43ca808..796e964 100644
--- a/development/Makefile.am
+++ b/development/Makefile.am
@@ -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 \
diff --git a/development/cmake/po/cat.py b/development/cmake/po/cat.py
index 02655dc..7a1ee26 100644
--- a/development/cmake/po/cat.py
+++ b/development/cmake/po/cat.py
@@ -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()
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 4d70d24..3f2f9ad 100755
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -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}