Accepting request 952081 from devel:languages:python:numeric
- Add sherpa-pr1318-py310tests.patch -- gh#sherpa/sherpa#1318 - Skip two tests failing on non x86_64 due to floating point precision - Disable 32-bit ARM build - Add sherpa-pr1319-distutils-hack.patch -- another attempt for python310 compatibility (gh#sherpa/sherpa#1319) OBS-URL: https://build.opensuse.org/request/show/952081 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-sherpa?expand=0&rev=12
This commit is contained in:
commit
e635a6f41a
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 4 17:05:32 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Add sherpa-pr1318-py310tests.patch -- gh#sherpa/sherpa#1318
|
||||
- Skip two tests failing on non x86_64 due to floating point
|
||||
precision
|
||||
- Disable 32-bit ARM build
|
||||
- Add sherpa-pr1319-distutils-hack.patch -- another attempt for
|
||||
python310 compatibility (gh#sherpa/sherpa#1319)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 3 13:21:21 UTC 2021 - Guillaume GARDET <guillaume.gardet@opensuse.org>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-sherpa
|
||||
#
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -16,9 +16,8 @@
|
||||
#
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%{?!python_module:%define python_module() python3-%{**}}
|
||||
%define skip_python2 1
|
||||
%define skip_python36 1
|
||||
Name: python-sherpa
|
||||
Version: 4.14.0
|
||||
Release: 0
|
||||
@ -27,8 +26,12 @@ License: GPL-3.0-only
|
||||
URL: https://github.com/sherpa/sherpa/
|
||||
Source: https://github.com/sherpa/sherpa/archive/%{version}.tar.gz#/sherpa-%{version}.tar.gz
|
||||
Patch1: reproducible.patch
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module numpy-devel}
|
||||
# PATCH-FIX-UPSTREAM sherpa-pr1318-py310tests.patch -- gh#sherpa/sherpa#1319
|
||||
Patch2: https://github.com/sherpa/sherpa/pull/1318.patch#/sherpa-pr1318-py310tests.patch
|
||||
# PATCH-FIX-UPSTREAM sherpa-pr1319-distutils-hack.patch -- gh#sherpa/sherpa#1319
|
||||
Patch3: sherpa-pr1319-distutils-hack.patch
|
||||
BuildRequires: %{python_module devel >= 3.7}
|
||||
BuildRequires: %{python_module numpy-devel >= 1.19}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: bison
|
||||
BuildRequires: fdupes
|
||||
@ -37,11 +40,10 @@ BuildRequires: flex
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: gcc-fortran
|
||||
BuildRequires: python-rpm-macros
|
||||
# 4.14.0 requires numpy minimum 1.19 (numpy 1.18 minimum for python 3.7/8)
|
||||
Requires: python-numpy >= 1.18
|
||||
Requires: python-numpy >= 1.19
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
ExcludeArch: %{ix86}
|
||||
ExcludeArch: %{ix86} %{arm}
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module pytest >= 3.3}
|
||||
BuildRequires: %{python_module pytest-xvfb}
|
||||
@ -59,6 +61,7 @@ data, using a variety of statistics and optimization methods.
|
||||
%prep
|
||||
%setup -q -n sherpa-%{version}
|
||||
%autopatch -p1
|
||||
# uncomment system libs
|
||||
sed -i "s|#fftw=local|fftw=local|" setup.cfg
|
||||
sed -i "s|#fftw-include[-_]dirs.*$|fftw-include-dirs=%{_includedir}|" setup.cfg
|
||||
sed -i "s|#fftw-lib-dirs.*$|fftw-lib-dirs=%{_libdir}|" setup.cfg
|
||||
@ -92,6 +95,11 @@ sed -i "1{/\\/usr\\/bin\\/env python/d}" %{buildroot}%{$python_sitearch}/sherpa/
|
||||
mv sherpa sherpa_temp
|
||||
# astropy 4.2 fits header warning
|
||||
donttest+="test_load_case_3"
|
||||
# precision issues
|
||||
%ifnarch x86_64
|
||||
donttest+=" or (test_regproj and sherpa.plot.dummy_backend)"
|
||||
donttest+=" or (test_fit_single and Chi2XspecVar)"
|
||||
%endif
|
||||
%pytest_arch --pyargs sherpa -k "not ($donttest)"
|
||||
|
||||
%post
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dc093e66af091f3d77927e27a36f404819d224646d0e4873029a85ecc8ea334d
|
||||
size 13071671
|
||||
oid sha256:b25967d121d7309533001c9cc6ddda4619bf69a3cc27801683386d0d810c7cd7
|
||||
size 13071660
|
||||
|
179
sherpa-pr1318-py310tests.patch
Normal file
179
sherpa-pr1318-py310tests.patch
Normal file
@ -0,0 +1,179 @@
|
||||
From cdaa402d8014e689085a1d7dae3237a82d8b8af4 Mon Sep 17 00:00:00 2001
|
||||
From: Douglas Burke <dburke.gw@gmail.com>
|
||||
Date: Thu, 7 Oct 2021 16:18:14 -0400
|
||||
Subject: [PATCH 1/2] Tests: split up the test_export_method test
|
||||
|
||||
Break up the test into a number of smaller checks (we could go
|
||||
more fine-grained but let's see how this works).
|
||||
---
|
||||
sherpa/utils/tests/test_utils.py | 67 ++++++++++++++++++++------------
|
||||
1 file changed, 43 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/sherpa/utils/tests/test_utils.py b/sherpa/utils/tests/test_utils.py
|
||||
index 481e97c73..707281f13 100644
|
||||
--- a/sherpa/utils/tests/test_utils.py
|
||||
+++ b/sherpa/utils/tests/test_utils.py
|
||||
@@ -75,34 +75,36 @@ def __init__(self):
|
||||
c.z = 5
|
||||
|
||||
|
||||
-def test_export_method():
|
||||
- class C():
|
||||
+class C():
|
||||
|
||||
- def m(self, x, y=2):
|
||||
- 'Instance method m()'
|
||||
- return x * y
|
||||
+ def m(self, x, y=2):
|
||||
+ 'Instance method m()'
|
||||
+ return x * y
|
||||
|
||||
- def margs(self, x, y=2, *args):
|
||||
- 'Instance method margs() with *args'
|
||||
- return x * y + len(args)
|
||||
+ def margs(self, x, y=2, *args):
|
||||
+ 'Instance method margs() with *args'
|
||||
+ return x * y + len(args)
|
||||
|
||||
- def kwargs(self, x, y=2, **kwargs):
|
||||
- 'Instance method kwargs() with **kwargs'
|
||||
- return x * y + 2 * len(kwargs)
|
||||
+ def kwargs(self, x, y=2, **kwargs):
|
||||
+ 'Instance method kwargs() with **kwargs'
|
||||
+ return x * y + 2 * len(kwargs)
|
||||
|
||||
- def bargs(self, x, y=2, *args, **kwargs):
|
||||
- 'Instance method bargs() with *args and **kwargs'
|
||||
- return x * y + len(args) + 2 * len(kwargs)
|
||||
+ def bargs(self, x, y=2, *args, **kwargs):
|
||||
+ 'Instance method bargs() with *args and **kwargs'
|
||||
+ return x * y + len(args) + 2 * len(kwargs)
|
||||
|
||||
- @classmethod
|
||||
- def cm(klass, x, y=2):
|
||||
- 'Class method cm()'
|
||||
- return x * y
|
||||
+ @classmethod
|
||||
+ def cm(klass, x, y=2):
|
||||
+ 'Class method cm()'
|
||||
+ return x * y
|
||||
|
||||
- @staticmethod
|
||||
- def sm(x, y=2):
|
||||
- 'Static method sm()'
|
||||
- return x * y
|
||||
+ @staticmethod
|
||||
+ def sm(x, y=2):
|
||||
+ 'Static method sm()'
|
||||
+ return x * y
|
||||
+
|
||||
+
|
||||
+def test_export_method_basic():
|
||||
|
||||
c = C()
|
||||
|
||||
@@ -124,13 +126,26 @@ def sm(x, y=2):
|
||||
"missing 1 required positional argument: 'x'"
|
||||
assert str(exc.value) == emsg
|
||||
|
||||
+
|
||||
+def test_export_method_args_call():
|
||||
+
|
||||
# Check that *args/**kwargs are handled correctly for methods;
|
||||
# should perhaps be included above to avoid repeated calls
|
||||
# to export_method?
|
||||
#
|
||||
+ c = C()
|
||||
meth = utils.export_method(c.margs)
|
||||
assert meth(3, 7, "a", "b") == 23
|
||||
|
||||
+ meth = utils.export_method(c.bargs)
|
||||
+ assert meth(3, 7, 14, 15, foo=None) == 25
|
||||
+
|
||||
+
|
||||
+def test_export_method_args_errors():
|
||||
+
|
||||
+ c = C()
|
||||
+ meth = utils.export_method(c.margs)
|
||||
+
|
||||
with pytest.raises(TypeError) as exc:
|
||||
meth(12, dummy=None)
|
||||
|
||||
@@ -147,8 +162,8 @@ def sm(x, y=2):
|
||||
"but 3 were given"
|
||||
assert str(exc.value) in emsg
|
||||
|
||||
- meth = utils.export_method(c.bargs)
|
||||
- assert meth(3, 7, 14, 15, foo=None) == 25
|
||||
+
|
||||
+def test_export_method_non_method():
|
||||
|
||||
# Non-method argument
|
||||
def f(x):
|
||||
@@ -156,7 +171,11 @@ def f(x):
|
||||
|
||||
assert utils.export_method(f) is f
|
||||
|
||||
+
|
||||
+def test_export_method_names():
|
||||
+
|
||||
# Name and module name
|
||||
+ c = C()
|
||||
m = utils.export_method(c.m, 'foo', 'bar')
|
||||
assert m.__name__ == 'foo'
|
||||
assert m.__module__ == 'bar'
|
||||
|
||||
From c189084bd620010bda0a23ab6e6499a598f53cdc Mon Sep 17 00:00:00 2001
|
||||
From: Douglas Burke <dburke.gw@gmail.com>
|
||||
Date: Thu, 7 Oct 2021 16:37:48 -0400
|
||||
Subject: [PATCH 2/2] Tests: update export_method tests for Python 3.10
|
||||
|
||||
There is a change to how an error message appears for a static
|
||||
method in Python 3.10 (it now includes the original class name).
|
||||
This is not ideal, but for now we adjust the test rather than
|
||||
try to work out whether the code can be changed.
|
||||
|
||||
This is something of an edge case.
|
||||
---
|
||||
sherpa/utils/tests/test_utils.py | 20 +++++++++++++++++---
|
||||
1 file changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/sherpa/utils/tests/test_utils.py b/sherpa/utils/tests/test_utils.py
|
||||
index 707281f13..6fa32b7ff 100644
|
||||
--- a/sherpa/utils/tests/test_utils.py
|
||||
+++ b/sherpa/utils/tests/test_utils.py
|
||||
@@ -108,7 +108,11 @@ def test_export_method_basic():
|
||||
|
||||
c = C()
|
||||
|
||||
- # Basic usage
|
||||
+ # Basic usage. The error message depends on
|
||||
+ # a) Python version
|
||||
+ # b) what method is being wrapped
|
||||
+ # (before Python 3.10 it didn't).
|
||||
+ #
|
||||
for meth in (c.m, c.margs, c.kwargs, c.bargs, c.cm, c.sm):
|
||||
m = utils.export_method(meth)
|
||||
|
||||
@@ -122,9 +126,19 @@ def test_export_method_basic():
|
||||
with pytest.raises(TypeError) as exc:
|
||||
m()
|
||||
|
||||
- emsg = "{}() ".format(meth.__name__) + \
|
||||
+ emsg = f"{meth.__name__}() " + \
|
||||
"missing 1 required positional argument: 'x'"
|
||||
- assert str(exc.value) == emsg
|
||||
+
|
||||
+ if meth.__name__ == 'sm':
|
||||
+ # In Python 3.10 we see C.sm rather than sm
|
||||
+ # so we search for both. We could be more explicit
|
||||
+ # and check on the Python version (e.g. for >= 3.10)
|
||||
+ # but it doesn't seem worth it. It's interesting it's
|
||||
+ # only for the static method.
|
||||
+ #
|
||||
+ assert str(exc.value) in [emsg, 'C.' + emsg]
|
||||
+ else:
|
||||
+ assert str(exc.value) == emsg
|
||||
|
||||
|
||||
def test_export_method_args_call():
|
431
sherpa-pr1319-distutils-hack.patch
Normal file
431
sherpa-pr1319-distutils-hack.patch
Normal file
@ -0,0 +1,431 @@
|
||||
From bf1424d43f04236d5c004520aa98c58a07de7d9a Mon Sep 17 00:00:00 2001
|
||||
From: Douglas Burke <dburke.gw@gmail.com>
|
||||
Date: Thu, 7 Oct 2021 17:48:48 -0400
|
||||
Subject: [PATCH 1/3] HACK to build stklib with Python 3.10
|
||||
|
||||
This is very not-sensible
|
||||
---
|
||||
extern/stklib-4.11/configure | 48 ++++++++++++------------
|
||||
extern/stklib-4.11/m4/AX_PYTHON_DEVEL.m4 | 38 +++++++++----------
|
||||
2 files changed, 42 insertions(+), 44 deletions(-)
|
||||
|
||||
diff --git a/extern/stklib-4.11/configure b/extern/stklib-4.11/configure
|
||||
index b80b47bb94..65ecf99c5d 100755
|
||||
--- a/extern/stklib-4.11/configure
|
||||
+++ b/extern/stklib-4.11/configure
|
||||
@@ -12106,7 +12106,7 @@ $am_python_setup_sysconfig
|
||||
if can_use_sysconfig:
|
||||
sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
|
||||
else:
|
||||
- from distutils import sysconfig
|
||||
+ from setuptools._distutils import sysconfig
|
||||
sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
|
||||
sys.stdout.write(sitedir)"`
|
||||
case $am_cv_python_pythondir in
|
||||
@@ -12150,7 +12150,7 @@ $am_python_setup_sysconfig
|
||||
if can_use_sysconfig:
|
||||
sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
|
||||
else:
|
||||
- from distutils import sysconfig
|
||||
+ from setuptools._distutils import sysconfig
|
||||
sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
|
||||
sys.stdout.write(sitedir)"`
|
||||
case $am_cv_python_pyexecdir in
|
||||
@@ -12291,18 +12291,18 @@ variable to configure. See \`\`configure --help'' for reference.
|
||||
fi
|
||||
|
||||
#
|
||||
- # Check if you have distutils, else fail
|
||||
+ # Check if you have setuptools._distutils, else fail
|
||||
#
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5
|
||||
-$as_echo_n "checking for the distutils Python package... " >&6; }
|
||||
- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the setuptools._distutils Python package" >&5
|
||||
+$as_echo_n "checking for the setuptools._distutils Python package... " >&6; }
|
||||
+ ac_distutils_result=`$PYTHON -c "import setuptools._distutils" 2>&1`
|
||||
if test -z "$ac_distutils_result"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
- as_fn_error $? "cannot import Python module \"distutils\".
|
||||
+ as_fn_error $? "cannot import Python module \"setuptools._distutils\".
|
||||
Please check your Python installation. The error was:
|
||||
$ac_distutils_result" "$LINENO" 5
|
||||
PYTHON_VERSION=""
|
||||
@@ -12314,10 +12314,10 @@ $ac_distutils_result" "$LINENO" 5
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5
|
||||
$as_echo_n "checking for Python include path... " >&6; }
|
||||
if test -z "$PYTHON_CPPFLAGS"; then
|
||||
- python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_inc ());"`
|
||||
- plat_python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_inc (plat_specific=1));"`
|
||||
+ python_path=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_inc ());"`
|
||||
+ plat_python_path=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_inc (plat_specific=1));"`
|
||||
if test -n "${python_path}"; then
|
||||
if test "${plat_python_path}" != "${python_path}"; then
|
||||
python_path="-I$python_path -I$plat_python_path"
|
||||
@@ -12343,7 +12343,7 @@ $as_echo_n "checking for Python library path... " >&6; }
|
||||
|
||||
# join all versioning strings, on some systems
|
||||
# major/minor numbers could be in different list elements
|
||||
-from distutils.sysconfig import *
|
||||
+from setuptools._distutils.sysconfig import *
|
||||
e = get_config_var('VERSION')
|
||||
if e is not None:
|
||||
print(e)
|
||||
@@ -12369,8 +12369,8 @@ _ACEOF
|
||||
ac_python_libdir=`cat<<EOD | $PYTHON -
|
||||
|
||||
# There should be only one
|
||||
-import distutils.sysconfig
|
||||
-e = distutils.sysconfig.get_config_var('LIBDIR')
|
||||
+import setuptools._distutils.sysconfig
|
||||
+e = setuptools._distutils.sysconfig.get_config_var('LIBDIR')
|
||||
if e is not None:
|
||||
print (e)
|
||||
EOD`
|
||||
@@ -12378,8 +12378,8 @@ EOD`
|
||||
# Now, for the library:
|
||||
ac_python_library=`cat<<EOD | $PYTHON -
|
||||
|
||||
-import distutils.sysconfig
|
||||
-c = distutils.sysconfig.get_config_vars()
|
||||
+import setuptools._distutils.sysconfig
|
||||
+c = setuptools._distutils.sysconfig.get_config_vars()
|
||||
if 'LDVERSION' in c:
|
||||
print ('python'+c['LDVERSION'])
|
||||
else:
|
||||
@@ -12398,7 +12398,7 @@ EOD`
|
||||
else
|
||||
# old way: use libpython from python_configdir
|
||||
ac_python_libdir=`$PYTHON -c \
|
||||
- "from distutils.sysconfig import get_python_lib as f; \
|
||||
+ "from setuptools._distutils.sysconfig import get_python_lib as f; \
|
||||
import os; \
|
||||
print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
|
||||
PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
|
||||
@@ -12421,8 +12421,8 @@ $as_echo "$PYTHON_LDFLAGS" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5
|
||||
$as_echo_n "checking for Python site-packages path... " >&6; }
|
||||
if test -z "$PYTHON_SITE_PKG"; then
|
||||
- PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_lib(0,0));"`
|
||||
+ PYTHON_SITE_PKG=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_lib(0,0));"`
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5
|
||||
$as_echo "$PYTHON_SITE_PKG" >&6; }
|
||||
@@ -12434,8 +12434,8 @@ $as_echo "$PYTHON_SITE_PKG" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5
|
||||
$as_echo_n "checking python extra libraries... " >&6; }
|
||||
if test -z "$PYTHON_EXTRA_LIBS"; then
|
||||
- PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
+ PYTHON_EXTRA_LIBS=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ conf = setuptools._distutils.sysconfig.get_config_var; \
|
||||
print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5
|
||||
@@ -12448,8 +12448,8 @@ $as_echo "$PYTHON_EXTRA_LIBS" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5
|
||||
$as_echo_n "checking python extra linking flags... " >&6; }
|
||||
if test -z "$PYTHON_EXTRA_LDFLAGS"; then
|
||||
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
+ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ conf = setuptools._distutils.sysconfig.get_config_var; \
|
||||
print (conf('LINKFORSHARED'))"`
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5
|
||||
@@ -15423,5 +15423,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
|
||||
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
|
||||
fi
|
||||
-
|
||||
-
|
||||
diff --git a/extern/stklib-4.11/m4/AX_PYTHON_DEVEL.m4 b/extern/stklib-4.11/m4/AX_PYTHON_DEVEL.m4
|
||||
index 266179e146..97bf2c956d 100644
|
||||
--- a/extern/stklib-4.11/m4/AX_PYTHON_DEVEL.m4
|
||||
+++ b/extern/stklib-4.11/m4/AX_PYTHON_DEVEL.m4
|
||||
@@ -135,13 +135,13 @@ variable to configure. See ``configure --help'' for reference.
|
||||
#
|
||||
# Check if you have distutils, else fail
|
||||
#
|
||||
- AC_MSG_CHECKING([for the distutils Python package])
|
||||
- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
|
||||
+ AC_MSG_CHECKING([for the distutils/setuptools Python package])
|
||||
+ ac_distutils_result=`$PYTHON -c "import setuptools._distutils" 2>&1`
|
||||
if test -z "$ac_distutils_result"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
- AC_MSG_ERROR([cannot import Python module "distutils".
|
||||
+ AC_MSG_ERROR([cannot import Python module "distutils/setuptools".
|
||||
Please check your Python installation. The error was:
|
||||
$ac_distutils_result])
|
||||
PYTHON_VERSION=""
|
||||
@@ -152,10 +152,10 @@ $ac_distutils_result])
|
||||
#
|
||||
AC_MSG_CHECKING([for Python include path])
|
||||
if test -z "$PYTHON_CPPFLAGS"; then
|
||||
- python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_inc ());"`
|
||||
- plat_python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_inc (plat_specific=1));"`
|
||||
+ python_path=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_inc ());"`
|
||||
+ plat_python_path=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_inc (plat_specific=1));"`
|
||||
if test -n "${python_path}"; then
|
||||
if test "${plat_python_path}" != "${python_path}"; then
|
||||
python_path="-I$python_path -I$plat_python_path"
|
||||
@@ -179,7 +179,7 @@ $ac_distutils_result])
|
||||
|
||||
# join all versioning strings, on some systems
|
||||
# major/minor numbers could be in different list elements
|
||||
-from distutils.sysconfig import *
|
||||
+from setuptools._distutils.sysconfig import *
|
||||
e = get_config_var('VERSION')
|
||||
if e is not None:
|
||||
print(e)
|
||||
@@ -202,8 +202,8 @@ EOD`
|
||||
ac_python_libdir=`cat<<EOD | $PYTHON -
|
||||
|
||||
# There should be only one
|
||||
-import distutils.sysconfig
|
||||
-e = distutils.sysconfig.get_config_var('LIBDIR')
|
||||
+import setuptools._distutils.sysconfig
|
||||
+e = setuptools._distutils.sysconfig.get_config_var('LIBDIR')
|
||||
if e is not None:
|
||||
print (e)
|
||||
EOD`
|
||||
@@ -211,8 +211,8 @@ EOD`
|
||||
# Now, for the library:
|
||||
ac_python_library=`cat<<EOD | $PYTHON -
|
||||
|
||||
-import distutils.sysconfig
|
||||
-c = distutils.sysconfig.get_config_vars()
|
||||
+import setuptools._distutils.sysconfig
|
||||
+c = setuptools._distutils.sysconfig.get_config_vars()
|
||||
if 'LDVERSION' in c:
|
||||
print ('python'+c[['LDVERSION']])
|
||||
else:
|
||||
@@ -231,7 +231,7 @@ EOD`
|
||||
else
|
||||
# old way: use libpython from python_configdir
|
||||
ac_python_libdir=`$PYTHON -c \
|
||||
- "from distutils.sysconfig import get_python_lib as f; \
|
||||
+ "from setuptools._distutils.sysconfig import get_python_lib as f; \
|
||||
import os; \
|
||||
print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
|
||||
PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
|
||||
@@ -252,8 +252,8 @@ EOD`
|
||||
#
|
||||
AC_MSG_CHECKING([for Python site-packages path])
|
||||
if test -z "$PYTHON_SITE_PKG"; then
|
||||
- PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_lib(0,0));"`
|
||||
+ PYTHON_SITE_PKG=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_lib(0,0));"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_SITE_PKG])
|
||||
AC_SUBST([PYTHON_SITE_PKG])
|
||||
@@ -263,8 +263,8 @@ EOD`
|
||||
#
|
||||
AC_MSG_CHECKING(python extra libraries)
|
||||
if test -z "$PYTHON_EXTRA_LIBS"; then
|
||||
- PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
+ PYTHON_EXTRA_LIBS=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ conf = setuptools._distutils.sysconfig.get_config_var; \
|
||||
print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
|
||||
@@ -275,8 +275,8 @@ EOD`
|
||||
#
|
||||
AC_MSG_CHECKING(python extra linking flags)
|
||||
if test -z "$PYTHON_EXTRA_LDFLAGS"; then
|
||||
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
+ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ conf = setuptools._distutils.sysconfig.get_config_var; \
|
||||
print (conf('LINKFORSHARED'))"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
|
||||
|
||||
From fa45219304babfe3b24bdf8b9d2edbe3e73a0b2f Mon Sep 17 00:00:00 2001
|
||||
From: Douglas Burke <dburke.gw@gmail.com>
|
||||
Date: Thu, 7 Oct 2021 17:50:24 -0400
|
||||
Subject: [PATCH 2/3] HACK grplib for python 3.10/distutils
|
||||
|
||||
---
|
||||
extern/grplib-4.9/configure | 48 ++++++++++++++++++-------------------
|
||||
1 file changed, 23 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/extern/grplib-4.9/configure b/extern/grplib-4.9/configure
|
||||
index 132a9e0497..2051e71d65 100755
|
||||
--- a/extern/grplib-4.9/configure
|
||||
+++ b/extern/grplib-4.9/configure
|
||||
@@ -12204,7 +12204,7 @@ $am_python_setup_sysconfig
|
||||
if can_use_sysconfig:
|
||||
sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
|
||||
else:
|
||||
- from distutils import sysconfig
|
||||
+ from setuptools._distutils import sysconfig
|
||||
sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
|
||||
sys.stdout.write(sitedir)"`
|
||||
case $am_cv_python_pythondir in
|
||||
@@ -12248,7 +12248,7 @@ $am_python_setup_sysconfig
|
||||
if can_use_sysconfig:
|
||||
sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
|
||||
else:
|
||||
- from distutils import sysconfig
|
||||
+ from setuptools._distutils import sysconfig
|
||||
sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
|
||||
sys.stdout.write(sitedir)"`
|
||||
case $am_cv_python_pyexecdir in
|
||||
@@ -12389,18 +12389,18 @@ variable to configure. See \`\`configure --help'' for reference.
|
||||
fi
|
||||
|
||||
#
|
||||
- # Check if you have distutils, else fail
|
||||
+ # Check if you have setuptools._distutils, else fail
|
||||
#
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5
|
||||
-$as_echo_n "checking for the distutils Python package... " >&6; }
|
||||
- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the setuptools._distutils Python package" >&5
|
||||
+$as_echo_n "checking for the setuptools._distutils Python package... " >&6; }
|
||||
+ ac_distutils_result=`$PYTHON -c "import setuptools._distutils" 2>&1`
|
||||
if test -z "$ac_distutils_result"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
- as_fn_error $? "cannot import Python module \"distutils\".
|
||||
+ as_fn_error $? "cannot import Python module \"setuptools._distutils\".
|
||||
Please check your Python installation. The error was:
|
||||
$ac_distutils_result" "$LINENO" 5
|
||||
PYTHON_VERSION=""
|
||||
@@ -12412,10 +12412,10 @@ $ac_distutils_result" "$LINENO" 5
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5
|
||||
$as_echo_n "checking for Python include path... " >&6; }
|
||||
if test -z "$PYTHON_CPPFLAGS"; then
|
||||
- python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_inc ());"`
|
||||
- plat_python_path=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_inc (plat_specific=1));"`
|
||||
+ python_path=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_inc ());"`
|
||||
+ plat_python_path=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_inc (plat_specific=1));"`
|
||||
if test -n "${python_path}"; then
|
||||
if test "${plat_python_path}" != "${python_path}"; then
|
||||
python_path="-I$python_path -I$plat_python_path"
|
||||
@@ -12441,7 +12441,7 @@ $as_echo_n "checking for Python library path... " >&6; }
|
||||
|
||||
# join all versioning strings, on some systems
|
||||
# major/minor numbers could be in different list elements
|
||||
-from distutils.sysconfig import *
|
||||
+from setuptools._distutils.sysconfig import *
|
||||
e = get_config_var('VERSION')
|
||||
if e is not None:
|
||||
print(e)
|
||||
@@ -12467,8 +12467,8 @@ _ACEOF
|
||||
ac_python_libdir=`cat<<EOD | $PYTHON -
|
||||
|
||||
# There should be only one
|
||||
-import distutils.sysconfig
|
||||
-e = distutils.sysconfig.get_config_var('LIBDIR')
|
||||
+import setuptools._distutils.sysconfig
|
||||
+e = setuptools._distutils.sysconfig.get_config_var('LIBDIR')
|
||||
if e is not None:
|
||||
print (e)
|
||||
EOD`
|
||||
@@ -12476,8 +12476,8 @@ EOD`
|
||||
# Now, for the library:
|
||||
ac_python_library=`cat<<EOD | $PYTHON -
|
||||
|
||||
-import distutils.sysconfig
|
||||
-c = distutils.sysconfig.get_config_vars()
|
||||
+import setuptools._distutils.sysconfig
|
||||
+c = setuptools._distutils.sysconfig.get_config_vars()
|
||||
if 'LDVERSION' in c:
|
||||
print ('python'+c['LDVERSION'])
|
||||
else:
|
||||
@@ -12496,7 +12496,7 @@ EOD`
|
||||
else
|
||||
# old way: use libpython from python_configdir
|
||||
ac_python_libdir=`$PYTHON -c \
|
||||
- "from distutils.sysconfig import get_python_lib as f; \
|
||||
+ "from setuptools._distutils.sysconfig import get_python_lib as f; \
|
||||
import os; \
|
||||
print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
|
||||
PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
|
||||
@@ -12519,8 +12519,8 @@ $as_echo "$PYTHON_LDFLAGS" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5
|
||||
$as_echo_n "checking for Python site-packages path... " >&6; }
|
||||
if test -z "$PYTHON_SITE_PKG"; then
|
||||
- PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- print (distutils.sysconfig.get_python_lib(0,0));"`
|
||||
+ PYTHON_SITE_PKG=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ print (setuptools._distutils.sysconfig.get_python_lib(0,0));"`
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5
|
||||
$as_echo "$PYTHON_SITE_PKG" >&6; }
|
||||
@@ -12532,8 +12532,8 @@ $as_echo "$PYTHON_SITE_PKG" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5
|
||||
$as_echo_n "checking python extra libraries... " >&6; }
|
||||
if test -z "$PYTHON_EXTRA_LIBS"; then
|
||||
- PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
+ PYTHON_EXTRA_LIBS=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ conf = setuptools._distutils.sysconfig.get_config_var; \
|
||||
print (conf('LIBS') + ' ' + conf('SYSLIBS'))"`
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5
|
||||
@@ -12546,8 +12546,8 @@ $as_echo "$PYTHON_EXTRA_LIBS" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5
|
||||
$as_echo_n "checking python extra linking flags... " >&6; }
|
||||
if test -z "$PYTHON_EXTRA_LDFLAGS"; then
|
||||
- PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
|
||||
- conf = distutils.sysconfig.get_config_var; \
|
||||
+ PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import setuptools._distutils.sysconfig; \
|
||||
+ conf = setuptools._distutils.sysconfig.get_config_var; \
|
||||
print (conf('LINKFORSHARED'))"`
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5
|
||||
@@ -15577,5 +15577,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
|
||||
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
|
||||
fi
|
||||
-
|
||||
-
|
||||
|
||||
From 20a51ce086fa4c6801a6d519c620ea83f4effb92 Mon Sep 17 00:00:00 2001
|
||||
From: Douglas Burke <dburke.gw@gmail.com>
|
||||
Date: Thu, 7 Oct 2021 18:48:29 -0400
|
||||
Subject: [PATCH 3/3] Ensure we have a setuptools which contains distutils
|
||||
|
||||
---
|
||||
pyproject.toml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pyproject.toml b/pyproject.toml
|
||||
index 60d90c72f0..52ce9e6df4 100644
|
||||
--- a/pyproject.toml
|
||||
+++ b/pyproject.toml
|
||||
@@ -1,5 +1,5 @@
|
||||
[build-system]
|
||||
-requires = ["setuptools",
|
||||
+requires = ["setuptools>=49.1.2",
|
||||
"wheel",
|
||||
"oldest-supported-numpy",
|
||||
]
|
Loading…
Reference in New Issue
Block a user