#12 Update to 1.3.1, python2 removed
Merged 3 months ago by churchyard. Opened 3 months ago by lbalhar.
rpms/ lbalhar/scipy 1.3.1_fixed  into  master

file added
+140

@@ -0,0 +1,140 @@ 

+ From d945dfa4063c5cd7169acd117c15f23ba68027ed Mon Sep 17 00:00:00 2001

+ From: Pauli Virtanen <pav@iki.fi>

+ Date: Wed, 31 Jul 2019 23:31:22 +0300

+ Subject: [PATCH 1/2] BUG: spatial: use c++11 construct for getting start of

+  vector

+ 

+ gcc 9.1.1 on Fedora throws asserts and crashes at runtime on

+ `&x.front()` when `x` is empty, so use a different construct for getting

+ the beginning of the data block.

+ ---

+  scipy/spatial/ckdtree.pyx | 18 +++++++++---------

+  1 file changed, 9 insertions(+), 9 deletions(-)

+ 

+ diff --git a/scipy/spatial/ckdtree.pyx b/scipy/spatial/ckdtree.pyx

+ index e2eea8c9097..884d49e1d34 100644

+ --- a/scipy/spatial/ckdtree.pyx

+ +++ b/scipy/spatial/ckdtree.pyx

+ @@ -190,7 +190,7 @@ cdef class coo_entries:

+          res_dtype = np.dtype(_dtype, align = True)

+          n = <np.intp_t> self.buf.size()

+          if NPY_LIKELY(n > 0):

+ -            pr = &self.buf.front()

+ +            pr = self.buf.data()

+              uintptr = <np.uintp_t> (<void*> pr)

+              dtype = np.dtype(np.uint8)

+              self.__array_interface__ = dict(

+ @@ -213,7 +213,7 @@ cdef class coo_entries:

+              dict res_dict

+          n = <np.intp_t> self.buf.size()

+          if NPY_LIKELY(n > 0):

+ -            pr = &self.buf.front()

+ +            pr = self.buf.data()

+              res_dict = dict()

+              for k in range(n):

+                  i = pr[k].i

+ @@ -263,7 +263,7 @@ cdef class ordered_pairs:

+              np.intp_t n

+          n = <np.intp_t> self.buf.size()

+          if NPY_LIKELY(n > 0):

+ -            pr = &self.buf.front()

+ +            pr = self.buf.data()

+              uintptr = <np.uintp_t> (<void*> pr)

+              dtype = np.dtype(np.intp)

+              self.__array_interface__ = dict(

+ @@ -284,7 +284,7 @@ cdef class ordered_pairs:

+              np.intp_t i, n

+              set results

+          results = set()

+ -        pair = &self.buf.front()

+ +        pair = self.buf.data()

+          n = <np.intp_t> self.buf.size()

+          if sizeof(long) < sizeof(np.intp_t):

+              # Needed for Python 2.x on Win64

+ @@ -593,7 +593,7 @@ cdef class cKDTree:

+          cself = self.cself

+          # finalize the tree points, this calls _post_init_traverse

+  

+ -        cself.ctree = &cself.tree_buffer.front()

+ +        cself.ctree = cself.tree_buffer.data()

+  

+          # set the size attribute after tree_buffer is built

+          cself.size = cself.tree_buffer.size()

+ @@ -971,7 +971,7 @@ cdef class cKDTree:

+                      m = <np.intp_t> (vvres[i].size())

+                      tmp = m * [None]

+  

+ -                    cur = &vvres[i].front()

+ +                    cur = vvres[i].data()

+                      for j in range(m):

+                          tmp[j] = cur[0]

+                          cur += 1

+ @@ -1067,7 +1067,7 @@ cdef class cKDTree:

+                      tmp = m * [None]

+                      with nogil:

+                          sort(vvres[i].begin(), vvres[i].end())

+ -                    cur = &vvres[i].front()

+ +                    cur = vvres[i].data()

+                      for j in range(m):

+                          tmp[j] = cur[0]

+                          cur += 1

+ @@ -1492,7 +1492,7 @@ cdef class cKDTree:

+          cdef ckdtree * cself = self.cself

+          size = cself.tree_buffer.size() * sizeof(ckdtreenode)

+  

+ -        cdef np.ndarray tree = np.asarray(<char[:size]> <char*> &cself.tree_buffer.front())

+ +        cdef np.ndarray tree = np.asarray(<char[:size]> <char*> cself.tree_buffer.data())

+  

+          state = (tree.copy(), self.data.copy(), self.n, self.m, self.leafsize,

+                        self.maxes, self.mins, self.indices.copy(),

+ @@ -1511,7 +1511,7 @@ cdef class cKDTree:

+          cself.tree_buffer = new vector[ckdtreenode]()

+          cself.tree_buffer.resize(tree.size // sizeof(ckdtreenode))

+  

+ -        mytree = np.asarray(<char[:tree.size]> <char*> &cself.tree_buffer.front())

+ +        mytree = np.asarray(<char[:tree.size]> <char*> cself.tree_buffer.data())

+  

+          # set raw pointers

+          self._pre_init()

+ 

+ From ad0f91438f49bfe277e32d2689aefeb0c11c789f Mon Sep 17 00:00:00 2001

+ From: Pauli Virtanen <pav@iki.fi>

+ Date: Wed, 31 Jul 2019 23:41:40 +0300

+ Subject: [PATCH 2/2] BLD: spatial: set c++ std flags for ckdtree

+ 

+ ---

+  scipy/spatial/setup.py | 11 ++++++++++-

+  1 file changed, 10 insertions(+), 1 deletion(-)

+ 

+ diff --git a/scipy/spatial/setup.py b/scipy/spatial/setup.py

+ index d7e334876df..19d78593c5e 100644

+ --- a/scipy/spatial/setup.py

+ +++ b/scipy/spatial/setup.py

+ @@ -4,6 +4,13 @@

+  import glob

+  

+  

+ +def pre_build_hook(build_ext, ext):

+ +    from scipy._build_utils.compiler_helper import get_cxx_std_flag

+ +    std_flag = get_cxx_std_flag(build_ext._cxx_compiler)

+ +    if std_flag is not None:

+ +        ext.extra_compile_args.append(std_flag)

+ +

+ +

+  def configuration(parent_package='', top_path=None):

+      from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs

+      from numpy.distutils.misc_util import get_info as get_misc_info

+ @@ -55,10 +62,12 @@ def configuration(parent_package='', top_path=None):

+      ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]

+  

+      ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src

+ -    config.add_extension('ckdtree',

+ +    ext = config.add_extension('ckdtree',

+                           sources=['ckdtree.cxx'] + ckdtree_src,

+                           depends=ckdtree_dep,

+                           include_dirs=inc_dirs + [join('ckdtree', 'src')])

+ +    ext._pre_build_hook = pre_build_hook

+ +

+      # _distance_wrap

+      config.add_extension('_distance_wrap',

+                           sources=[join('src', 'distance_wrap.c')],

file modified
+24 -60

@@ -6,8 +6,8 @@ 

  

  Summary:    Scientific Tools for Python

  Name:       scipy

- Version:    1.2.1

- Release:    8%{?dist}

+ Version:    1.3.1

+ Release:    1%{?dist}

  

  # BSD -- whole package except:

  # Boost -- scipy/special/cephes/scipy_iv.c

@@ -25,8 +25,11 @@ 

  # structure fields accessed in __odrpack.c are now deprecated.

  Patch1:     numpy-deprecation-warnings.patch

  

- BuildRequires: python2-numpy, python2-devel,python2-numpy-f2py

- BuildRequires: python2-pytest

+ # Bugfix of cKDTree

+ # PR: https://github.com/scipy/scipy/pull/10567

+ # Issue: https://github.com/scipy/scipy/issues/11021

+ Patch2:     ckdtree_bugfix.patch

+ 

  BuildRequires: fftw-devel, blas-devel, lapack-devel, suitesparse-devel

  %ifarch %{openblas_arches}

  BuildRequires: openblas-devel

@@ -45,11 +48,6 @@ 

  BuildRequires:  python3-pytest-timeout

  

  %if %{with doc}

- %if 0%{?fedora} < 31

- BuildRequires:  python2-sphinx

- BuildRequires:  python2-matplotlib

- BuildRequires:  python2-numpydoc

- %endif

  BuildRequires:  python3-sphinx

  BuildRequires:  python3-matplotlib

  BuildRequires:  python3-numpydoc

@@ -68,23 +66,14 @@ 

  

  %description %_description

  

- %package -n python2-scipy

+ %package -n python3-scipy

  Summary:    Scientific Tools for Python

- Requires:   numpy, f2py

- %{?python_provide:%python_provide python2-scipy}

- # General provides of plain 'scipy' in F24

- Provides:       scipy = %{version}-%{release}

- Provides:       scipy%{?_isa} = %{version}-%{release}

- Obsoletes:      scipy <= 0.16.0

- %description -n python2-scipy  %_description

+ License:    BSD and LGPLv2+

note to self: this was already present, but is different than the main package license, why?

+ Requires:   python3-numpy, python3-f2py

+ %{?python_provide:%python_provide python3-scipy}

+ %description -n python3-scipy %_description

  

  %if %{with doc}

- %package -n python2-scipy-doc

- Summary:    Scientific Tools for Python - documentation

- Requires:   python2-scipy = %{version}-%{release}

- %description -n python2-scipy-doc

- HTML documentation for Scipy

- 

  %package -n python3-scipy-doc

  Summary:    Scientific Tools for Python - documentation

  Requires:   python3-scipy = %{version}-%{release}

@@ -92,12 +81,6 @@ 

  HTML documentation for Scipy

  %endif

  

- %package -n python3-scipy

- Summary:    Scientific Tools for Python

- License:    BSD and LGPLv2+

- Requires:   python3-numpy, python3-f2py

- %{?python_provide:%python_provide python3-scipy}

- %description -n python3-scipy %_description

  

  %prep

  %autosetup -p1 -n %{name}-%{version}%{?rcver}

@@ -129,7 +112,7 @@ 

  rm $(grep -rl '/\* Generated by Cython') PKG-INFO

  

  %build

- for PY in %{python3_version} %{python2_version}; do

+ for PY in %{python3_version}; do

    env CFLAGS="$RPM_OPT_FLAGS -lm" \

        FFLAGS="$RPM_OPT_FLAGS -fPIC" \

    %ifarch %{openblas_arches}

@@ -143,24 +126,18 @@ 

      build

  

    %if %{with doc}

-   # No python2-sphinx on Fedora 31+

-   if [ $PY == %{python3_version} -o 0%{?fedora} -lt 31 ]

-   then

-     pushd doc

-     export PYTHONPATH=$(echo ../build/lib.linux-*-$PY/)

-     make html SPHINXBUILD=sphinx-build-$PY

-     rm -rf build/html/.buildinfo

-     mv build build-$PY

-     popd

-   fi

+   pushd doc

+   export PYTHONPATH=$(echo ../build/lib.linux-*-$PY/)

+   make html SPHINXBUILD=sphinx-build-$PY

+   rm -rf build/html/.buildinfo

+   mv build build-$PY

+   popd

    %endif

  done

  

  %install

  %py3_install

- %py2_install

  # Some files got ambiguous python shebangs, we fix them after everything else is done

- pathfix.py -pni "%{__python2} %{py2_shbang_opts}" %{buildroot}%{python2_sitearch}

  pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{python3_sitearch}

  

  %check

@@ -197,24 +174,6 @@ 

  rm -rf gram{A,B}

  popd

  

- pushd %{buildroot}/%{python2_sitearch}

- %{__python2} -m pytest -k "$k" scipy

- # Remove test remnants

- rm -f gram{A,B}

- popd

- 

- 

- %files -n python2-scipy

- %doc LICENSE.txt

- %{python2_sitearch}/scipy/

- %{python2_sitearch}/*.egg-info

- 

- %if %{with doc} && 0%{?fedora} < 31

- %files -n python2-scipy-doc

- %license LICENSE.txt

- %doc doc/build-%{python2_version}/html

- %endif

- 

  %files -n python3-scipy

  %doc LICENSE.txt

  %{python3_sitearch}/scipy/

@@ -227,6 +186,11 @@ 

  %endif

  

  %changelog

+ * Fri Oct 18 2019 Miro Hrončok <mhroncok@redhat.com> - 1.3.1-1

+ - Update to 1.3.1 (#1674101)

+ - Drop Python 2 packages (not supported by SciPy >= 1.3)

+ - Backported upstream patch for cKDTree (fixes FTBFS)

+ 

  * Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.2.1-8

  - Rebuilt for Python 3.8.0rc1 (#1748018)