diff --git a/decimal.patch b/decimal.patch new file mode 100644 index 0000000..dc69770 --- /dev/null +++ b/decimal.patch @@ -0,0 +1,33 @@ +diff -ur a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c +--- a/Modules/_decimal/_decimal.c 2021-02-19 13:31:44.000000000 +0100 ++++ b/Modules/_decimal/_decimal.c 2021-02-21 10:25:28.240876775 +0100 +@@ -3280,7 +3280,7 @@ + } + else { + size_t n = strlen(spec.dot); +- if (n > 1 || (n == 1 && !isascii((uchar)spec.dot[0]))) { ++ if (n > 1 || (n == 1 && !isascii((unsigned char)spec.dot[0]))) { + /* fix locale dependent non-ascii characters */ + dot = dotsep_as_utf8(spec.dot); + if (dot == NULL) { +@@ -3289,7 +3289,7 @@ + spec.dot = PyBytes_AS_STRING(dot); + } + n = strlen(spec.sep); +- if (n > 1 || (n == 1 && !isascii((uchar)spec.sep[0]))) { ++ if (n > 1 || (n == 1 && !isascii((unsigned char)spec.sep[0]))) { + /* fix locale dependent non-ascii characters */ + sep = dotsep_as_utf8(spec.sep); + if (sep == NULL) { +diff -ur a/setup.py b/setup.py +--- a/setup.py 2021-02-19 13:31:44.000000000 +0100 ++++ b/setup.py 2021-02-21 10:25:28.240876775 +0100 +@@ -2196,7 +2196,7 @@ + undef_macros = [] + if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"): + include_dirs = [] +- libraries = [':libmpdec.so.2'] ++ libraries = ['mpdec'] + sources = ['_decimal/_decimal.c'] + depends = ['_decimal/docstrings.h'] + else: diff --git a/python39.changes b/python39.changes index d7928c7..c8f7856 100644 --- a/python39.changes +++ b/python39.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Aug 27 12:00:12 UTC 2021 - Matej Cepl + +- Add decimal.patch to add building with --with-system-libmpdec + option (bsc#1189356). + ------------------------------------------------------------------- Thu Aug 26 11:25:12 UTC 2021 - Andreas Schwab diff --git a/python39.spec b/python39.spec index 0e68ede..f7c9451 100644 --- a/python39.spec +++ b/python39.spec @@ -76,6 +76,12 @@ %if "%{_arch}" == "arm" %define armsuffix hf %endif +# Decide whether we want to use mpdecimal +%if 0%{?suse_version} >= 1550 +%bcond_without mpdecimal +%else +%bcond_with mpdecimal +%endif # pyexpat.cpython-35m-x86_64-linux-gnu # pyexpat.cpython-35m-powerpc64le-linux-gnu # pyexpat.cpython-35m-armv7-linux-gnueabihf @@ -120,6 +126,10 @@ Patch02: F00251-change-user-install-location.patch # PATCH-FEATURE-UPSTREAM distutils-reproducible-compile.patch gh#python/cpython#8057 mcepl@suse.com # Improve reproduceability Patch06: distutils-reproducible-compile.patch +# PATCH-FEATURE-UPSTREAM decimal.patch bsc#1189356 mcepl@suse.com +# fix building with mpdecimal +# https://www.bytereef.org/contrib/decimal.diff +Patch05: decimal.patch # support finding packages in /usr/local, install to /usr/local by default Patch07: python-3.3.0b1-localpath.patch # replace DATE, TIME and COMPILER by fixed definitions to aid reproducible builds @@ -159,6 +169,9 @@ BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(libnsl) BuildRequires: pkgconfig(libtirpc) %endif +%if %{with mpdecimal} +BuildRequires: mpdecimal-devel +%endif %if %{with doc} %if 0%{?suse_version} >= 1550 BuildRequires: %{python_pkg_name}-Sphinx @@ -389,6 +402,9 @@ other applications. %if 0%{?sle_version} && 0%{?sle_version} <= 150300 %patch34 -p1 %endif +%if %{with mpdecimal} +%patch05 -p1 +%endif # drop Autoconf version requirement sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac @@ -450,6 +466,9 @@ export CFLAGS="%{optflags} -IVendor/" --with-lto \ %if %{with profileopt} --enable-optimizations \ +%endif +%if %{with mpdecimal} + --with-system-libmpdec \ %endif --enable-loadable-sqlite-extensions