1*4882a593SmuzhiyunFrom 94c62f96ca61f1a28124c837d7ec5ed0b9ae8786 Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Adam Duskett <aduskett@gmail.com> 3*4882a593SmuzhiyunDate: Thu, 16 Aug 2018 14:52:37 -0700 4*4882a593SmuzhiyunSubject: [PATCH] fix building on older distributions 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunPython > 3.6.3 calls os.replace in the update_file.py script, during the 7*4882a593Smuzhiyunregen-importlib phase of the build process. 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunAccording to Doc/whatsnew/3.3.rst line 1631, os.replace acts in the same 10*4882a593Smuzhiyunway as os.rename, however, it is now cross-platform compatible for Windows. 11*4882a593Smuzhiyun 12*4882a593SmuzhiyunBecause BuildRoot is guaranteed only to be built in POSIX environment, it is 13*4882a593Smuzhiyunsafe to change os.replace back to os.rename. 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunThis change fixes building on older systems such as CentOS7, that only come 16*4882a593Smuzhiyunwith python 2. 17*4882a593Smuzhiyun 18*4882a593SmuzhiyunSigned-off-by: Adam Duskett <aduskett@gmail.com> 19*4882a593Smuzhiyun--- 20*4882a593Smuzhiyun Tools/scripts/update_file.py | 2 +- 21*4882a593Smuzhiyun 1 file changed, 1 insertion(+), 1 deletion(-) 22*4882a593Smuzhiyun 23*4882a593Smuzhiyundiff --git a/Tools/scripts/update_file.py b/Tools/scripts/update_file.py 24*4882a593Smuzhiyunindex 224585c69b..ef458c0c63 100644 25*4882a593Smuzhiyun--- a/Tools/scripts/update_file.py 26*4882a593Smuzhiyun+++ b/Tools/scripts/update_file.py 27*4882a593Smuzhiyun@@ -16,7 +16,7 @@ def main(old_path, new_path): 28*4882a593Smuzhiyun with open(new_path, 'rb') as f: 29*4882a593Smuzhiyun new_contents = f.read() 30*4882a593Smuzhiyun if old_contents != new_contents: 31*4882a593Smuzhiyun- os.replace(new_path, old_path) 32*4882a593Smuzhiyun+ os.rename(new_path, old_path) 33*4882a593Smuzhiyun else: 34*4882a593Smuzhiyun os.unlink(new_path) 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun-- 37*4882a593Smuzhiyun2.25.1 38*4882a593Smuzhiyun 39