From d5e8ae22acf0407d6613d26a12039bc021514b697696649e05aeaa3642431e16 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 4 Oct 2024 19:54:35 +0000 Subject: [PATCH] Fix the PYTHONPATH setting OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-librosa?expand=0&rev=51 --- python-librosa.spec | 2 +- sysinfo.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python-librosa.spec b/python-librosa.spec index 66a8ea0..dc37fdf 100644 --- a/python-librosa.spec +++ b/python-librosa.spec @@ -103,7 +103,7 @@ sed -i '/addopts/ s/--cov-report.*--cov-report=xml//' setup.cfg %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_expand PYTHONPATH="%{buildroot}%{$python_sitelib} $python %{SOURCE20} +%python_expand PYTHONPATH="%{buildroot}%{$python_sitelib}" $python %{SOURCE20} export LIBROSA_DATA_DIR=$PWD/librosa-pooch-cache # image files do not match without exact mpl version diff --git a/sysinfo.py b/sysinfo.py index d1b4740..03ad530 100644 --- a/sysinfo.py +++ b/sysinfo.py @@ -4,11 +4,15 @@ import platform import sys import numpy import scipy -import librosa +try: + import librosa +except ModuleNotFoundError: + librosa = None print(platform.platform()) print("Python", sys.version) print("NumPy", numpy.__version__) print("SciPy", scipy.__version__) -print("librosa", librosa.__version__) -librosa.show_versions() +if librosa is not None: + print("librosa", librosa.__version__) + librosa.show_versions()