xref: /OK3568_Linux_fs/buildroot/package/python3/0030-fix-building-on-older-distributions.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 94c62f96ca61f1a28124c837d7ec5ed0b9ae8786 Mon Sep 17 00:00:00 2001
2From: Adam Duskett <aduskett@gmail.com>
3Date: Thu, 16 Aug 2018 14:52:37 -0700
4Subject: [PATCH] fix building on older distributions
5
6Python > 3.6.3 calls os.replace in the update_file.py script, during the
7regen-importlib phase of the build process.
8
9According to Doc/whatsnew/3.3.rst line 1631, os.replace acts in the same
10way as os.rename, however, it is now cross-platform compatible for Windows.
11
12Because BuildRoot is guaranteed only to be built in  POSIX environment, it is
13safe to change os.replace back to os.rename.
14
15This change fixes building on older systems such as CentOS7, that only come
16with python 2.
17
18Signed-off-by: Adam Duskett <aduskett@gmail.com>
19---
20 Tools/scripts/update_file.py | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
22
23diff --git a/Tools/scripts/update_file.py b/Tools/scripts/update_file.py
24index 224585c69b..ef458c0c63 100644
25--- a/Tools/scripts/update_file.py
26+++ b/Tools/scripts/update_file.py
27@@ -16,7 +16,7 @@ def main(old_path, new_path):
28     with open(new_path, 'rb') as f:
29         new_contents = f.read()
30     if old_contents != new_contents:
31-        os.replace(new_path, old_path)
32+        os.rename(new_path, old_path)
33     else:
34         os.unlink(new_path)
35
36--
372.25.1
38
39