kumquat-buildroot/package/python3/0027-Fix-cross-compiling-the-uuid-module.patch
Vincent Fazio 3fed424566 package/python3: use the provided pyc compiler
Previously, we used support/scripts/pycompile.py to generate the pyc
files for the python libraries.

While the script worked, it did not follow the PEP 3147 layout
requirements for py+pyc deployments.

Now, use the package's own compileall.py script. This will follow
PEP 3147 guidelines. It also supports "legacy" pyc only deployments as
described here:
  https://peps.python.org/pep-3147/#case-4-legacy-pyc-files-and-source-less-imports

With this change, we no longer need to hack support for side-by-side pyc
files because files will be deployed as appropriate.

This also has the added benefit of not requiring python3 on the host to
build host-python3.

Fixes: #14911

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
[yann.morin.1998@free.fr:
  - build-tested in a python-less environment
  - build+run-tested with the runtime-test infra
]
Tested-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2022-07-23 17:23:57 +02:00

44 lines
1.6 KiB
Diff

From d7b90b157eddefbd0ed59e35c90b083c0c03b644 Mon Sep 17 00:00:00 2001
From: Adam Duskett <aduskett@gmail.com>
Date: Fri, 20 Jul 2018 10:17:39 -0400
Subject: [PATCH] Fix cross compiling the uuid module
Python 3.7 has a new _uuid module, however, the include directory
search path for uuid.h is hardcoded to /usr/include/uuid, which should
not be used when cross-compiling.
To fix this, use the same solution as the one used by the NIS
detection: append "uuid" to each of the include directories in
"inc_dirs", instead of hardcoding /usr/include/uuid.
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Thomas: drop STAGING_DIR based solution, use a solution similar to
the one used for the NIS detection.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
setup.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 3d0c74bb7f..c7be85f352 100644
--- a/setup.py
+++ b/setup.py
@@ -1866,10 +1866,10 @@ class PyBuildExt(build_ext):
def detect_uuid(self):
# Build the _uuid module if possible
- uuid_h = sysconfig.get_config_var("HAVE_UUID_H")
- uuid_uuid_h = sysconfig.get_config_var("HAVE_UUID_UUID_H")
- if uuid_h or uuid_uuid_h:
- if sysconfig.get_config_var("HAVE_LIBUUID"):
+ uuid_h = find_file("uuid.h", self.inc_dirs,
+ [os.path.join(inc_dir, 'uuid') for inc_dir in self.inc_dirs])
+ if uuid_h is not None:
+ if self.compiler.find_library_file(self.lib_dirs, 'uuid'):
uuid_libs = ["uuid"]
else:
uuid_libs = []
--
2.25.1