From 51c97a2cd8ad227b0f76f922646f4e7c86488d98 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 11 Jul 2011 14:24:59 +0100 Subject: [PATCH] Bug 1200 - ./waf install doesn't install Python bindings properly --- bindings/python/wscript | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bindings/python/wscript b/bindings/python/wscript index 0a3677d21..f8212b061 100644 --- a/bindings/python/wscript +++ b/bindings/python/wscript @@ -22,6 +22,8 @@ REQUIRED_PYGCCXML_VERSION = (0, 9, 5) from TaskGen import feature, after import Task, ccroot +from python import _get_python_variables # this comes from wafadmin/Tools/python.py + @feature('pch') @after('apply_link') @@ -113,6 +115,19 @@ def configure(conf): conf.report_optional_feature("python", "Python Bindings", False, str(ex)) return + + # alternative code to computing PYTHONDIR, that is more correct than the one in waf 1.5.16 + if 'PYTHONDIR' in conf.environ: + pydir = conf.environ['PYTHONDIR'] + else: + (pydir,) = _get_python_variables(conf.env['PYTHON'], + ["get_python_lib(standard_lib=0, prefix=%r)" % conf.env['PREFIX']], + ['from distutils.sysconfig import get_python_lib']) + if hasattr(conf, 'define'): # conf.define is added by the C tool, so may not exist + conf.define('PYTHONDIR', pydir) + conf.env['PYTHONDIR'] = pydir + + # -fvisibility=hidden optimization if (conf.env['CXX_NAME'] == 'gcc' and [int(x) for x in conf.env['CC_VERSION']] >= [4,0,0] and conf.check_compilation_flag('-fvisibility=hidden')):