From f10710d5cde778f6f4d00d004cdf4c73d6b322d2 Mon Sep 17 00:00:00 2001 From: Glenn Johnson Date: Thu, 27 Feb 2020 22:28:16 -0600 Subject: New package: py-librosa (#15223) * New package: py-librosa This PR adds the py-librosa package, along with new dependency packages and some updates of existing dependency packages. - new package: py-audioread - new package: py-resampy - new package: py-soundfile - update package: py-numba - update package: py-llvmlite py-numba: - add updated version - adjust constraints py-llvmlite: - add updated version - adjust constraints - fix version specifications for llvm - add environment function to set PIC * Update var/spack/repos/builtin/packages/py-numba/package.py Ah, yes, I see that `setuptools` is listed in the `install_requires` array. I missed that before. Co-Authored-By: Adam J. Stewart * Fix dependency - Add dependency of py-soundfile depends on libsndfile - Add new libsndfile package * Add py-pytest-runner build dep * Make numpy a variant for py-soundfile Co-authored-by: Adam J. Stewart --- .../repos/builtin/packages/libsndfile/package.py | 40 ++++++++++++++++++++++ .../repos/builtin/packages/py-audioread/package.py | 21 ++++++++++++ .../repos/builtin/packages/py-librosa/package.py | 27 +++++++++++++++ .../repos/builtin/packages/py-llvmlite/package.py | 11 ++++-- .../repos/builtin/packages/py-numba/package.py | 6 +++- .../repos/builtin/packages/py-resampy/package.py | 21 ++++++++++++ .../repos/builtin/packages/py-soundfile/package.py | 23 +++++++++++++ 7 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 var/spack/repos/builtin/packages/libsndfile/package.py create mode 100644 var/spack/repos/builtin/packages/py-audioread/package.py create mode 100644 var/spack/repos/builtin/packages/py-librosa/package.py create mode 100644 var/spack/repos/builtin/packages/py-resampy/package.py create mode 100644 var/spack/repos/builtin/packages/py-soundfile/package.py diff --git a/var/spack/repos/builtin/packages/libsndfile/package.py b/var/spack/repos/builtin/packages/libsndfile/package.py new file mode 100644 index 0000000000..4c5c294d48 --- /dev/null +++ b/var/spack/repos/builtin/packages/libsndfile/package.py @@ -0,0 +1,40 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Libsndfile(AutotoolsPackage): + """Libsndfile is a C library for reading and writing files containing + sampled sound (such as MS Windows WAV and the Apple/SGI AIFF format) + through one standard library interface. It is released in source code + format under the Gnu Lesser General Public License.""" + + homepage = "http://www.mega-nerd.com/libsndfile/" + url = "http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz" + + version('1.0.28', sha256='1ff33929f042fa333aed1e8923aa628c3ee9e1eb85512686c55092d1e5a9dfa9') + + variant('alsa', default=False, description='Use alsa in example programs') + variant('external-libs', + default=False, + description='Build with support for FLAC, Ogg and Vorbis') + variant('sqlite', default=False, description='Build with sqlite support') + + depends_on('pkgconfig', type='build') + depends_on('alsa-lib', when='+alsa') + depends_on('flac@1.3.1:', when='+external-libs') + depends_on('libogg@1.1.3:', when='+external-libs') + depends_on('libvorbis@1.2.3:', when='+external-libs') + depends_on('sqlite@3.2:', when='+sqlite') + + def configure_args(self): + args = [] + + args += self.enable_or_disable('alsa') + args += self.enable_or_disable('external-libs') + args += self.enable_or_disable('sqlite') + + return args diff --git a/var/spack/repos/builtin/packages/py-audioread/package.py b/var/spack/repos/builtin/packages/py-audioread/package.py new file mode 100644 index 0000000000..b69f22b720 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-audioread/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class PyAudioread(PythonPackage): + """cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for + Python.""" + + homepage = "https://github.com/beetbox/audioread" + url = "https://pypi.io/packages/source/a/audioread/audioread-2.1.8.tar.gz" + + version('2.1.8', sha256='073904fabc842881e07bd3e4a5776623535562f70b1655b635d22886168dd168') + + depends_on('py-setuptools', type='build') + # the following does not seem to be used for building but is listed in + # setup.py + depends_on('py-pytest-runner', type='build') diff --git a/var/spack/repos/builtin/packages/py-librosa/package.py b/var/spack/repos/builtin/packages/py-librosa/package.py new file mode 100644 index 0000000000..c720c12e63 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-librosa/package.py @@ -0,0 +1,27 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class PyLibrosa(PythonPackage): + """A python package for music and audio analysis.""" + + homepage = "http://github.com/librosa/librosa" + url = "https://pypi.io/packages/source/l/librosa/librosa-0.7.2.tar.gz" + + version('0.7.2', sha256='656bbda80e98e6330db1ead79cd084b13a762284834d7603fcf7cf7c0dc65f3c') + + depends_on('py-setuptools', type='build') + depends_on('py-audioread@2.0.0:', type=('build', 'run')) + depends_on('py-numpy@1.15.0:', type=('build', 'run')) + depends_on('py-scipy@1.0.0:', type=('build', 'run')) + depends_on('py-scikit-learn@0.14.0:0.18.999,0.19.1:', type=('build', 'run')) + depends_on('py-joblib@0.12:', type=('build', 'run')) + depends_on('py-decorator@3.0.0:', type=('build', 'run')) + depends_on('py-six@1.3:', type=('build', 'run')) + depends_on('py-resampy@0.2.2:', type=('build', 'run')) + depends_on('py-numba@0.43.0:', type=('build', 'run')) + depends_on('py-soundfile@0.9.0:', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-llvmlite/package.py b/var/spack/repos/builtin/packages/py-llvmlite/package.py index ad5e401963..c225e74354 100644 --- a/var/spack/repos/builtin/packages/py-llvmlite/package.py +++ b/var/spack/repos/builtin/packages/py-llvmlite/package.py @@ -12,6 +12,7 @@ class PyLlvmlite(PythonPackage): homepage = "http://llvmlite.readthedocs.io/en/latest/index.html" url = "https://pypi.io/packages/source/l/llvmlite/llvmlite-0.23.0.tar.gz" + version('0.31.0', sha256='22ab2b9d7ec79fab66ac8b3d2133347de86addc2e2df1b3793e523ac84baa3c8') version('0.29.0', sha256='3adb0d4c9a17ad3dca82c7e88118babd61eeee0ee985ce31fa43ec27aa98c963') version('0.27.1', sha256='48a1c3ae69fd8920cba153bfed8a46ac46474bc706a2100226df4abffe0000ab') version('0.26.0', sha256='13e84fe6ebb0667233074b429fd44955f309dead3161ec89d9169145dbad2ebf') @@ -25,7 +26,11 @@ class PyLlvmlite(PythonPackage): # llvmlite compatibility information taken from https://github.com/numba/llvmlite#compatibility depends_on('llvm@7.0:8.0.99', when='@0.29.0:') - depends_on('llvm@7.0:7.99', when='@0.27.0:0.28.99') - depends_on('llvm@6.0:6.99', when='@0.23.0:0.26.99') - depends_on('llvm@4.0:4.99', when='@0.17.0:0.20.99') + depends_on('llvm@7.0:7.0.99', when='@0.27.0:0.28.99') + depends_on('llvm@6.0:6.0.99', when='@0.23.0:0.26.99') + depends_on('llvm@4.0:4.0.99', when='@0.17.0:0.20.99') depends_on('binutils', type='build') + + def setup_build_environment(self, env): + # Need to set PIC flag since this is linking statically with LLVM + env.set('CXX_FLTO_FLAGS', '-flto {0}'.format(self.compiler.pic_flag)) diff --git a/var/spack/repos/builtin/packages/py-numba/package.py b/var/spack/repos/builtin/packages/py-numba/package.py index a6f4175e07..c3c288a4ae 100644 --- a/var/spack/repos/builtin/packages/py-numba/package.py +++ b/var/spack/repos/builtin/packages/py-numba/package.py @@ -12,18 +12,22 @@ class PyNumba(PythonPackage): homepage = "https://numba.pydata.org/" url = "https://pypi.io/packages/source/n/numba/numba-0.35.0.tar.gz" + version('0.48.0', sha256='9d21bc77e67006b5723052840c88cc59248e079a907cc68f1a1a264e1eaba017') version('0.40.1', sha256='52d046c13bcf0de79dbfb936874b7228f141b9b8e3447cc35855e9ad3e12aa33') version('0.35.0', sha256='11564937757605bee590c5758c73cfe9fd6d569726b56d970316a6228971ecc3') + depends_on('python@3.6:', type=('build', 'run'), when='@0.48.0:') depends_on('python@3.3:3.7.9999', type=('build', 'run'), when='@0.40.1:') depends_on('python@3.3:3.6.9999', type=('build', 'run'), when='@:0.35.0') + depends_on('py-numpy@1.15:', type=('build', 'run'), when='@0.48.0:') depends_on('py-numpy@1.10:1.99', type=('build', 'run')) - depends_on('py-setuptools', type='build') + depends_on('py-setuptools', type=('build', 'run')) # Note: As of 1 Nov 2018, 0.25 was the latest version of py-llvmlite. # That's why it was chosen as an upper bound in the following depends_on # calls. If newer versions maintain backwards compatibility, the calls # can be updated accordingly. + depends_on('py-llvmlite@0.31.0:0.32.0', type=('build', 'run'), when='@0.48.0') depends_on('py-llvmlite@0.25:', type=('build', 'run'), when='@0.40.1:') depends_on('py-llvmlite@0.20:0.25', type=('build', 'run'), when='@0.35.1') diff --git a/var/spack/repos/builtin/packages/py-resampy/package.py b/var/spack/repos/builtin/packages/py-resampy/package.py new file mode 100644 index 0000000000..35249c8acc --- /dev/null +++ b/var/spack/repos/builtin/packages/py-resampy/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class PyResampy(PythonPackage): + """Efficient sample rate conversion in python""" + + homepage = "https://github.com/bmcfee/resampy" + url = "https://pypi.io/packages/source/r/resampy/resampy-0.2.2.tar.gz" + + version('0.2.2', sha256='62af020d8a6674d8117f62320ce9470437bb1d738a5d06cd55591b69b463929e') + + depends_on('py-setuptools', type='build') + depends_on('py-numpy@1.10:', type=('build', 'run')) + depends_on('py-scipy@0.13:', type=('build', 'run')) + depends_on('py-numba@0.32:', type=('build', 'run')) + depends_on('py-six@1.3:', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-soundfile/package.py b/var/spack/repos/builtin/packages/py-soundfile/package.py new file mode 100644 index 0000000000..aa485deca3 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-soundfile/package.py @@ -0,0 +1,23 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class PySoundfile(PythonPackage): + """SoundFile is an audio library based on libsndfile, CFFI and NumPy.""" + + homepage = "https://github.com/bastibe/PySoundFile" + url = "https://pypi.io/packages/source/S/SoundFile/SoundFile-0.10.3.post1.tar.gz" + + version('0.10.3.post1', sha256='490cff42650733d1832728b937fe99fa1802896f5ef4d61bcf78cf7ebecb107b') + + variant('numpy', default=True, + description='Support for processing audio data as numpy arrays') + + depends_on('py-setuptools', type='build') + depends_on('py-cffi@1.0:', type=('build', 'run')) + depends_on('py-numpy', type=('build', 'run'), when='+numpy') + depends_on('libsndfile', type='run') -- cgit v1.2.3-60-g2f50