Am Mittwoch, 18. Mai 2011 schrieb Uwe Stöhr:
> Am 17.05.2011 11:39, schrieb Kornel:
> >>> 3. I cannot disable the CMake component "DOC". It is annoying that the
> >>> compiler always stumbles over this component. I can of course delete it
> >>> from the solution file, but I fear that this will break something
> > 
> > You can, like it was already in lyx1.6. See attached cmake2.0.diff
> 
> thanks.
> Richard, can this go in please?
> 
> >> Perl for Windows could be found here:
> >> http://www.activestate.com/activeperl
> >> 
> >>> When I compile LyX's trunk, CMake doesn't have this DOC component.
> > 
> > Then you have not set LYX_INSTALL there?
> 
> I have set it there. I tried both, release and install build and in branch
> I always get the DOC component.
> 
> regards Uwe

This is my first python script, so bare with me ...

It should replace former perl script ReplaceValues.pl, so that there is no need 
for perl at least for the 'doc' handling.

        Kornel
Index: development/cmake/doc/ReplaceValues.py
===================================================================
--- development/cmake/doc/ReplaceValues.py	(Revision 0)
+++ development/cmake/doc/ReplaceValues.py	(Revision 0)
@@ -0,0 +1,47 @@
+#! /usr/bin/env python
+import sys
+import re
+
+Subst = {}  # map of desired substitutions
+prog = re.compile("")
+files = []  # files to process
+
+def SubstituteDataInLine(line):
+    result = line
+    for k in Subst.keys():
+        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:
+        files.append(args[0])
+    del args[0]
+
+matchingS = "\\b|\\b".join(Subst.keys())
+pattern = "".join(["(.*)(\\b", matchingS, "\\b)(.*)"])
+prog = re.compile(pattern)
+
+for InFile in files:
+    SubstituteDataInFile(InFile)

Eigenschaftsänderungen: development/cmake/doc/ReplaceValues.py
___________________________________________________________________
Hinzugefügt: svn:executable
   + *

Index: development/cmake/doc/CMakeLists.txt
===================================================================
--- development/cmake/doc/CMakeLists.txt	(Revision 38789)
+++ development/cmake/doc/CMakeLists.txt	(Arbeitskopie)
@@ -29,8 +29,8 @@
   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}")
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(Revision 38789)
+++ CMakeLists.txt	(Arbeitskopie)
@@ -561,9 +561,9 @@
 
 
 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")

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to