aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/samba/samba-4.4.5/20-do-not-import-target-module-while-cross-compile.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-connectivity/samba/samba-4.4.5/20-do-not-import-target-module-while-cross-compile.patch')
-rw-r--r--meta-networking/recipes-connectivity/samba/samba-4.4.5/20-do-not-import-target-module-while-cross-compile.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/samba/samba-4.4.5/20-do-not-import-target-module-while-cross-compile.patch b/meta-networking/recipes-connectivity/samba/samba-4.4.5/20-do-not-import-target-module-while-cross-compile.patch
new file mode 100644
index 0000000000..e112b3b40b
--- /dev/null
+++ b/meta-networking/recipes-connectivity/samba/samba-4.4.5/20-do-not-import-target-module-while-cross-compile.patch
@@ -0,0 +1,58 @@
+Some modules such as dynamic library maybe cann't be imported while cross compile,
+we just check whether does the module exist.
+
+Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
+
+Index: samba-4.4.2/buildtools/wafsamba/samba_bundled.py
+===================================================================
+--- samba-4.4.2.orig/buildtools/wafsamba/samba_bundled.py
++++ samba-4.4.2/buildtools/wafsamba/samba_bundled.py
+@@ -2,6 +2,7 @@
+
+ import sys
+ import Build, Options, Logs
++import imp, os
+ from Configure import conf
+ from samba_utils import TO_LIST
+
+@@ -230,17 +231,32 @@ def CHECK_BUNDLED_SYSTEM_PYTHON(conf, li
+ # versions
+ minversion = minimum_library_version(conf, libname, minversion)
+
+- try:
+- m = __import__(modulename)
+- except ImportError:
+- found = False
+- else:
++ # Find module in PYTHONPATH
++ stuff = imp.find_module(modulename, [os.environ["PYTHONPATH"]])
++ if stuff:
+ try:
+- version = m.__version__
+- except AttributeError:
++ m = imp.load_module(modulename, stuff[0], stuff[1], stuff[2])
++ except ImportError:
+ found = False
++
++ if conf.env.CROSS_COMPILE:
++ # Some modules such as dynamic library maybe cann't be imported
++ # while cross compile, we just check whether the module exist
++ Logs.warn('Cross module[%s] has been found, but can not be loaded.' % (stuff[1]))
++ found = True
+ else:
+- found = tuplize_version(version) >= tuplize_version(minversion)
++ try:
++ version = m.__version__
++ except AttributeError:
++ found = False
++ else:
++ found = tuplize_version(version) >= tuplize_version(minversion)
++ finally:
++ if stuff[0]:
++ stuff[0].close()
++ else:
++ found = False
++
+ if not found and not conf.LIB_MAY_BE_BUNDLED(libname):
+ Logs.error('ERROR: Python module %s of version %s not found, and bundling disabled' % (libname, minversion))
+ sys.exit(1)