forked from bartvdbraak/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.
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.
This commit is contained in:
parent
1e4c17a82f
commit
848d60caee
@ -16,14 +16,50 @@ Variables = SCons.Variables
|
||||
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):
|
||||
@ -92,7 +128,7 @@ def validate_arguments(args, bc):
|
||||
'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 @@ def NSIS_Installer(target=None, source=None, env=None):
|
||||
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 @@ def NSIS_Installer(target=None, source=None, env=None):
|
||||
|
||||
# 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)
|
||||
|
@ -1 +0,0 @@
|
||||
2.56a-beta
|
@ -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 ReportList;
|
||||
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user