summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/samba/samba-4.1.12/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.1.12/20-do-not-import-target-module-while-cross-compile.patch')
-rwxr-xr-xmeta-networking/recipes-connectivity/samba/samba-4.1.12/20-do-not-import-target-module-while-cross-compile.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/samba/samba-4.1.12/20-do-not-import-target-module-while-cross-compile.patch b/meta-networking/recipes-connectivity/samba/samba-4.1.12/20-do-not-import-target-module-while-cross-compile.patch
new file mode 100755
index 0000000000..5c20d315ec
--- /dev/null
+++ b/meta-networking/recipes-connectivity/samba/samba-4.1.12/20-do-not-import-target-module-while-cross-compile.patch
@@ -0,0 +1,57 @@
1Some modules such as dynamic library maybe cann't be imported while cross compile,
2we just check whether does the module exist.
3
4Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
5
6--- samba-4.1.12.orig/buildtools/wafsamba/samba_bundled.py 2013-06-13 17:21:02.000000000 +0800
7+++ samba-4.1.12/buildtools/wafsamba/samba_bundled.py 2015-07-16 16:57:06.649092158 +0800
8@@ -1,7 +1,7 @@
9 # functions to support bundled libraries
10
11 from Configure import conf
12-import sys, Logs
13+import sys, Logs, imp
14 from samba_utils import *
15
16 def PRIVATE_NAME(bld, name, private_extension, private_library):
17@@ -228,17 +228,32 @@ def CHECK_BUNDLED_SYSTEM_PYTHON(conf, li
18 # versions
19 minversion = minimum_library_version(conf, libname, minversion)
20
21- try:
22- m = __import__(modulename)
23- except ImportError:
24- found = False
25- else:
26+ # Find module in PYTHONPATH
27+ stuff = imp.find_module(modulename, [os.environ["PYTHONPATH"]])
28+ if stuff:
29 try:
30- version = m.__version__
31- except AttributeError:
32+ m = imp.load_module(modulename, stuff[0], stuff[1], stuff[2])
33+ except ImportError:
34 found = False
35+
36+ if conf.env.CROSS_COMPILE:
37+ # Some modules such as dynamic library maybe cann't be imported
38+ # while cross compile, we just check whether the module exist
39+ Logs.warn('Cross module[%s] has been found, but can not be loaded.' % (stuff[1]))
40+ found = True
41 else:
42- found = tuplize_version(version) >= tuplize_version(minversion)
43+ try:
44+ version = m.__version__
45+ except AttributeError:
46+ found = False
47+ else:
48+ found = tuplize_version(version) >= tuplize_version(minversion)
49+ finally:
50+ if stuff[0]:
51+ stuff[0].close()
52+ else:
53+ found = False
54+
55 if not found and not conf.LIB_MAY_BE_BUNDLED(libname):
56 Logs.error('ERROR: Python module %s of version %s not found, and bundling disabled' % (libname, minversion))
57 sys.exit(1)