[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35012] trunk/blender: Move blender version info into BKE_blender. h so we only have the info in one place and so package building scripts can extract it in a more usable way .
Campbell Barton
ideasman42 at gmail.com
Mon Feb 21 05:45:47 CET 2011
Revision: 35012
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35012
Author: campbellbarton
Date: 2011-02-21 04:45:47 +0000 (Mon, 21 Feb 2011)
Log Message:
-----------
Move blender version info into BKE_blender.h so we only have the info in one place and so package building scripts can extract it in a more usable way.
this also means we can have a version string like '2.56a-beta' without using buildinfo.
release/VERSION was only used by scons, NSIS installer.
Possibly helps to fix bug [#26062] too.
Modified Paths:
--------------
trunk/blender/build_files/scons/tools/btools.py
trunk/blender/source/blender/blenkernel/BKE_blender.h
Removed Paths:
-------------
trunk/blender/release/VERSION
Modified: trunk/blender/build_files/scons/tools/btools.py
===================================================================
--- trunk/blender/build_files/scons/tools/btools.py 2011-02-21 02:45:13 UTC (rev 35011)
+++ trunk/blender/build_files/scons/tools/btools.py 2011-02-21 04:45:47 UTC (rev 35012)
@@ -16,15 +16,51 @@
BoolVariable = SCons.Variables.BoolVariable
def get_version():
+ import re
+
fname = os.path.join(os.path.dirname(__file__), "..", "..", "..", "source", "blender", "blenkernel", "BKE_blender.h")
+ ver_base = None
+ ver_char = None
+ ver_cycle = None
+
+ re_ver = re.compile("^#\s*define\s+BLENDER_VERSION\s+([0-9]+)")
+ re_ver_char = re.compile("^#\s*define\s+BLENDER_VERSION_CHAR\s*(\S*)") # optional arg
+ re_ver_cycle = re.compile("^#\s*define\s+BLENDER_VERSION_CYCLE\s*(\S*)") # optional arg
+
for l in open(fname, "r"):
- if "BLENDER_VERSION" in l:
- ver = int(l.split()[-1])
- return "%d.%d" % (ver / 100, ver % 100)
+ match = re_ver.match(l)
+ if match:
+ ver = int(match.group(1))
+ ver_base = "%d.%d" % (ver / 100, ver % 100)
+
+ match = re_ver_char.match(l)
+ if match:
+ ver_char = match.group(1)
+ if ver_char == "BLENDER_CHAR_VERSION":
+ ver_char = ""
+
+ match = re_ver_cycle.match(l)
+ if match:
+ ver_cycle = match.group(1)
+ if ver_cycle == "BLENDER_CYCLE_VERSION":
+ ver_cycle = ""
+
+ if (ver_base is not None) and (ver_char is not None) and (ver_cycle is not None):
+ # eg '2.56a-beta'
+ if ver_cycle:
+ ver_display = "%s%s-%s" % (ver_base, ver_char, ver_cycle)
+ else:
+ ver_display = "%s%s" % (ver_base, ver_char) # assume release
+
+ return ver_base, ver_display
+
raise Exception("%s: missing version string" % fname)
-VERSION = get_version() # This is used in creating the local config directories
+# This is used in creating the local config directories
+VERSION, VERSION_DISPLAY = get_version()
+
+
def print_arguments(args, bc):
if len(args):
for k,v in args.iteritems():
@@ -92,7 +128,7 @@
'WITH_BF_RAYOPTIMIZATION',
'BF_RAYOPTIMIZATION_SSE_FLAGS',
'BF_NO_ELBEEM',
- 'WITH_BF_CXX_GUARDEDALLOC'
+ 'WITH_BF_CXX_GUARDEDALLOC'
]
# Have options here that scons expects to be lists
@@ -502,11 +538,6 @@
for f in df:
outfile = os.path.join(dp,f)
datafiles += ' File '+outfile + "\n"
-
- os.chdir("release")
- v = open("VERSION")
- version = v.read()[:-1]
- v.close()
#### change to suit install dir ####
inst_dir = install_base_dir + env['BF_INSTALLDIR']
@@ -520,7 +551,7 @@
# var replacements
ns_cnt = string.replace(ns_cnt, "[DISTDIR]", os.path.normpath(inst_dir+os.sep))
- ns_cnt = string.replace(ns_cnt, "[VERSION]", version)
+ ns_cnt = string.replace(ns_cnt, "[VERSION]", VERSION_DISPLAY)
ns_cnt = string.replace(ns_cnt, "[SHORTVERSION]", VERSION)
ns_cnt = string.replace(ns_cnt, "[RELDIR]", os.path.normpath(rel_dir))
ns_cnt = string.replace(ns_cnt, "[BITNESS]", bitness)
Deleted: trunk/blender/release/VERSION
===================================================================
--- trunk/blender/release/VERSION 2011-02-21 02:45:13 UTC (rev 35011)
+++ trunk/blender/release/VERSION 2011-02-21 04:45:47 UTC (rev 35012)
@@ -1 +0,0 @@
-2.56a-beta
Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h 2011-02-21 02:45:13 UTC (rev 35011)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h 2011-02-21 04:45:47 UTC (rev 35012)
@@ -40,6 +40,21 @@
extern "C" {
#endif
+/* these lines are grep'd, watch out for our not-so-awesome regex
+ * and keep comment above the defines.
+ * Use STRINGIFY() rather then defining with quotes */
+#define BLENDER_VERSION 256
+#define BLENDER_SUBVERSION 1
+
+#define BLENDER_MINVERSION 250
+#define BLENDER_MINSUBVERSION 0
+
+/* used by packaging tools */
+ /* can be left blank, otherwise a,b,c... etc with no quotes */
+#define BLENDER_VERSION_CHAR a
+ /* alpha/beta/rc/releases */
+#define BLENDER_VERSION_CYCLE beta
+
struct ListBase;
struct MemFile;
struct bContext;
@@ -47,12 +62,6 @@
struct Scene;
struct Main;
-#define BLENDER_VERSION 256
-#define BLENDER_SUBVERSION 1
-
-#define BLENDER_MINVERSION 250
-#define BLENDER_MINSUBVERSION 0
-
int BKE_read_file(struct bContext *C, const char *filepath, struct ReportList *reports);
#define BKE_READ_FILE_FAIL 0 /* no load */
More information about the Bf-blender-cvs
mailing list