xref: /OK3568_Linux_fs/buildroot/package/python3/0028-Fix-cross-compiling-the-uuid-module.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From d7b90b157eddefbd0ed59e35c90b083c0c03b644 Mon Sep 17 00:00:00 2001
2From: Adam Duskett <aduskett@gmail.com>
3Date: Fri, 20 Jul 2018 10:17:39 -0400
4Subject: [PATCH] Fix cross compiling the uuid module
5
6Python 3.7 has a new _uuid module, however, the include directory
7search path for uuid.h is hardcoded to /usr/include/uuid, which should
8not be used when cross-compiling.
9
10To fix this, use the same solution as the one used by the NIS
11detection: append "uuid" to each of the include directories in
12"inc_dirs", instead of hardcoding /usr/include/uuid.
13
14Signed-off-by: Adam Duskett <aduskett@gmail.com>
15[Thomas: drop STAGING_DIR based solution, use a solution similar to
16the one used for the NIS detection.]
17Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
18---
19 setup.py | 3 ++-
20 1 file changed, 2 insertions(+), 1 deletion(-)
21
22diff --git a/setup.py b/setup.py
23index 3d0c74bb7f..c7be85f352 100644
24--- a/setup.py
25+++ b/setup.py
26@@ -1866,10 +1866,10 @@ class PyBuildExt(build_ext):
27
28     def detect_uuid(self):
29         # Build the _uuid module if possible
30-        uuid_h = sysconfig.get_config_var("HAVE_UUID_H")
31-        uuid_uuid_h = sysconfig.get_config_var("HAVE_UUID_UUID_H")
32-        if uuid_h or uuid_uuid_h:
33-            if sysconfig.get_config_var("HAVE_LIBUUID"):
34+        uuid_h = find_file("uuid.h", self.inc_dirs,
35+                               [os.path.join(inc_dir, 'uuid') for inc_dir in self.inc_dirs])
36+        if uuid_h is not None:
37+            if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
38                 uuid_libs = ["uuid"]
39             else:
40                 uuid_libs = []
41--
422.25.1
43
44