mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Remove the need for perl if creating doc
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38791 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ddc585317c
commit
cf52bab933
@ -561,9 +561,9 @@ add_subdirectory(lib/scripts "${TOP_BINARY_DIR}/scripts")
|
||||
|
||||
|
||||
if(LYX_INSTALL)
|
||||
FIND_PROGRAM(LYX_PERL_EXECUTABLE perl)
|
||||
if(${LYX_PERL_EXECUTABLE} MATCHES "-NOTFOUND")
|
||||
message(STATUS "Perl required to create doc!")
|
||||
#FIND_PROGRAM(LYX_PERL_EXECUTABLE perl)
|
||||
if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
|
||||
message(STATUS "Python required to create doc!")
|
||||
else()
|
||||
add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
|
||||
add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc")
|
||||
|
@ -29,8 +29,8 @@ foreach(_rel_doc ${_rel_lyx_docs})
|
||||
SET_SOURCE_FILES_PROPERTIES(${_created_doc} GENERATED)
|
||||
add_custom_command(
|
||||
OUTPUT "${_created_doc}"
|
||||
COMMAND perl "${TOP_SRC_DIR}/development/cmake/doc/ReplaceValues.pl" "LYX_USERDIR_VER=${LYX_USERDIR_VER}" "LYX_DIR_VER=${LYX_DIR_VER}" "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" > "${_created_doc}"
|
||||
DEPENDS "${TOP_SRC_DIR}/lib/doc/${_rel_doc}"
|
||||
COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_SRC_DIR}/development/cmake/doc/ReplaceValues.py" "LYX_USERDIR_VER=${LYX_USERDIR_VER}" "LYX_DIR_VER=${LYX_DIR_VER}" "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" > "${_created_doc}"
|
||||
DEPENDS "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" "${TOP_SRC_DIR}/development/cmake/doc/ReplaceValues.py"
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}" DESTINATION "${LYX_DATA_SUBDIR}doc/${_rel_dir_part}")
|
||||
LIST(APPEND _docs "${_created_doc}")
|
||||
|
45
development/cmake/doc/ReplaceValues.py
Executable file
45
development/cmake/doc/ReplaceValues.py
Executable file
@ -0,0 +1,45 @@
|
||||
#! /usr/bin/env python
|
||||
import sys
|
||||
import re
|
||||
|
||||
Subst = {} # map of desired substitutions
|
||||
prog = re.compile("")
|
||||
|
||||
def createProg():
|
||||
matchingS = "\\b|\\b".join(Subst.keys())
|
||||
pattern = "".join(["(.*)(\\b", matchingS, "\\b)(.*)"])
|
||||
return re.compile(pattern)
|
||||
|
||||
def SubstituteDataInLine(line):
|
||||
result = line
|
||||
m = prog.match(result)
|
||||
if m:
|
||||
return "".join([SubstituteDataInLine(m.group(1)),
|
||||
Subst[m.group(2)],
|
||||
SubstituteDataInLine(m.group(3))])
|
||||
return line
|
||||
|
||||
|
||||
def SubstituteDataInFile(InFile):
|
||||
for line in open(InFile):
|
||||
print SubstituteDataInLine(line[:-1])
|
||||
|
||||
##########################################
|
||||
|
||||
|
||||
args = sys.argv
|
||||
|
||||
del args[0] # we don't need the name ot this script
|
||||
while len(args) > 0:
|
||||
arg = args[0]
|
||||
entry = args[0].split("=",1)
|
||||
if len(entry) == 2:
|
||||
key=entry[0]
|
||||
val=entry[1]
|
||||
if len(key) > 0:
|
||||
Subst[key] = val
|
||||
else:
|
||||
prog = createProg()
|
||||
SubstituteDataInFile(args[0])
|
||||
del args[0]
|
||||
|
Loading…
Reference in New Issue
Block a user