0006-Add-minimal-infrastructure-to-be-able-to-disable-ext.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From 94ec96dd8827adfb5e272d28a4d76510e28657b3 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Tue, 7 Mar 2017 22:21:28 +0100
  4. Subject: [PATCH] Add minimal infrastructure to be able to disable extensions
  5. This commit adds some logic to the Python build system to be able to
  6. disable Python extensions. Follow-up commits actually add options to
  7. disable specific extensions.
  8. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  9. [Peter: update for 2.7.16]
  10. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  11. ---
  12. Makefile.pre.in | 6 +++++-
  13. configure.ac | 2 ++
  14. setup.py | 5 ++++-
  15. 3 files changed, 11 insertions(+), 2 deletions(-)
  16. diff --git a/Makefile.pre.in b/Makefile.pre.in
  17. index 247d3c2902..c1c98ecc5a 100644
  18. --- a/Makefile.pre.in
  19. +++ b/Makefile.pre.in
  20. @@ -160,6 +160,8 @@ FILEMODE= 644
  21. # configure script arguments
  22. CONFIG_ARGS= @CONFIG_ARGS@
  23. +# disabled extensions
  24. +DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
  25. # Subdirectories with code
  26. SRCDIRS= @SRCDIRS@
  27. @@ -528,6 +530,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
  28. esac; \
  29. $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
  30. _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
  31. + DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
  32. $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
  33. # Build static library
  34. @@ -1280,7 +1283,8 @@ libainstall: @DEF_MAKE_RULE@ python-config
  35. # Install the dynamically loadable modules
  36. # This goes into $(exec_prefix)
  37. sharedinstall: sharedmods
  38. - $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
  39. + $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
  40. + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
  41. --prefix=$(prefix) \
  42. --install-scripts=$(BINDIR) \
  43. --install-platlib=$(DESTSHARED) \
  44. diff --git a/configure.ac b/configure.ac
  45. index 77ca6d86ca..13f90b3ddd 100644
  46. --- a/configure.ac
  47. +++ b/configure.ac
  48. @@ -2491,6 +2491,8 @@ LIBS="$withval $LIBS"
  49. PKG_PROG_PKG_CONFIG
  50. +AC_SUBST(DISABLED_EXTENSIONS)
  51. +
  52. # Check for use of the system expat library
  53. AC_MSG_CHECKING(for --with-system-expat)
  54. AC_ARG_WITH(system_expat,
  55. diff --git a/setup.py b/setup.py
  56. index 812d53d560..d426dd02ea 100644
  57. --- a/setup.py
  58. +++ b/setup.py
  59. @@ -33,7 +33,10 @@ host_platform = get_platform()
  60. COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
  61. # This global variable is used to hold the list of modules to be disabled.
  62. -disabled_module_list = []
  63. +try:
  64. + disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
  65. +except KeyError:
  66. + disabled_module_list = list()
  67. def add_dir_to_list(dirlist, dir):
  68. """Add the directory 'dir' to the list 'dirlist' (at the front) if
  69. --
  70. 2.11.0