Remove version from readme, (replace on install)
authorCampbell Barton <ideasman42@gmail.com>
Thu, 12 Mar 2015 11:14:48 +0000 (22:14 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 12 Mar 2015 12:52:48 +0000 (23:52 +1100)
SConstruct
release/text/readme.html
source/creator/CMakeLists.txt

index 29e22cb32a761d43303e4d047c749b507303a8c7..7305edfe036296098e323478d010c9d85ac32576 100644 (file)
@@ -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']:
index e2320f9d0f8f85985d86c786e1ea25b305ee7671..66bf188a42e9f89006a2b1c237bf7a84c998b3ea 100644 (file)
   </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>
index f51b7bec7c9072aa4fa55b2d1eb785f59ec0c04d..57e67a971d35ed589045c0f367913993b26a8a72 100644 (file)
@@ -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)
 
 
 # -----------------------------------------------------------------------------