0028-fix-building-on-older-distributions.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From e52e2c5e3df4bc3d2ff07ecb3b8e2a9099ea1631 Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <aduskett@gmail.com>
  3. Date: Thu, 16 Aug 2018 14:52:37 -0700
  4. Subject: [PATCH] fix building on older distributions
  5. Python > 3.6.3 calls os.replace in the update_file.py script, during the
  6. regen-importlib phase of the build process.
  7. According to Doc/whatsnew/3.3.rst line 1631, os.replace acts in the same
  8. way as os.rename, however, it is now cross-platform compatible for Windows.
  9. Because BuildRoot is guaranteed only to be built in POSIX environment, it is
  10. safe to change os.replace back to os.rename.
  11. This change fixes building on older systems such as CentOS7, that only come
  12. with python 2.
  13. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  14. ---
  15. Tools/scripts/update_file.py | 4 ++--
  16. 1 file changed, 2 insertions(+), 2 deletions(-)
  17. diff --git a/Tools/scripts/update_file.py b/Tools/scripts/update_file.py
  18. index b4182c1d0c..ab443cb1a6 100644
  19. --- a/Tools/scripts/update_file.py
  20. +++ b/Tools/scripts/update_file.py
  21. @@ -53,7 +53,7 @@ def update_file_with_tmpfile(filename, tmpfile, *, create=False):
  22. if not create:
  23. raise # re-raise
  24. outcome = 'created'
  25. - os.replace(tmpfile, filename)
  26. + os.rename(tmpfile, filename)
  27. else:
  28. with targetfile:
  29. old_contents = targetfile.read()
  30. @@ -62,7 +62,7 @@ def update_file_with_tmpfile(filename, tmpfile, *, create=False):
  31. # Now compare!
  32. if old_contents != new_contents:
  33. outcome = 'updated'
  34. - os.replace(tmpfile, filename)
  35. + os.rename(tmpfile, filename)
  36. else:
  37. outcome = 'same'
  38. os.unlink(tmpfile)
  39. --
  40. 2.34.1