2008-01-15 15:25:50 +00:00
|
|
|
#!/usr/bin/env python
|
2009-04-11 19:04:59 +00:00
|
|
|
# -*- mode: python; tab-width: 4; indent-tabs-mode: t; -*-
|
|
|
|
# vim: tabstop=4
|
2010-03-21 01:14:04 +00:00
|
|
|
# $Id$
|
2008-01-15 15:25:50 +00:00
|
|
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-01-15 15:25:50 +00:00
|
|
|
#
|
|
|
|
# The Original Code is Copyright (C) 2008 by the Blender Foundation
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
2009-04-11 19:04:59 +00:00
|
|
|
# The Original Code is: see repository.
|
2008-01-15 15:25:50 +00:00
|
|
|
#
|
2009-04-11 19:04:59 +00:00
|
|
|
# Contributor(s): see repository.
|
2008-01-15 15:25:50 +00:00
|
|
|
|
2009-12-13 14:38:30 +00:00
|
|
|
# <pep8-80 compliant>
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
|
|
|
|
nanblenderhome = os.getenv("NANBLENDERHOME")
|
2008-01-15 15:25:50 +00:00
|
|
|
|
2010-09-18 10:43:32 +00:00
|
|
|
if nanblenderhome is None:
|
2009-12-13 14:38:30 +00:00
|
|
|
nanblenderhome = os.path.dirname(os.path.abspath(sys.argv[0])) + "/.."
|
2008-01-15 15:25:50 +00:00
|
|
|
|
2009-12-13 14:38:30 +00:00
|
|
|
config = nanblenderhome + "/source/blender/blenkernel/BKE_blender.h"
|
2008-01-15 15:25:50 +00:00
|
|
|
|
|
|
|
infile = open(config)
|
|
|
|
|
|
|
|
major = None
|
|
|
|
minor = None
|
|
|
|
|
|
|
|
for line in infile.readlines():
|
2009-12-13 14:38:30 +00:00
|
|
|
m = re.search("#define BLENDER_VERSION\s+(\d+)", line)
|
|
|
|
if m:
|
|
|
|
major = m.group(1)
|
|
|
|
m = re.search("#define BLENDER_SUBVERSION\s+(\d+)", line)
|
|
|
|
if m:
|
|
|
|
minor = m.group(1)
|
|
|
|
if minor and major:
|
|
|
|
major = float(major) / 100.0
|
|
|
|
break
|
2008-01-15 15:25:50 +00:00
|
|
|
|
|
|
|
infile.close()
|
|
|
|
|
2009-04-11 19:04:59 +00:00
|
|
|
# Major was changed to float, but minor is still a string
|
2011-01-01 07:20:34 +00:00
|
|
|
# Note: removed returning minor, messes up install path code in BLI module
|
2010-11-29 17:23:06 +00:00
|
|
|
if major:
|
|
|
|
print "%.2f" % major
|
2008-01-15 15:25:50 +00:00
|
|
|
else:
|
2009-12-13 14:38:30 +00:00
|
|
|
print "unknownversion"
|