0024-Add-an-option-to-disable-decimal.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From d5fe81cbd51da2a84ed89d1e4c80d921d4efce26 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 23 Dec 2015 11:51:31 +0100
  4. Subject: [PATCH] Add an option to disable decimal
  5. This patch replaces the existing --with-system-libmpdec option with a
  6. --with-libmpdec={system,builtin,none} option, which allows to tell
  7. Python whether we want to use the system libmpdec (already installed),
  8. the libmpdec builtin the Python sources, or no libmpdec at all.
  9. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  10. [aduskett@gmail.com: Update for python 3.7.0]
  11. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  12. [james.hilliard1@gmail.com: adapt to python 3.9]
  13. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
  14. ---
  15. configure.ac | 17 ++++++++++++-----
  16. setup.py | 2 +-
  17. 2 files changed, 13 insertions(+), 6 deletions(-)
  18. diff --git a/configure.ac b/configure.ac
  19. index 7bd4623ccd..e513ef6a20 100644
  20. --- a/configure.ac
  21. +++ b/configure.ac
  22. @@ -3135,13 +3135,20 @@ fi
  23. AC_SUBST(LIBFFI_INCLUDEDIR)
  24. # Check for use of the system libmpdec library
  25. -AC_MSG_CHECKING(for --with-system-libmpdec)
  26. -AC_ARG_WITH(system_libmpdec,
  27. - AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]),
  28. +AC_MSG_CHECKING(for --with-libmpdec)
  29. +AC_ARG_WITH(libmpdec,
  30. + AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]),
  31. [],
  32. - [with_system_libmpdec="no"])
  33. + [with_libmpdec="builtin"])
  34. -AC_MSG_RESULT($with_system_libmpdec)
  35. +AC_MSG_RESULT($with_libmpdec)
  36. +if test "$with_libmpdec" != "none"; then
  37. + MPDEC=yes
  38. +else
  39. + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal"
  40. + MPDEC=no
  41. +fi
  42. +AC_SUBST(MPDEC)
  43. # Check whether _decimal should use a coroutine-local or thread-local context
  44. AC_MSG_CHECKING(for --with-decimal-contextvar)
  45. diff --git a/setup.py b/setup.py
  46. index c4ee989ba3..3d0c74bb7f 100644
  47. --- a/setup.py
  48. +++ b/setup.py
  49. @@ -2195,7 +2195,7 @@ class PyBuildExt(build_ext):
  50. # Stefan Krah's _decimal module
  51. extra_compile_args = []
  52. undef_macros = []
  53. - if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
  54. + if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"):
  55. include_dirs = []
  56. libraries = [':libmpdec.so.2']
  57. sources = ['_decimal/_decimal.c']
  58. --
  59. 2.25.1