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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. From 977de9474c1fb46359ab6a487e153fbd91a2b568 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. ---
  10. Makefile.pre.in | 6 +++++-
  11. configure.ac | 2 ++
  12. setup.py | 5 ++++-
  13. 3 files changed, 11 insertions(+), 2 deletions(-)
  14. diff --git a/Makefile.pre.in b/Makefile.pre.in
  15. index 96fc718..33b994d 100644
  16. --- a/Makefile.pre.in
  17. +++ b/Makefile.pre.in
  18. @@ -161,6 +161,8 @@ FILEMODE= 644
  19. # configure script arguments
  20. CONFIG_ARGS= @CONFIG_ARGS@
  21. +# disabled extensions
  22. +DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
  23. # Subdirectories with code
  24. SRCDIRS= @SRCDIRS@
  25. @@ -548,6 +550,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
  26. esac; \
  27. $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
  28. _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
  29. + DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
  30. $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
  31. # Build static library
  32. @@ -1269,7 +1272,8 @@ libainstall: all python-config
  33. # Install the dynamically loadable modules
  34. # This goes into $(exec_prefix)
  35. sharedinstall: sharedmods
  36. - $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
  37. + $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
  38. + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
  39. --prefix=$(prefix) \
  40. --install-scripts=$(BINDIR) \
  41. --install-platlib=$(DESTSHARED) \
  42. diff --git a/configure.ac b/configure.ac
  43. index 63e6918..5d4232f 100644
  44. --- a/configure.ac
  45. +++ b/configure.ac
  46. @@ -2462,6 +2462,8 @@ LIBS="$withval $LIBS"
  47. PKG_PROG_PKG_CONFIG
  48. +AC_SUBST(DISABLED_EXTENSIONS)
  49. +
  50. # Check for use of the system expat library
  51. AC_MSG_CHECKING(for --with-system-expat)
  52. AC_ARG_WITH(system_expat,
  53. diff --git a/setup.py b/setup.py
  54. index 64001e2..3b51c0a 100644
  55. --- a/setup.py
  56. +++ b/setup.py
  57. @@ -33,7 +33,10 @@ host_platform = get_platform()
  58. COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
  59. # This global variable is used to hold the list of modules to be disabled.
  60. -disabled_module_list = []
  61. +try:
  62. + disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
  63. +except KeyError:
  64. + disabled_module_list = list()
  65. def add_dir_to_list(dirlist, dir):
  66. """Add the directory 'dir' to the list 'dirlist' (at the front) if
  67. --
  68. 2.7.4