bindings/python/wscript
changeset 7363 0f96f5beb8c7
parent 7348 9372b57a6ce4
child 7364 80940903b711
equal deleted inserted replaced
7362:36b42a8b16d1 7363:0f96f5beb8c7
    20 
    20 
    21 
    21 
    22 
    22 
    23 from TaskGen import feature, after
    23 from TaskGen import feature, after
    24 import Task, ccroot
    24 import Task, ccroot
       
    25 from python import _get_python_variables # this comes from wafadmin/Tools/python.py
       
    26 
    25 
    27 
    26 @feature('pch')
    28 @feature('pch')
    27 @after('apply_link')
    29 @after('apply_link')
    28 def process_pch(self):
    30 def process_pch(self):
    29     node = self.path.find_resource(self.pch)
    31     node = self.path.find_resource(self.pch)
   111         conf.check_python_headers()
   113         conf.check_python_headers()
   112     except Configure.ConfigurationError, ex:
   114     except Configure.ConfigurationError, ex:
   113         conf.report_optional_feature("python", "Python Bindings", False, str(ex))
   115         conf.report_optional_feature("python", "Python Bindings", False, str(ex))
   114         return
   116         return
   115 
   117 
       
   118 
       
   119     # alternative code to computing PYTHONDIR, that is more correct than the one in waf 1.5.16
       
   120     if 'PYTHONDIR' in conf.environ:
       
   121         pydir = conf.environ['PYTHONDIR']
       
   122     else:
       
   123         (pydir,) = _get_python_variables(conf.env['PYTHON'],
       
   124                                          ["get_python_lib(standard_lib=0, prefix=%r)" % conf.env['PREFIX']],
       
   125                                          ['from distutils.sysconfig import get_python_lib'])
       
   126     if hasattr(conf, 'define'): # conf.define is added by the C tool, so may not exist
       
   127         conf.define('PYTHONDIR', pydir)
       
   128     conf.env['PYTHONDIR'] = pydir
       
   129 
       
   130 
   116     # -fvisibility=hidden optimization
   131     # -fvisibility=hidden optimization
   117     if (conf.env['CXX_NAME'] == 'gcc' and [int(x) for x in conf.env['CC_VERSION']] >= [4,0,0]
   132     if (conf.env['CXX_NAME'] == 'gcc' and [int(x) for x in conf.env['CC_VERSION']] >= [4,0,0]
   118         and conf.check_compilation_flag('-fvisibility=hidden')):
   133         and conf.check_compilation_flag('-fvisibility=hidden')):
   119         conf.env.append_value('CXXFLAGS_PYEXT', '-fvisibility=hidden')
   134         conf.env.append_value('CXXFLAGS_PYEXT', '-fvisibility=hidden')
   120         conf.env.append_value('CCFLAGS_PYEXT', '-fvisibility=hidden')
   135         conf.env.append_value('CCFLAGS_PYEXT', '-fvisibility=hidden')