[Bf-blender-cvs] [2814039] master: Remove version from readme, (replace on install)

Campbell Barton noreply at git.blender.org
Thu Mar 12 13:55:17 CET 2015


Commit: 2814039ee3e86105eb3dd978bc715b204407f91e
Author: Campbell Barton
Date:   Thu Mar 12 22:14:48 2015 +1100
Branches: master
https://developer.blender.org/rB2814039ee3e86105eb3dd978bc715b204407f91e

Remove version from readme, (replace on install)

===================================================================

M	SConstruct
M	release/text/readme.html
M	source/creator/CMakeLists.txt

===================================================================

diff --git a/SConstruct b/SConstruct
index 29e22cb..7305edf 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1167,9 +1167,37 @@ if env['OURPLATFORM']=='linuxcross':
 textlist = []
 texttargetlist = []
 for tp, tn, tf in os.walk('release/text'):
+    tf.remove("readme.html")
     for f in tf:
         textlist.append(tp+os.sep+f)
 
+def readme_version_patch():
+    readme_src = "release/text/readme.html"
+    readme_dst = os.path.abspath(os.path.normpath(os.path.join(env['BF_BUILDDIR'], "readme.html")))
+
+    if not os.path.exists(readme_dst) or (os.path.getmtime(readme_dst) < os.path.getmtime(readme_src)):
+        f = open(readme_src, "r")
+        data = f.read()
+        f.close()
+
+        data = data.replace("BLENDER_VERSION", VERSION)
+        f = open(readme_dst, "w")
+        f.write(data)
+        f.close()
+
+    textlist.append(readme_dst)
+
+readme_version_patch()
+del readme_version_patch
+
+
+'''Command(
+    "release/text/readme.html"
+
+    )
+Command("file.out", "file.in", Copy(env['BF_INSTALLDIR'], "release/text/readme.html"))
+'''
+
 # Font licenses
 textlist.append('release/datafiles/LICENSE-bfont.ttf.txt')
 if env['WITH_BF_INTERNATIONAL']:
diff --git a/release/text/readme.html b/release/text/readme.html
index e2320f9..66bf188 100644
--- a/release/text/readme.html
+++ b/release/text/readme.html
@@ -18,15 +18,15 @@
   </style>
 </head>
 <body>
-<p class="p1"><b>Blender 2.74</b></p>
+<p class="p1"><b>Blender BLENDER_VERSION</b></p>
 <p class="p2"><br></p>
 <p class="p3"><b>About</b></p>
 <p class="p4">Welcome to Blender, the free, open source 3D application for modeling, animation, rendering, compositing, video editing and game creation. Blender is available for Linux, Mac OS X and Windows and has a large world-wide community.</p>
 <p class="p4">Blender can be used freely for any purpose, including commercial use and distribution. It's free and open-source software, released under the GNU GPL licence. The entire source code is available on our website.</p>
 <p class="p4">For more information, visit <a href="http://www.blender.org/"><span class="s1">blender.org</span></a>.</p>
 <p class="p2"><br></p>
-<p class="p3"><b>2.74</b></p>
-<p class="p4">The Blender Foundation and online developer community is proud to present Blender 2.74. This release is the fourth official stable release of the Blender 2.7 series. <a href="http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.74"><span class="s1">More information about this release</span></a>.</p>
+<p class="p3"><b>BLENDER_VERSION</b></p>
+<p class="p4">The Blender Foundation and online developer community is proud to present Blender BLENDER_VERSION. This release is the fourth official stable release of the Blender 2.7 series. <a href="http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/BLENDER_VERSION"><span class="s1">More information about this release</span></a>.</p>
 <p class="p2"><br></p>
 <p class="p3"><b>Bugs</b></p>
 <p class="p4">Although this is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help <span class="s2">→</span> Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
@@ -53,7 +53,7 @@
 <p class="p3"><b>Links</b></p>
 <p class="p4">Users:</p>
 <p class="p5"><span class="s3">General information <a href="http://www.blender.org/"><span class="s4">www.blender.org</span></a> <br>
-Full release log <a href="http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.74"><span class="s4">wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.74</span></a><br>
+Full release log <a href="http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/BLENDER_VERSION"><span class="s4">wiki.blender.org/index.php/Dev:Ref/Release_Notes/BLENDER_VERSION</span></a><br>
 Tutorials <a href="http://www.blender.org/support/tutorials/"><span class="s4">www.blender.org/support/tutorials/</span></a> <br>
 Manual <a href="http://www.blender.org/manual"><span class="s4">www.blender.org/manual</span></a><br>
 User Forum <a href="http://www.blenderartists.org/"><span class="s4">www.blenderartists.org</span></a><br>
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index f51b7be..57e67a9 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -241,6 +241,21 @@ endif()
 
 # Post build steps for bundling/packaging.
 
+function(install_text_files_patch path)
+	install(
+		CODE
+		"
+		set(DATA_FILE \"${path}/readme.html\")
+		file(READ \"\${DATA_FILE}\" DATA_SRC)
+		string(REGEX REPLACE \"BLENDER_VERSION\" \"${BLENDER_VERSION}\" DATA_DST \"\${DATA_SRC}\")
+		file(WRITE \"\${DATA_FILE}\" \"\${DATA_DST}\")
+		unset(DATA_FILE)
+		unset(DATA_SRC)
+		unset(DATA_DST)
+		"
+	)
+endfunction()
+
 set(BLENDER_TEXT_FILES
 	${CMAKE_SOURCE_DIR}/release/text/GPL-license.txt
 	${CMAKE_SOURCE_DIR}/release/text/Python-license.txt
@@ -436,10 +451,7 @@ if(UNIX AND NOT APPLE)
 			DESTINATION "."
 		)
 
-		install(
-			FILES ${BLENDER_TEXT_FILES}
-			DESTINATION "."
-		)
+		set(BLENDER_TEXT_FILES_DESTINATION ".")
 
 	else()
 		# main blender binary
@@ -486,10 +498,7 @@ if(UNIX AND NOT APPLE)
 			PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
 			DESTINATION bin
 		)
-		install(
-			FILES ${BLENDER_TEXT_FILES}
-			DESTINATION share/doc/blender
-		)
+		set(BLENDER_TEXT_FILES_DESTINATION share/doc/blender)
 	endif()
 
 	if(WITH_PYTHON)
@@ -602,10 +611,7 @@ if(UNIX AND NOT APPLE)
 	endif()
 elseif(WIN32)
 
-	install(
-		FILES ${BLENDER_TEXT_FILES}
-		DESTINATION "."
-	)
+	set(BLENDER_TEXT_FILES_DESTINATION ".")
 
 	if(WITH_PYTHON)
 		string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
@@ -847,10 +853,7 @@ elseif(APPLE)
 	)
 
 	# install release and app files
-	install(
-		FILES ${BLENDER_TEXT_FILES}
-		DESTINATION blender.app/Contents
-	)
+	set(BLENDER_TEXT_FILES_DESTINATION blender.app/Contents)
 
 	install(
 		FILES ${OSX_APP_SOURCEDIR}/Contents/PkgInfo
@@ -968,12 +971,20 @@ endif()
 # -----------------------------------------------------------------------------
 # Generic Install, for all targets
 
+if(DEFINED BLENDER_TEXT_FILES_DESTINATION)
+	install(
+		FILES ${BLENDER_TEXT_FILES}
+		DESTINATION "${BLENDER_TEXT_FILES_DESTINATION}"
+	)
 
+	install_text_files_patch("\${CMAKE_INSTALL_PREFIX}/${BLENDER_TEXT_FILES_DESTINATION}")
+endif()
 
 # install more files specified elsewhere
 delayed_do_install(${TARGETDIR_VER})
 
 unset(BLENDER_TEXT_FILES)
+unset(BLENDER_TEXT_FILES_DESTINATION)
 
 
 # -----------------------------------------------------------------------------




More information about the Bf-blender-cvs mailing list