2
1

0006-distutils-sysconfig-use-sysconfigdata.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From 5855e029370e5636e3eb2283eaa8d11248744eac Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 23 Dec 2015 11:32:23 +0100
  4. Subject: [PATCH] distutils/sysconfig: use sysconfigdata
  5. In order to make the use of sysconfig cross-compilation compatible,
  6. use _sysconfigdata.
  7. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  8. ---
  9. Lib/distutils/sysconfig.py | 37 ++++---------------------------------
  10. 1 file changed, 4 insertions(+), 33 deletions(-)
  11. diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
  12. index 573724d..721edec 100644
  13. --- a/Lib/distutils/sysconfig.py
  14. +++ b/Lib/distutils/sysconfig.py
  15. @@ -414,40 +414,11 @@ def expand_makefile_vars(s, vars):
  16. _config_vars = None
  17. def _init_posix():
  18. - """Initialize the module as appropriate for POSIX systems."""
  19. - g = {}
  20. - # load the installed Makefile:
  21. - try:
  22. - filename = get_makefile_filename()
  23. - parse_makefile(filename, g)
  24. - except OSError as msg:
  25. - my_msg = "invalid Python installation: unable to open %s" % filename
  26. - if hasattr(msg, "strerror"):
  27. - my_msg = my_msg + " (%s)" % msg.strerror
  28. -
  29. - raise DistutilsPlatformError(my_msg)
  30. -
  31. - # load the installed pyconfig.h:
  32. - try:
  33. - filename = get_config_h_filename()
  34. - with open(filename) as file:
  35. - parse_config_h(file, g)
  36. - except OSError as msg:
  37. - my_msg = "invalid Python installation: unable to open %s" % filename
  38. - if hasattr(msg, "strerror"):
  39. - my_msg = my_msg + " (%s)" % msg.strerror
  40. -
  41. - raise DistutilsPlatformError(my_msg)
  42. -
  43. - # On AIX, there are wrong paths to the linker scripts in the Makefile
  44. - # -- these paths are relative to the Python source, but when installed
  45. - # the scripts are in another directory.
  46. - if python_build:
  47. - g['LDSHARED'] = g['BLDSHARED']
  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. -
  54. + _config_vars = {}
  55. + _config_vars.update(build_time_vars)
  56. def _init_nt():
  57. """Initialize the module as appropriate for NT"""
  58. --
  59. 2.7.4