waf: build: Respect --disable-python for third_party modules
authorLutz Justen <ljusten@google.com>
Mon, 22 Apr 2019 17:22:16 +0000 (10:22 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 24 Apr 2019 07:32:31 +0000 (07:32 +0000)
Skips installation of samba/third_party stuff into the python directory if
--disable-python is set.

Added test after install that confirms no python modules installed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13905

Signed-off-by: Lutz Justen <ljusten@google.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr 24 07:32:31 UTC 2019 on sn-devel-184

script/autobuild.py
script/find_python.sh [new file with mode: 0755]
third_party/wscript

index e1aea054e1f761bd95abb613caae767abb4c074d..2b27427c9490c2603ff204401f05010dffeae2a1 100755 (executable)
@@ -405,6 +405,7 @@ tasks = {
                       ("configure", "./configure.developer --picky-developer ${PREFIX} --with-profiling-data --disable-python --without-ad-dc", "text/plain"),
                       ("make", "make -j", "text/plain"),
                       ("install", "make install", "text/plain"),
+                      ("find-python", "script/find_python.sh ${PREFIX}", "text/plain"),
                       ("test", "make test-nopython", "text/plain"),
                       ("check-clean-tree", "script/clean-source-tree.sh", "text/plain"),
                       ("clean", "make clean", "text/plain"),
@@ -439,6 +440,7 @@ tasks = {
                       ("configure", "PYTHON=python2 ./configure.developer --picky-developer ${PREFIX} --with-profiling-data --disable-python --without-ad-dc", "text/plain"),
                       ("make", "PYTHON=python2 make -j", "text/plain"),
                       ("install", "PYTHON=python2 make install", "text/plain"),
+                      ("find-python", "script/find_python.sh ${PREFIX}", "text/plain"),
                       ("test", "make test-nopython", "text/plain"),
                       ("check-clean-tree", "script/clean-source-tree.sh", "text/plain"),
                       ("clean", "PYTHON=python2 make clean", "text/plain"),
diff --git a/script/find_python.sh b/script/find_python.sh
new file mode 100755 (executable)
index 0000000..e9afdbd
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ $# -lt 1 ]; then
+       echo "$0: <installdir>"
+       exit 1;
+fi
+
+installdir=$1
+exit `find ${installdir} -name \*.py | wc -l`
index ecd1975d7b897f7631d0d4c47837e4fae328f074..286e1015e7067a2780351a2c51076f98c07b5928 100644 (file)
@@ -60,23 +60,25 @@ def configure(conf):
 
 
 def build(bld):
-    list = []
+    if not bld.env.disable_python:
+        list = []
 
-    for module, package in external_pkgs.items():
-        try:
-            __import__(module)
-        except ImportError:
-            list.append(package)
+        for module, package in external_pkgs.items():
+            try:
+                __import__(module)
+            except ImportError:
+                list.append(package)
+
+        for e in list:
+            bld.INSTALL_WILDCARD('${PYTHONARCHDIR}/samba/third_party', e + '/**/*', flat=False,
+                                 exclude='*.pyc', trim_path=os.path.dirname(e))
 
-    for e in list:
-        bld.INSTALL_WILDCARD('${PYTHONARCHDIR}/samba/third_party', e + '/**/*', flat=False,
-                             exclude='*.pyc', trim_path=os.path.dirname(e))
+        bld.SAMBA_GENERATOR('third_party_init_py',
+                            rule='touch ${TGT}',
+                            target='empty_file')
 
-    bld.SAMBA_GENERATOR('third_party_init_py',
-                        rule='touch ${TGT}',
-                        target='empty_file')
+        bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/third_party', 'empty_file', destname='__init__.py')
 
-    bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/third_party', 'empty_file', destname='__init__.py')
     bld.RECURSE('cmocka')
     bld.RECURSE('zlib')
     bld.RECURSE('popt')