summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-05-06 17:50:57 +0200
committerAndrew Bartlett <abartlet@samba.org>2015-05-19 19:28:19 +0200
commit6f490000c6b233f275598a4680b2c49fcb69d35a (patch)
tree3f2e775059aa148f1923a1abb619216005e3cef0 /buildtools
parentfb5d9c3db17f4d40c15be7285edc296d14c69130 (diff)
downloadsamba-6f490000c6b233f275598a4680b2c49fcb69d35a.tar.gz
buildtools: Add a helper to iterate through Python environments
This prevents code duplication to ensure the "extrapython" build is the same as the normal one. Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_python.py25
-rw-r--r--buildtools/wafsamba/wafsamba.py3
2 files changed, 28 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index d12fe95a465..a0e0ffa9f6b 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
@@ -74,6 +74,9 @@ def SAMBA_PYTHON(bld, name,
enabled=True):
'''build a python extension for Samba'''
+ if bld.env['IS_EXTRA_PYTHON']:
+ name = 'extra-' + name
+
# when we support static python modules we'll need to gather
# the list from all the SAMBA_PYTHON() targets
if init_function_sentinel is not None:
@@ -111,3 +114,25 @@ def pyembed_libname(bld, name, extrapython=False):
return name + bld.env['PYTHON_SO_ABI_FLAG']
Build.BuildContext.pyembed_libname = pyembed_libname
+
+
+def gen_python_environments(bld, extra_env_vars=()):
+ """Generate all Python environments
+
+ To be used in a for loop. Normally, the loop body will be executed once.
+
+ When --extra-python is used, the body will additionaly be executed
+ with the extra-python environment active.
+ """
+ yield
+
+ if bld.env['EXTRA_PYTHON']:
+ copied = ('GLOBAL_DEPENDENCIES', 'TARGET_TYPE') + tuple(extra_env_vars)
+ for name in copied:
+ bld.all_envs['extrapython'][name] = bld.all_envs['default'][name]
+ default_env = bld.all_envs['default']
+ bld.all_envs['default'] = bld.all_envs['extrapython']
+ yield
+ bld.all_envs['default'] = default_env
+
+Build.BuildContext.gen_python_environments = gen_python_environments
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 12bf2311cf0..64382da4e43 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -143,6 +143,9 @@ def SAMBA_LIBRARY(bld, libname, source,
enabled=True):
'''define a Samba library'''
+ if pyembed and bld.env['IS_EXTRA_PYTHON']:
+ public_headers = pc_files = None
+
if LIB_MUST_BE_PRIVATE(bld, libname):
private_library=True