python3-008-distutils-sysconfig-use-sysconfigdata.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. Index: b/Lib/distutils/sysconfig.py
  2. ===================================================================
  3. --- a/Lib/distutils/sysconfig.py
  4. +++ b/Lib/distutils/sysconfig.py
  5. @@ -430,49 +430,11 @@
  6. def _init_posix():
  7. """Initialize the module as appropriate for POSIX systems."""
  8. - g = {}
  9. - # load the installed Makefile:
  10. - try:
  11. - filename = get_makefile_filename()
  12. - parse_makefile(filename, g)
  13. - except OSError as msg:
  14. - my_msg = "invalid Python installation: unable to open %s" % filename
  15. - if hasattr(msg, "strerror"):
  16. - my_msg = my_msg + " (%s)" % msg.strerror
  17. -
  18. - raise DistutilsPlatformError(my_msg)
  19. -
  20. - # load the installed pyconfig.h:
  21. - try:
  22. - filename = get_config_h_filename()
  23. - with open(filename) as file:
  24. - parse_config_h(file, g)
  25. - except OSError as msg:
  26. - my_msg = "invalid Python installation: unable to open %s" % filename
  27. - if hasattr(msg, "strerror"):
  28. - my_msg = my_msg + " (%s)" % msg.strerror
  29. -
  30. - raise DistutilsPlatformError(my_msg)
  31. -
  32. - # On AIX, there are wrong paths to the linker scripts in the Makefile
  33. - # -- these paths are relative to the Python source, but when installed
  34. - # the scripts are in another directory.
  35. - if python_build:
  36. - g['LDSHARED'] = g['BLDSHARED']
  37. -
  38. - elif get_python_version() < '2.1':
  39. - # The following two branches are for 1.5.2 compatibility.
  40. - if sys.platform == 'aix4': # what about AIX 3.x ?
  41. - # Linker script is in the config directory, not in Modules as the
  42. - # Makefile says.
  43. - python_lib = get_python_lib(standard_lib=1)
  44. - ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
  45. - python_exp = os.path.join(python_lib, 'config', 'python.exp')
  46. -
  47. - g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
  48. -
  49. + # _sysconfigdata is generated at build time, see the sysconfig module
  50. + from _sysconfigdata import build_time_vars
  51. global _config_vars
  52. - _config_vars = g
  53. + _config_vars = {}
  54. + _config_vars.update(build_time_vars)
  55. def _init_nt():