build: introduce SAMBA_CHECK_PYTHON_HEADERS
authorMatthieu Patou <mat@matws.net>
Thu, 9 Dec 2010 22:42:32 +0000 (01:42 +0300)
committerMatthieu Patou <mat@matws.net>
Thu, 9 Dec 2010 23:07:18 +0000 (02:07 +0300)
This function is a wrapper around waf's check_python_header.
It avoids searching more than once for the headers bringing a small
speed improvement and a better lisibility of the logs.

But it's mainly to avoid a nasty bug when python libraries are in path
pointed by python_LIBPL (ie. /usr/local/lib/python2.6/config/) instead
of python_LIBDIR (ie. /usr/local/lib).

On the first call waf will correctly find that in order to link with
python libs it needs to add -L$python_LIBPL.

But on the next calls of check_python_headers, waf will use both the
current library path value (ie. -L/usr/local/lib/python2.6/config) and
-L$python_LIBDIR (ie. /usr/local/lib/) which will make him beleive that
python libraries are in $python_LIBDIR which at the end will make the
final link test fails in check_python_headers as it will not use the
good directory.

So by avoiding calling check_python_headers more than once we avoid
making waf fooling itself.

buildtools/wafsamba/samba_python.py
lib/talloc/wscript
lib/tdb/wscript
lib/tevent/wscript
source4/wscript

index ad099814622a8d2bee582d99bd5e31d6609962cc..a663b1910d063336c1340142ae8855d7e176ecdb 100644 (file)
@@ -4,6 +4,15 @@ import Build
 from samba_utils import *
 from samba_autoconf import *
 
 from samba_utils import *
 from samba_autoconf import *
 
+from Configure import conf
+@conf
+def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
+    if conf.env["python_headers_checked"] == []:
+        conf.check_python_headers(mandatory)
+        conf.env["python_headers_checked"] = "yes"
+    else:
+        conf.msg("python headers", "using cache")
+
 
 def SAMBA_PYTHON(bld, name,
                  source='',
 
 def SAMBA_PYTHON(bld, name,
                  source='',
index 6316abafd86c85a942ada8d4e944ad6f98ef409c..49eac6e6e6dd8c08b804c07f7dffe4383b9597ca 100644 (file)
@@ -59,7 +59,7 @@ def configure(conf):
         # also disable if we don't have the python libs installed
         conf.check_tool('python')
         conf.check_python_version((2,4,2))
         # also disable if we don't have the python libs installed
         conf.check_tool('python')
         conf.check_python_version((2,4,2))
-        conf.check_python_headers(mandatory=False)
+        conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
         if not conf.env.HAVE_PYTHON_H:
             Logs.warn('Disabling pytalloc-util as python devel libs not found')
             conf.env.disable_python = True
         if not conf.env.HAVE_PYTHON_H:
             Logs.warn('Disabling pytalloc-util as python devel libs not found')
             conf.env.disable_python = True
index fadd24f60fb27c0523125a101051639051e9863a..f00d119c9ba6fc55ee1347612a556d86f4f57f5f 100644 (file)
@@ -47,7 +47,7 @@ def configure(conf):
         # also disable if we don't have the python libs installed
         conf.check_tool('python')
         conf.check_python_version((2,4,2))
         # also disable if we don't have the python libs installed
         conf.check_tool('python')
         conf.check_python_version((2,4,2))
-        conf.check_python_headers(mandatory=False)
+        conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
         if not conf.env.HAVE_PYTHON_H:
             Logs.warn('Disabling pytdb as python devel libs not found')
             conf.env.disable_python = True
         if not conf.env.HAVE_PYTHON_H:
             Logs.warn('Disabling pytdb as python devel libs not found')
             conf.env.disable_python = True
index 14c4c603194e42bf0bb76582a06a0f70fd5d641c..58ef87e1abfe0eed2cdeb41459121fc10f40fe03 100644 (file)
@@ -48,7 +48,7 @@ def configure(conf):
         # also disable if we don't have the python libs installed
         conf.check_tool('python')
         conf.check_python_version((2,4,2))
         # also disable if we don't have the python libs installed
         conf.check_tool('python')
         conf.check_python_version((2,4,2))
-        conf.check_python_headers(mandatory=False)
+        conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
         if not conf.env.HAVE_PYTHON_H:
             Logs.warn('Disabling pytevent as python devel libs not found')
             conf.env.disable_python = True
         if not conf.env.HAVE_PYTHON_H:
             Logs.warn('Disabling pytevent as python devel libs not found')
             conf.env.disable_python = True
index dabca7f69c17bfa813b0553f5eb90240404d410c..fb0491972bd606cf2d9a0a74a9bc130cd0823952 100644 (file)
@@ -74,7 +74,7 @@ def configure(conf):
     # enable tool to build python extensions
     conf.check_tool('python')
     conf.check_python_version((2,4,2))
     # enable tool to build python extensions
     conf.check_tool('python')
     conf.check_python_version((2,4,2))
-    conf.check_python_headers(mandatory=True)
+    conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
 
     if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
         # Mac OSX needs to have this and it's also needed that the python is compiled with this
 
     if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
         # Mac OSX needs to have this and it's also needed that the python is compiled with this