kumquat-buildroot/package/python3/0029-fix-building-on-older-distributions.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

39 lines
1.3 KiB
Diff

From 94c62f96ca61f1a28124c837d7ec5ed0b9ae8786 Mon Sep 17 00:00:00 2001
From: Adam Duskett <aduskett@gmail.com>
Date: Thu, 16 Aug 2018 14:52:37 -0700
Subject: [PATCH] fix building on older distributions
Python > 3.6.3 calls os.replace in the update_file.py script, during the
regen-importlib phase of the build process.
According to Doc/whatsnew/3.3.rst line 1631, os.replace acts in the same
way as os.rename, however, it is now cross-platform compatible for Windows.
Because BuildRoot is guaranteed only to be built in POSIX environment, it is
safe to change os.replace back to os.rename.
This change fixes building on older systems such as CentOS7, that only come
with python 2.
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
Tools/scripts/update_file.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Tools/scripts/update_file.py b/Tools/scripts/update_file.py
index 224585c69b..ef458c0c63 100644
--- a/Tools/scripts/update_file.py
+++ b/Tools/scripts/update_file.py
@@ -16,7 +16,7 @@ def main(old_path, new_path):
with open(new_path, 'rb') as f:
new_contents = f.read()
if old_contents != new_contents:
- os.replace(new_path, old_path)
+ os.rename(new_path, old_path)
else:
os.unlink(new_path)
--
2.25.1