Fix: py-adios Cython run (#28223)

* Fix: py-adios Cython run

Always run Cython before `py-adios` installs.
This makes sure the `.cpp` files from `.pyx` files are freshly
created and work with newer CPython versions than the one checked
in.

* Cleanup: `rm` -> `os.remove`
This commit is contained in:
Axel Huebl 2022-01-04 20:05:18 +01:00 committed by GitHub
parent dc1b6aa8c6
commit e43795de28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
@ -10,19 +12,25 @@ class PyAdios(PythonPackage):
"""NumPy bindings of ADIOS1"""
homepage = "https://csmd.ornl.gov/adios"
url = "https://github.com/ornladios/ADIOS/archive/v1.12.0.tar.gz"
url = "https://github.com/ornladios/ADIOS/archive/v1.13.1.tar.gz"
git = "https://github.com/ornladios/ADIOS.git"
maintainers = ['ax3l']
maintainers = ['ax3l', 'jychoi-hpc']
version('develop', branch='master')
version('1.13.1', sha256='b1c6949918f5e69f701cabfe5987c0b286793f1057d4690f04747852544e157b')
version('1.13.0', sha256='7b5ee8ff7a5f7215f157c484b20adb277ec0250f87510513edcc25d2c4739f50')
version('1.12.0', sha256='22bc22c157322abec2d1a0817a259efd9057f88c2113e67d918a9a5ebcb3d88d')
version('1.11.1', sha256='9f5c10b9471a721ba57d1cf6e5a55a7ad139a6c12da87b4dc128539e9eef370e')
version('1.11.0', sha256='e89d14ccbe7181777225e0ba6c272c0941539b8ccd440e72ed5a9457441dae83')
version('1.10.0', sha256='6713069259ee7bfd4d03f47640bf841874e9114bab24e7b0c58e310c42a0ec48')
version('1.9.0', sha256='23b2bb70540d51ab0855af0b205ca484fd1bd963c39580c29e3133f9e6fffd46')
version('1.13.0', sha256='7b5ee8ff7a5f7215f157c484b20adb277ec0250f87510513edcc25d2c4739f50',
deprecated=True)
version('1.12.0', sha256='22bc22c157322abec2d1a0817a259efd9057f88c2113e67d918a9a5ebcb3d88d',
deprecated=True)
version('1.11.1', sha256='9f5c10b9471a721ba57d1cf6e5a55a7ad139a6c12da87b4dc128539e9eef370e',
deprecated=True)
version('1.11.0', sha256='e89d14ccbe7181777225e0ba6c272c0941539b8ccd440e72ed5a9457441dae83',
deprecated=True)
version('1.10.0', sha256='6713069259ee7bfd4d03f47640bf841874e9114bab24e7b0c58e310c42a0ec48',
deprecated=True)
version('1.9.0', sha256='23b2bb70540d51ab0855af0b205ca484fd1bd963c39580c29e3133f9e6fffd46',
deprecated=True)
variant('mpi', default=True,
description='Enable MPI support')
@ -36,14 +44,6 @@ class PyAdios(PythonPackage):
when='@{0} +mpi'.format(v),
type=['build', 'link', 'run'])
# NOTE: this dependency is a work-around for a bug in Adios itself.
# Specifically, Adios uses code that was generated by Cython 0.28.2.
# This code won't compile against the Python 3.7 C API.
# See https://github.com/ornladios/ADIOS/issues/202 and
# the first entry under "Bug Fixes" at
# https://github.com/cython/cython/blob/0.29.x/CHANGES.rst
depends_on('python@:3.6')
depends_on('py-numpy', type=['build', 'run'])
depends_on('mpi', when='+mpi')
depends_on('py-mpi4py', type=['run'], when='+mpi')
@ -60,10 +60,12 @@ def setup_file(self):
return 'setup.py'
def build_clib(self, spec, prefix):
# calls: make [MPI=y] python
args = ''
# calls: make CYTHON=y [MPI=y] python
args = ['CYTHON=y']
if '+mpi' in self.spec:
args = 'MPI=y '
args += 'python'
args += ['MPI=y']
args += ['python']
with working_dir(self.build_directory):
make(args)
os.remove('adios.cpp')
os.remove('adios_mpi.cpp')
make(*args, parallel=False)