Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-02-08 21:17:19 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-02-08 21:17:19 +0400
commit33bca3075f2cc8201b13a6f08b22d7a1288aab4d (patch)
tree18a5ab262f5c822ff8913b951ea59ba196be5ec0 /build_files
parentb6d12f11fedd9544429745c13381d36ed6d20e8c (diff)
Fix for hardcoded to scons rules python abi flags and wrong behavior
of python bundling on systems where python is installed to /usr/lib64 Now ABI flags are automatically detecting (by checking all available flags and checking if there's include directory exists for flag). Also, automatically set PYTHON_LIBPATH to /usr/lib64 if python scripts are stored in this folder. Bundling python on *nix platforms is now checks if python is installed to lib64 directory and if it is, python will be bundled to lib64 folder instead of lib. This will make building on openSUSE a bit less annoying
Diffstat (limited to 'build_files')
-rw-r--r--build_files/scons/config/Modules/FindPython.py32
-rw-r--r--build_files/scons/config/Modules/__init__.py0
-rw-r--r--build_files/scons/config/linux-config.py12
-rw-r--r--build_files/scons/tools/Blender.py5
4 files changed, 44 insertions, 5 deletions
diff --git a/build_files/scons/config/Modules/FindPython.py b/build_files/scons/config/Modules/FindPython.py
new file mode 100644
index 00000000000..969d9db92a4
--- /dev/null
+++ b/build_files/scons/config/Modules/FindPython.py
@@ -0,0 +1,32 @@
+import os
+
+def FindPython():
+ all_abi_flags = ['m', 'mu', '']
+
+ python = "/usr"
+ abi_flags = "m" # Most common for linux distros
+ version = "3.2"
+
+ # Determine ABI flags used on this system
+ include = os.path.join(python, "include")
+ for cur_flags in all_abi_flags:
+ inc = os.path.join(include, "python" + version + cur_flags, "Python.h")
+ if os.path.exists(inc):
+ abi_flags = cur_flags
+ break
+
+ # Determine whether python is in /usr/lib or /usr/lib64
+ lib32 = os.path.join(python, "lib", "python" + version, "sysconfig.py")
+ lib64 = os.path.join(python, "lib64", "python" + version, "sysconfig.py")
+ if os.path.exists(lib32):
+ libpath = "${BF_PYTHON}/lib"
+ elif os.path.exists(lib64):
+ libpath = "${BF_PYTHON}/lib64"
+ else:
+ # roll back to default value
+ libpath = "${BF_PYTHON}/lib"
+
+ return {'PYTHON': python,
+ "VERSION": version,
+ 'LIBPATH': libpath,
+ 'ABI_FLAGS': abi_flags}
diff --git a/build_files/scons/config/Modules/__init__.py b/build_files/scons/config/Modules/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/build_files/scons/config/Modules/__init__.py
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index fdef85655ec..63022bb1117 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -1,6 +1,8 @@
# find library directory
import platform
import os
+from Modules.FindPython import FindPython
+
bitness = platform.architecture()[0]
if bitness == '64bit':
LCGDIR = '../lib/linux64'
@@ -8,10 +10,12 @@ else:
LCGDIR = '../lib/linux'
LIBDIR = "#${LCGDIR}"
-BF_PYTHON_ABI_FLAGS = 'm' # Most common for linux distros
-BF_PYTHON = '/usr'
-BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
-BF_PYTHON_VERSION = '3.2'
+py = FindPython()
+
+BF_PYTHON_ABI_FLAGS = py['ABI_FLAGS']
+BF_PYTHON = py['PYTHON']
+BF_PYTHON_LIBPATH = py['LIBPATH']
+BF_PYTHON_VERSION = py['VERSION']
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index afcae061dd0..5d6298adfe2 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -649,8 +649,11 @@ def UnixPyBundle(target=None, source=None, env=None):
dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
+ lib = env['BF_PYTHON_LIBPATH'].split(os.sep)[-1]
+ target_lib = "lib64" if lib == "lib64" else "lib"
+
py_src = env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] )
- py_target = env.subst( dir + '/python/lib/python'+env['BF_PYTHON_VERSION'] )
+ py_target = env.subst( dir + '/python/' + target_lib + '/python'+env['BF_PYTHON_VERSION'] )
# This is a bit weak, but dont install if its been installed before, makes rebuilds quite slow.
if os.path.exists(py_target):