mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Cmake tex2lyx tests: Take care of initialized userdir
If we are testing tex2lyx the first time, then the userdir is empty. We call now configure.py to initalize in case it is needed. The algorithm to detect if reconfigure is needed mimics the lyx behaviour.
This commit is contained in:
parent
2df6340c1c
commit
90717df577
@ -1,8 +1,8 @@
|
||||
# This file is part of LyX, the document processor.
|
||||
# Licence details can be found in the file COPYING.
|
||||
#
|
||||
# Copyright (c) 2013 Kornel Benko <kornel@lyx.org>
|
||||
# (c) 2013 Scott Kostyshak <skotysh@lyx.org>
|
||||
# Copyright (c) 2013-2014 Kornel Benko <kornel@lyx.org>
|
||||
# (c) 2013-2014 Scott Kostyshak <skotysh@lyx.org>
|
||||
#
|
||||
# Script should be called like:
|
||||
# COMMAND ${CMAKE_COMMAND} \
|
||||
@ -20,6 +20,46 @@
|
||||
set(ENV{${LYX_USERDIR_VER}} ${LYX_TESTS_USERDIR})
|
||||
message(STATUS "SCRIPT_DIR = ${SCRIPT_DIR}")
|
||||
|
||||
file(TIMESTAMP "${SCRIPT_DIR}/../configure.py" _config_time "%Y%j%H%M%S")
|
||||
set(_configure_needed FALSE)
|
||||
foreach(_f lyxrc.defaults lyxmodules.lst textclass.lst packages.lst)
|
||||
if(NOT EXISTS "${LYX_TESTS_USERDIR}/${_f}")
|
||||
message(STATUS "Configure needed, because \"${LYX_TESTS_USERDIR}/${_f}\" does not exist")
|
||||
set(_configure_needed TRUE)
|
||||
break()
|
||||
endif()
|
||||
file(TIMESTAMP "${LYX_TESTS_USERDIR}/${_f}" _ftime "%Y%j%H%M%S")
|
||||
if(_config_time STRGREATER _ftime)
|
||||
message(STATUS "Configure needed, because \"${LYX_TESTS_USERDIR}/${_f}\" too old")
|
||||
set(_configure_needed TRUE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(_configure_needed)
|
||||
# Determine suffix from ${TEX2LYX_EXE}
|
||||
if(TEX2LYX_EXE MATCHES ".*tex2lyx([0-9]\\.[0-9]).*")
|
||||
set(_suffix ${CMAKE_MATCH_1})
|
||||
else()
|
||||
set(_suffix "")
|
||||
endif()
|
||||
|
||||
if(_suffix STREQUAL "")
|
||||
set(_with_ver "")
|
||||
else()
|
||||
set(_with_ver "--with-version-suffix=${_suffix}")
|
||||
endif()
|
||||
|
||||
# Get binary directory of tex2lyx
|
||||
string(REGEX REPLACE "(.*)tex2lyx${_suffix}.*" "\\1" _bindir "${TEX2LYX_EXE}")
|
||||
|
||||
message(STATUS "executing ${LYX_PYTHON_EXECUTABLE} -tt \"${SCRIPT_DIR}/../configure.py\" ${_with_ver} \"--binary-dir=${_bindir}\"")
|
||||
execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE} -tt "${SCRIPT_DIR}/../configure.py"
|
||||
${_with_ver} "--binary-dir=${_bindir}"
|
||||
WORKING_DIRECTORY "${LYX_TESTS_USERDIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE} ${PY_SCRIPT} ${FIRST_PARAM}
|
||||
${TEX2LYX_EXE} ${SCRIPT_DIR} ${WORKDIR} ${TESTFILE}
|
||||
RESULT_VARIABLE _err
|
||||
|
Loading…
Reference in New Issue
Block a user