python3-006-reread-environment.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Make sure setup.py reads the correct CONFIG_ARGS
  2. The setup.py script that builds and installs all the Python modules
  3. shipped with the interpreter looks at the CONFIG_ARGS variable stored
  4. in the "sysconfig" module to look at the ./configure options and
  5. adjust its behaviour accordingly.
  6. Unfortunately, when cross-compiling, the value of CONFIG_ARGS returned
  7. by the sysconfig are the one passed to the ./configure script of the
  8. *host* Python and not the one we're currently building for the target.
  9. In order to avoid that, we re-initialize the values in the sysconfig
  10. module by re-reading the environment at the beginning of the setup.py
  11. script, and we make sure that the CONFIG_ARGS variable is actually
  12. part of the environment of setup.py.
  13. See the beginning of
  14. http://article.gmane.org/gmane.comp.python.devel/99772 for the
  15. inspiration.
  16. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  17. ---
  18. Makefile.pre.in | 4 +++-
  19. setup.py | 3 +++
  20. 2 files changed, 6 insertions(+), 1 deletion(-)
  21. Index: Python-3.3.0/setup.py
  22. ===================================================================
  23. --- Python-3.3.0.orig/setup.py
  24. +++ Python-3.3.0/setup.py
  25. @@ -30,6 +30,9 @@
  26. # Were we compiled --with-pydebug or with #define Py_DEBUG?
  27. COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
  28. +sysconfig.get_config_vars()
  29. +sysconfig._CONFIG_VARS.update(os.environ)
  30. +
  31. # This global variable is used to hold the list of modules to be disabled.
  32. disabled_module_list = []
  33. Index: Python-3.3.0/Makefile.pre.in
  34. ===================================================================
  35. --- Python-3.3.0.orig/Makefile.pre.in
  36. +++ Python-3.3.0/Makefile.pre.in
  37. @@ -478,6 +478,7 @@
  38. sharedmods: $(BUILDPYTHON) pybuilddir.txt
  39. case $$MAKEFLAGS in *s*) quiet=-q; esac; \
  40. $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
  41. + CONFIG_ARGS="$(CONFIG_ARGS)" \
  42. $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
  43. # Build static library
  44. @@ -1183,7 +1184,8 @@
  45. # Install the dynamically loadable modules
  46. # This goes into $(exec_prefix)
  47. sharedinstall: sharedmods
  48. - $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
  49. + $(RUNSHARED) CONFIG_ARGS="$(CONFIG_ARGS)" \
  50. + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
  51. --prefix=$(prefix) \
  52. --install-scripts=$(BINDIR) \
  53. --install-platlib=$(DESTSHARED) \