Blender: change bugfix release versioning from a/b/c to .1/.2/.3

The file subversion is no longer used in the Python API or user interface,
and is now internal to Blender.

User interface, Python API and file I/O metadata now use more consistent
formatting for version numbers. Official releases use "2.83.0", "2.83.1",
and releases under development use "2.90.0 Alpha", "2.90.0 Beta".

Some Python add-ons may need to lower the Blender version in bl_info to
(2, 83, 0) or (2, 90, 0) if they used a subversion number higher than 0.
https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Python_API#Compatibility

This change is in preparation of LTS releases, and also brings us more
in line with semantic versioning.

Fixes T76058.

Differential Revision: https://developer.blender.org/D7748
This commit is contained in:
Brecht Van Lommel 2020-05-25 10:49:04 +02:00 committed by Brecht Van Lommel
parent 1d2b89304a
commit a86b5df005
26 changed files with 114 additions and 183 deletions

@ -78,27 +78,26 @@ class VersionInfo:
blender_h = os.path.join(builder.blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h")
version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION'))
self.version = "%d.%d" % (version_number // 100, version_number % 100)
self.version_char = self._parse_header_file(blender_h, 'BLENDER_VERSION_CHAR')
version_number_patch = int(self._parse_header_file(blender_h, 'BLENDER_VERSION_PATCH'))
version_numbers = (version_number // 100, version_number % 100, version_number_patch)
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
if self.version_cycle == "release":
# Final release
self.full_version = self.version + self.version_char
self.full_version = self.version
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
version_cycle = self.version_cycle + self.version_cycle_number
if len(self.version_char) == 0:
self.full_version = self.version + version_cycle
else:
self.full_version = self.version + self.version_char + '-' + version_cycle
self.full_version = self.version + version_cycle
self.is_development_build = False
else:
# Development build
self.full_version = self.version + self.version_char + '-' + self.hash
self.full_version = self.version + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):

@ -167,7 +167,7 @@ def pack_linux(builder):
buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable])
print("Stripping python...")
py_target = os.path.join(builder.install_dir, info.version)
py_target = os.path.join(builder.install_dir, info.short_version)
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
# Construct package name

@ -748,8 +748,7 @@ function(get_blender_version)
# - BLENDER_VERSION (major.minor)
# - BLENDER_VERSION_MAJOR
# - BLENDER_VERSION_MINOR
# - BLENDER_SUBVERSION (used for internal versioning mainly)
# - BLENDER_VERSION_CHAR (a, b, c, ...or empty string)
# - BLENDER_VERSION_PATCH
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
# So cmake depends on BKE_blender.h, beware of inf-loops!
@ -759,25 +758,15 @@ function(get_blender_version)
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1" _out_version "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_SUBVERSION[ \t]+([0-9]+).*" "\\1" _out_subversion "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CHAR[ \t]+([a-z]+).*" "\\1" _out_version_char "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" _out_version_patch "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1" _out_version_cycle "${_contents}")
if(NOT ${_out_version} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION")
endif()
if(NOT ${_out_subversion} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_SUBVERSION")
endif()
# clumsy regex, only single char are ok but it could be unset
string(LENGTH "${_out_version_char}" _out_version_char_len)
if(NOT _out_version_char_len EQUAL 1)
set(_out_version_char "")
elseif(NOT ${_out_version_char} MATCHES "[a-z]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CHAR")
if(NOT ${_out_version_patch} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_PATCH")
endif()
if(NOT ${_out_version_cycle} MATCHES "[a-z]+")
@ -787,23 +776,11 @@ function(get_blender_version)
math(EXPR _out_version_major "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100")
# for packaging, alpha to numbers
string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty)
if(${_out_version_char_empty})
set(_out_version_char_index "0")
else()
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
list(FIND _char_ls ${_out_version_char} _out_version_char_index)
math(EXPR _out_version_char_index "${_out_version_char_index} + 1")
endif()
# output vars
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
set(BLENDER_VERSION_MINOR "${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE)
set(BLENDER_VERSION_PATCH "${_out_version_patch}" PARENT_SCOPE)
set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE)
endfunction()

@ -7,7 +7,7 @@ set(PROJECT_VENDOR "Blender Foundation")
set(MAJOR_VERSION ${BLENDER_VERSION_MAJOR})
set(MINOR_VERSION ${BLENDER_VERSION_MINOR})
set(PATCH_VERSION ${BLENDER_VERSION_CHAR_INDEX})
set(PATCH_VERSION ${BLENDER_VERSION_PATCH})
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})

@ -7,15 +7,14 @@ BASE_DIR="$PWD"
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_patch=$(grep "BLENDER_VERSION_PATCH\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100).$blender_version_patch
if [ "$blender_version_cycle" = "release" ] ; then
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char
SUBMODULE_EXCLUDE="^\(release/scripts/addons_contrib\)$"
else
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)_$blender_subversion
VERSION=$VERSION-$blender_version_cycle
SUBMODULE_EXCLUDE="^$" # dummy regex
fi

@ -403,32 +403,21 @@ MODULE_GROUPING = {
# -------------------------------BLENDER----------------------------------------
blender_version_strings = [str(v) for v in bpy.app.version]
is_release = bpy.app.version_cycle in {"rc", "release"}
# converting bytes to strings, due to T30154
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
if is_release:
# '2.62a'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings[:2]) + bpy.app.version_char
else:
# '2.62.1'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
# '2.83.0 Beta' or '2.83.0' or '2.83.1'
BLENDER_VERSION_DOTS = bpy.app.version_string
if BLENDER_REVISION != "Unknown":
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
# SHA1 Git hash
BLENDER_VERSION_HASH = BLENDER_REVISION
else:
# Fallback: Should not be used
BLENDER_VERSION_HASH = "Hash Unknown"
if is_release:
# '2_62a_release'
BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char)
else:
# '2_62_1'
BLENDER_VERSION_PATH = "_".join(blender_version_strings)
# '2_83'
BLENDER_VERSION_PATH = "%d_%d" % (bpy.app.version[0], bpy.app.version[1])
# --------------------------DOWNLOADABLE FILES----------------------------------

@ -36,16 +36,10 @@ fi
blender_srcdir=$(dirname -- $0)/../..
blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h"
blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}')
unset blender_version_header
if [ "$blender_version_cycle" = "release" ] ; then
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release"
else
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion
fi
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)
SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION

@ -127,11 +127,10 @@ def main():
" f.write('%d\\n' % is_release)\n"
" f.write('%d\\n' % is_beta)\n"
" f.write('%s\\n' % branch)\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char))\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1]))\n"
" f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1]))\n"
" if (is_release or is_beta) else '%s\\n' % branch)\n"
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
" f.write('%d_%d' % (bpy.app.version[0], bpy.app.version[1]))\n"
)
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python-expr", getver_script, "--", getver_file)

@ -19,10 +19,10 @@
/* For constants. */
#include "BLI_math_base.h"
#include "DNA_userdef_types.h"
#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
#include "DNA_space_types.h"
#include "DNA_anim_types.h"
#include "DNA_userdef_types.h"
#include "BLI_math_rotation.h"
@ -31,8 +31,8 @@
#include "BLO_readfile.h" /* own include */
const UserDef U_default = {
.versionfile = BLENDER_VERSION,
.subversionfile = BLENDER_SUBVERSION,
.versionfile = BLENDER_FILE_VERSION,
.subversionfile = BLENDER_FILE_SUBVERSION,
.flag = (USER_AUTOSAVE | USER_TOOLTIPS | USER_SAVE_PREVIEWS | USER_RELPATHS |
USER_RELEASECONFIRM | USER_SCRIPT_AUTOEXEC_DISABLE | USER_NONEGFRAMES),
.dupflag = USER_DUP_MESH | USER_DUP_CURVE | USER_DUP_SURF | USER_DUP_FONT | USER_DUP_MBALL |

@ -1106,8 +1106,8 @@ class WM_OT_doc_view(Operator):
doc_id: doc_id
if bpy.app.version_cycle in {"release", "rc", "beta"}:
_prefix = ("https://docs.blender.org/api/%d.%d%s" %
(bpy.app.version[0], bpy.app.version[1], bpy.app.version_char))
_prefix = ("https://docs.blender.org/api/%d.%d" %
(bpy.app.version[0], bpy.app.version[1]))
else:
_prefix = ("https://docs.blender.org/api/master")

@ -34,12 +34,6 @@ void BKE_blender_free(void);
void BKE_blender_globals_init(void);
void BKE_blender_globals_clear(void);
void BKE_blender_version_string(char *version_str,
size_t maxncpy,
short version,
short subversion,
bool v_prefix,
bool include_subversion);
void BKE_blender_userdef_data_swap(struct UserDef *userdef_dst, struct UserDef *userdef_src);
void BKE_blender_userdef_data_set(struct UserDef *userdef);

@ -26,21 +26,25 @@
*
* \note Use #STRINGIFY() rather than defining with quotes.
*/
/* Blender major and minor version. */
#define BLENDER_VERSION 283
#define BLENDER_SUBVERSION 17
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
/** Used by packaging tools. */
/** Can be left blank, otherwise a,b,c... etc with no quotes. */
#define BLENDER_VERSION_CHAR
/** alpha/beta/rc/release, docs use this. */
/* Blender patch version for bugfix releases. */
#define BLENDER_VERSION_PATCH 0
/** Blender release cycle stage: alpha/beta/rc/release. */
#define BLENDER_VERSION_CYCLE beta
/** Optionally set to 1,2,... for example to get alpha1 or rc2. */
#define BLENDER_VERSION_CYCLE_NUMBER
/** Defined in from blender.c */
extern char versionstr[];
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 17
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
* was written with too new a version. */
#define BLENDER_FILE_MIN_VERSION 280
#define BLENDER_FILE_MIN_SUBVERSION 0
/** User readable version string. */
const char *BKE_blender_version_string(void);
#endif /* __BKE_BLENDER_VERSION_H__ */

@ -87,7 +87,7 @@ enum {
typedef struct Main {
struct Main *next, *prev;
char name[1024]; /* 1024 = FILE_MAX */
short versionfile, subversionfile; /* see BLENDER_VERSION, BLENDER_SUBVERSION */
short versionfile, subversionfile; /* see BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION */
short minversionfile, minsubversionfile;
uint64_t build_commit_timestamp; /* commit's timestamp from buildinfo */
char build_hash[16]; /* hash from buildinfo */

@ -66,7 +66,7 @@
Global G;
UserDef U;
char versionstr[48] = "";
static char blender_version_string[48] = "";
/* ********** free ********** */
@ -102,26 +102,43 @@ void BKE_blender_free(void)
free_nodesystem();
}
void BKE_blender_version_string(char *version_str,
size_t maxncpy,
short version,
short subversion,
bool v_prefix,
bool include_subversion)
static void blender_version_init()
{
const char *prefix = v_prefix ? "v" : "";
if (include_subversion && subversion > 0) {
BLI_snprintf(
version_str, maxncpy, "%s%d.%02d.%d", prefix, version / 100, version % 100, subversion);
const char *version_cycle = "";
if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "alpha")) {
version_cycle = " Alpha";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "beta")) {
version_cycle = " Beta";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "rc")) {
version_cycle = " Release Candidate";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) {
version_cycle = "";
}
else {
BLI_snprintf(version_str, maxncpy, "%s%d.%02d", prefix, version / 100, version % 100);
BLI_assert(!"Invalid Blender version cycle");
}
BLI_snprintf(blender_version_string,
ARRAY_SIZE(blender_version_string),
"%d.%02d.%d%s",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
BLENDER_VERSION_PATCH,
version_cycle);
}
const char *BKE_blender_version_string()
{
return blender_version_string;
}
void BKE_blender_globals_init(void)
{
blender_version_init();
memset(&G, 0, sizeof(Global));
U.savetime = 1;
@ -130,9 +147,6 @@ void BKE_blender_globals_init(void)
strcpy(G.ima, "//");
BKE_blender_version_string(
versionstr, sizeof(versionstr), BLENDER_VERSION, BLENDER_SUBVERSION, true, true);
#ifndef WITH_PYTHON_SECURITY /* default */
G.f |= G_FLAG_SCRIPT_AUTOEXEC;
#else

@ -418,8 +418,9 @@ static void setup_app_blend_file_data(bContext *C,
static int handle_subversion_warning(Main *main, ReportList *reports)
{
if (main->minversionfile > BLENDER_VERSION ||
(main->minversionfile == BLENDER_VERSION && main->minsubversionfile > BLENDER_SUBVERSION)) {
if (main->minversionfile > BLENDER_FILE_VERSION ||
(main->minversionfile == BLENDER_FILE_VERSION &&
main->minsubversionfile > BLENDER_FILE_SUBVERSION)) {
BKE_reportf(reports,
RPT_ERROR,
"File written by newer Blender binary (%d.%d), expect loss of data!",

@ -3956,12 +3956,12 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.globalf = G.f;
BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
sprintf(subvstr, "%4d", BLENDER_SUBVERSION);
sprintf(subvstr, "%4d", BLENDER_FILE_SUBVERSION);
memcpy(fg.subvstr, subvstr, 4);
fg.subversion = BLENDER_SUBVERSION;
fg.minversion = BLENDER_MINVERSION;
fg.minsubversion = BLENDER_MINSUBVERSION;
fg.subversion = BLENDER_FILE_SUBVERSION;
fg.minversion = BLENDER_FILE_MIN_VERSION;
fg.minsubversion = BLENDER_FILE_MIN_SUBVERSION;
#ifdef WITH_BUILDINFO
{
extern unsigned long build_commit_timestamp;
@ -4015,7 +4015,7 @@ static bool write_file_handle(Main *mainvar,
"BLENDER%c%c%.3d",
(sizeof(void *) == 8) ? '-' : '_',
(ENDIAN_ORDER == B_ENDIAN) ? 'V' : 'v',
BLENDER_VERSION);
BLENDER_FILE_VERSION);
mywrite(wd, buf, 12);

@ -565,7 +565,7 @@ static void stats_string(ViewLayer *view_layer)
gpumemstr);
}
ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, " | %s", versionstr);
ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, " | %s", BKE_blender_version_string());
#undef MAX_INFO_MEM_LEN
}

@ -53,7 +53,7 @@ static OArchive create_archive(std::ostream *ostream,
abc_metadata.set(Alembic::Abc::kApplicationNameKey, "Blender");
abc_metadata.set(Alembic::Abc::kUserDescriptionKey, scene_name);
abc_metadata.set("blender_version", versionstr);
abc_metadata.set("blender_version", std::string("v") + BKE_blender_version_string());
abc_metadata.set("FramesPerTimeUnit", std::to_string(scene_fps));
time_t raw_time;

@ -245,20 +245,13 @@ int DocumentExporter::exportCurrentScene()
#ifdef WITH_BUILDINFO
BLI_snprintf(version_buf,
sizeof(version_buf),
"Blender %d.%02d.%d commit date:%s, commit time:%s, hash:%s",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
BLENDER_SUBVERSION,
"Blender %s commit date:%s, commit time:%s, hash:%s",
BKE_blender_version_string(),
build_commit_date,
build_commit_time,
build_hash);
#else
BLI_snprintf(version_buf,
sizeof(version_buf),
"Blender %d.%02d.%d",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
BLENDER_SUBVERSION);
BLI_snprintf(version_buf, sizeof(version_buf), "Blender %s", BKE_blender_version_string());
#endif
asset.getContributor().mAuthoringTool = version_buf;
asset.add();

@ -93,7 +93,8 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo
usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, pxr::VtValue(pxr::UsdGeomTokens->z));
usd_stage->SetMetadata(pxr::UsdGeomTokens->metersPerUnit,
pxr::VtValue(scene->unit.scale_length));
usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender ") + versionstr);
usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender v") +
BKE_blender_version_string());
// Set up the stage for animated data.
if (data->params.export_animation) {

@ -328,7 +328,7 @@ typedef struct Library {
/* Temp data needed by read/write code. */
int temp_index;
/** See BLENDER_VERSION, BLENDER_SUBVERSION, needed for do_versions. */
/** See BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION, needed for do_versions. */
short versionfile, subversionfile;
} Library;

@ -82,10 +82,10 @@ extern char build_system[];
static PyTypeObject BlenderAppType;
static PyStructSequence_Field app_info_fields[] = {
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"},
{"version", "The Blender version as a tuple of 3 numbers. eg. (2, 83, 1)"},
{"version_string", "The Blender version formatted as a string"},
{"version_char", "The Blender version character (for minor releases)"},
{"version_cycle", "The release status of this build alpha/beta/rc/release"},
{"version_char", "Deprecated, always an empty string"},
{"binary_path",
"The location of Blender's executable, useful for utilities that open new instances"},
{"background",
@ -160,12 +160,12 @@ static PyObject *make_app_info(void)
#define SetBytesItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
#define SetObjItem(obj) PyStructSequence_SET_ITEM(app_info, pos++, obj)
SetObjItem(PyC_Tuple_Pack_I32(BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
SetObjItem(PyUnicode_FromFormat(
"%d.%02d (sub %d)", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
SetObjItem(
PyC_Tuple_Pack_I32(BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH));
SetStrItem(BKE_blender_version_string());
SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR));
SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE));
SetStrItem("");
SetStrItem(BKE_appdir_program_path());
SetObjItem(PyBool_FromLong(G.background));
SetObjItem(PyBool_FromLong(G.factory_startup));

@ -99,42 +99,13 @@ static void wm_block_splash_add_label(uiBlock *block, const char *label, int x,
static void wm_block_splash_add_labels(uiBlock *block, int x, int y)
{
/* Version number. */
const char *version_cycle = NULL;
bool show_build_info = true;
if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "alpha")) {
version_cycle = " Alpha";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "beta")) {
version_cycle = " Beta";
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "rc")) {
version_cycle = " Release Candidate";
show_build_info = false;
}
else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) {
version_cycle = STRINGIFY(BLENDER_VERSION_CHAR);
show_build_info = false;
}
const char *version_cycle_number = "";
if (strlen(STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER))) {
version_cycle_number = " " STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER);
}
char version_buf[256] = "\0";
BLI_snprintf(version_buf,
sizeof(version_buf),
"v %d.%d%s%s",
BLENDER_VERSION / 100,
BLENDER_VERSION % 100,
version_cycle,
version_cycle_number);
BLI_snprintf(version_buf, sizeof(version_buf), "v%s", BKE_blender_version_string());
wm_block_splash_add_label(block, version_buf, x, &y);
#ifdef WITH_BUILDINFO
if (show_build_info) {
if (!STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) {
extern unsigned long build_commit_timestamp;
extern char build_hash[], build_commit_date[], build_commit_time[], build_branch[];
@ -159,8 +130,6 @@ static void wm_block_splash_add_labels(uiBlock *block, int x, int y)
wm_block_splash_add_label(block, branch_buf, x, &y);
}
}
#else
UNUSED_VARS(show_build_info);
#endif /* WITH_BUILDINFO */
}

@ -912,8 +912,8 @@ elseif(APPLE)
set_target_properties(blender PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist
MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}${BLENDER_VERSION_CHAR}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}${BLENDER_VERSION_CHAR} ${BLENDER_DATE}")
MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH}"
MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH} ${BLENDER_DATE}")
# Gather the date in finder-style
execute_process(COMMAND date "+%m/%d/%Y/%H:%M"

@ -460,7 +460,7 @@ static void arg_py_context_restore(bContext *C, struct BlendePyContextStore *c_p
static void print_version_full(void)
{
printf(BLEND_VERSION_STRING_FMT);
printf("Blender %s\n", BKE_blender_version_string());
# ifdef BUILD_DATE
printf("\tbuild date: %s\n", build_date);
printf("\tbuild time: %s\n", build_time);
@ -481,13 +481,13 @@ static void print_version_short(void)
# ifdef BUILD_DATE
/* NOTE: We include built time since sometimes we need to tell broken from
* working built of the same hash. */
printf(BLEND_VERSION_FMT " (hash %s built %s %s)\n",
BLEND_VERSION_ARG,
printf("Blender %s (hash %s built %s %s)\n",
BKE_blender_version_string(),
build_hash,
build_date,
build_time);
# else
printf(BLEND_VERSION_STRING_FMT);
printf("Blender %s\n", BKE_blender_version_string());
# endif
}
@ -513,7 +513,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
{
bArgs *ba = (bArgs *)data;
printf(BLEND_VERSION_STRING_FMT);
printf("Blender %s\n", BKE_blender_version_string());
printf("Usage: blender [args ...] [file] [args ...]\n\n");
printf("Render Options:\n");
@ -907,7 +907,7 @@ static const char arg_handle_debug_mode_set_doc[] =
static int arg_handle_debug_mode_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
G.debug |= G_DEBUG; /* std output printf's */
printf(BLEND_VERSION_STRING_FMT);
printf("Blender %s\n", BKE_blender_version_string());
MEM_set_memory_debug();
# ifndef NDEBUG
BLI_mempool_set_memory_debug();

@ -55,10 +55,8 @@ extern struct ApplicationState app_state; /* creator.c */
/* for the callbacks: */
#ifndef WITH_PYTHON_MODULE
# define BLEND_VERSION_FMT "Blender %d.%02d (sub %d)"
# define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION
/* pass directly to printf */
# define BLEND_VERSION_STRING_FMT BLEND_VERSION_FMT "\n", BLEND_VERSION_ARG
# define BLEND_VERSION_FMT "Blender %d.%02d.%d"
# define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH
#endif
#ifdef WITH_BUILDINFO_HEADER