File python-inspiral-range.spec of Package python-inspiral-range

#
# spec file for package python-inspiral-range
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

# SECTION Multibuild definitions for test flavour
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
# /SECTION

%define modname inspiral_range
Name:           python-inspiral-range%{?psuffix}
Version:        0.9.2
Release:        0
Summary:        GW detector inspiral range calculation tools
License:        GPL-3.0-or-later
URL:            https://git.ligo.org/gwinc/inspiral_range
Source:         https://files.pythonhosted.org/packages/source/i/inspiral_range/%{modname}-%{version}.tar.gz
BuildRequires:  %{python_module setuptools_scm}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-astropy
Requires:       python-gpstime
Requires:       python-numpy
Requires:       python-PyYAML
Requires:       python-scipy >= 1.8.0
Requires:       timezone
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends:     python-lalapps
Recommends:     python-matplotlib
BuildArch:      noarch
%if %{with test}
# SECTION test requirements
BuildRequires:  %{python_module inspiral-range = %{version}}
BuildRequires:  %{python_module lalsimulation}
BuildRequires:  %{python_module numpy}
# /SECTION
%endif
%python_subpackages

%description
GW detector inspiral range calculation tools

%prep
%setup -q -n inspiral_range-%{version}

%build
%if %{without test}
%python_build
%endif

%install
%if %{without test}
%python_install
%python_clone -a %{buildroot}%{_bindir}/inspiral-range
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif

%check
%if %{with test}
%{python_expand # No easy way to run tests
export PYTHONPATH=%{$python_sitelib}
$python -m inspiral_range.test -dt
}
%endif

%if %{without test}
%post
%python_install_alternative inspiral-range

%postun
%python_uninstall_alternative inspiral-range

%files %{python_files}
%doc README.md
%license COPYING COPYING-GPL-3
%python_alternative %{_bindir}/inspiral-range
%{python_sitelib}/%{modname}/
%{python_sitelib}/%{modname}-%{version}-py%{python_version}.egg-info/
%endif

%changelog
openSUSE Build Service is sponsored by