Accepting request 915024 from home:mcepl:python-libmpdec

- Add decimal.patch to add building with --with-system-libmpdec
  option (bsc#1189356).

OBS-URL: https://build.opensuse.org/request/show/915024
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python39?expand=0&rev=82
This commit is contained in:
Matej Cepl 2021-08-30 11:54:55 +00:00 committed by Git OBS Bridge
parent 6a5249892f
commit 0150e36f11
3 changed files with 58 additions and 0 deletions

33
decimal.patch Normal file
View File

@ -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:

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Aug 27 12:00:12 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Add decimal.patch to add building with --with-system-libmpdec
option (bsc#1189356).
-------------------------------------------------------------------
Thu Aug 26 11:25:12 UTC 2021 - Andreas Schwab <schwab@suse.de>

View File

@ -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