py-astropy: force re-cythonization of distributed .pyx files (#17567)

astropy 3.2.1 fails to build with python 3.8.3 with
errors similar to this:

astropy/stats/_stats.c:318:11: error: too many arguments to function 'PyCode_New'
PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)

These are files that are generated by cython, but are included in the
tarball. Since there's apparently been an API change to PyCode_New, they will
need to be re-cythonized to compile correctly.
This commit is contained in:
Andrew W Elble 2020-07-24 11:46:56 -04:00 committed by GitHub
parent 30d0347825
commit 99c46e8186
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os
class PyAstropy(PythonPackage):
@ -52,6 +53,7 @@ class PyAstropy(PythonPackage):
depends_on('py-asdf@2.3:', when='+extras', type=('build', 'run'))
depends_on('py-bottleneck', when='+extras', type=('build', 'run'))
depends_on('py-pytest', when='+extras', type=('build', 'run'))
depends_on('py-cython', type='build')
# System dependencies
depends_on('erfa')
@ -59,6 +61,13 @@ class PyAstropy(PythonPackage):
depends_on('cfitsio')
depends_on('expat')
def patch(self):
# forces the rebuild of files with cython
# avoids issues with PyCode_New() in newer
# versions of python in the distributed
# cython-ized files
os.remove('astropy/cython_version.py')
def build_args(self, spec, prefix):
args = [
'--use-system-libraries',