2020-05-29 18:55:59 +00:00
#
2024-08-24 07:50:27 +00:00
# spec file for package python-ligo-lw
2020-05-29 18:55:59 +00:00
#
2025-01-24 08:18:29 +00:00
# Copyright (c) 2025 SUSE LLC
2020-05-29 18:55:59 +00:00
#
# 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/
#
2021-02-06 22:04:00 +00:00
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%bcond_without test
%define psuffix -test
%else
%bcond_with test
%define psuffix %{nil}
%endif
2022-01-12 12:39:38 +00:00
%define bins ligolw_add ligolw_cut ligolw_no_ilwdchar ligolw_print ligolw_segments ligolw_sqlite ligolw_run_sqlite
2021-02-06 22:04:00 +00:00
%define srcname python-ligo-lw
Name : python-ligo-lw%{?psuffix}
2022-09-01 09:44:40 +00:00
Version : 1.8.3
2020-05-29 18:55:59 +00:00
Release : 0
Summary : Python LIGO Light-Weight XML I/O Library
License : GPL-3.0-only
Group : Development/Languages/Python
2025-06-18 12:07:58 +00:00
URL : https://git.ligo.org/kipp/python-ligo-lw
2021-02-06 22:04:00 +00:00
Source : http://software.ligo.org/lscsoft/source/%{srcname} -%{version} .tar.gz
2020-11-03 09:28:16 +00:00
# PATCH-FIX-UPSTREAM ligo-lw-segments-test-fix.patch badshah400@gmail.com -- Fix a test that randomly fails due to dictionary ordering being undefined
Patch0 : ligo-lw-segments-test-fix.patch
2022-01-12 12:39:38 +00:00
# PATCH-FIX-UPSTREAM ligo-lw-disable-doctests.patch badshah400@gmail.com -- Disable doctests as these are not ready for py 3.10 yet
Patch1 : ligo-lw-disable-doctests.patch
# PATCH-FIX-OPENSUSE ligo-lw-disable-sqlite-test.patch badshah400@gmail.com -- Disable sqlite test that requires network resources
Patch3 : ligo-lw-disable-sqlite-test.patch
2023-03-13 13:27:05 +00:00
# https://git.ligo.org/kipp.cannon/python-ligo-lw/-/commit/693cfc4d4759c1984609effa1dde810a192fe94f
Patch4 : python-ligo-lw-no-python2.patch
2024-08-27 19:19:15 +00:00
# PATCH-FIX-UPSTREAM badshah400@gmail.com -- https://git.ligo.org/kipp/python-ligo-lw/-/issues/29
Patch5 : ligo-lw-python3.12-compat.patch
2025-01-24 08:18:29 +00:00
# PATCH-FIX-UPSTREAM ligo-lw-disable-lsctables.patch badshah400@gmail.com -- Disable failing lsctables test due to "SystemError: error return without exception set"
Patch6 : ligo-lw-disable-lsctables.patch
# PATCH-FIX-UPSTREAM ligo-lw-disable-utils_segments.patch badshah400@gmail.com -- Disable failing utils_segments test (temporary workaround to get builds to succeed)
Patch7 : ligo-lw-disable-utils_segments.patch
2020-05-29 18:55:59 +00:00
BuildRequires : %{python_module devel}
2025-06-18 12:07:58 +00:00
BuildRequires : %{python_module pip}
2020-05-29 18:55:59 +00:00
BuildRequires : %{python_module setuptools}
2025-06-18 12:07:58 +00:00
BuildRequires : %{python_module wheel}
2020-05-29 18:55:59 +00:00
BuildRequires : fdupes
BuildRequires : python-rpm-macros
Requires : python-PyYAML
Requires : python-lal
Requires : python-ligo-segments
2021-02-06 22:04:00 +00:00
Requires : python-lscsoft-glue
2024-08-24 07:50:27 +00:00
Requires : python-numpy
2020-11-03 09:28:16 +00:00
Requires : python-python-dateutil
Requires : python-tqdm
2022-03-29 13:29:02 +00:00
Requires(post) : update-alternatives
2024-08-24 07:50:27 +00:00
Requires(postun) : update-alternatives
2022-03-29 13:29:02 +00:00
# lal no longer supported for 32bit, and is a hard dependency for ligo-lw
ExcludeArch : %{ix86}
2020-11-03 09:28:16 +00:00
# SECTION Test requirements
2021-02-06 22:04:00 +00:00
%if %{with test}
2020-11-03 09:28:16 +00:00
BuildRequires : %{python_module PyYAML}
BuildRequires : %{python_module lal}
2021-02-06 22:04:00 +00:00
BuildRequires : %{python_module ligo-lw = %{version} }
2020-11-03 09:28:16 +00:00
BuildRequires : %{python_module ligo-segments}
2021-02-06 22:04:00 +00:00
BuildRequires : %{python_module lscsoft-glue}
2020-11-03 09:28:16 +00:00
BuildRequires : %{python_module matplotlib}
2021-02-06 22:04:00 +00:00
BuildRequires : %{python_module numpy-devel}
2020-11-03 09:28:16 +00:00
BuildRequires : %{python_module python-dateutil}
BuildRequires : %{python_module tqdm}
BuildRequires : diffutils
BuildRequires : libxml2-tools
BuildRequires : python3
2021-02-06 22:04:00 +00:00
%endif
2020-11-03 09:28:16 +00:00
# /SECTION
2020-05-29 18:55:59 +00:00
%python_subpackages
%description
The LIGO Light-Weight XML format is used extensively by compact object
detection pipeline and associated tool sets. This package provides a Python
I/O library for reading, writing, and interacting with documents in this
format.
%prep
2022-01-12 12:39:38 +00:00
%autosetup -p1 -n %{srcname} -%{version}
2020-11-03 09:28:16 +00:00
# Replace distutils.core by setuptools to fix namespace errors
# https://git.ligo.org/kipp.cannon/python-ligo-lw/-/issues/16
sed -i " 1 { s / d i s t u t i l s . c o r e / s e t u p t o o l s / } " setup.py
2020-05-29 18:55:59 +00:00
%build
2025-06-18 12:07:58 +00:00
%pyproject_wheel
2020-05-29 18:55:59 +00:00
%install
2021-02-06 22:04:00 +00:00
%if %{without test}
2025-06-18 12:07:58 +00:00
%pyproject_install
2020-05-29 18:55:59 +00:00
%python_expand %fdupes %{buildroot} %{$python_sitearch}
2021-02-06 22:04:00 +00:00
%{lua: for c in string.gmatch(rpm.expand(" % b i n s " ), " % S + " ) do
print(rpm.expand(" % p y t h o n _ c l o n e - a %{buildroot} %{_bindir} / " .. c .. " \n " ))
end}
%endif
2020-11-03 09:28:16 +00:00
%check
2021-02-06 22:04:00 +00:00
%if %{with test}
2021-02-13 11:34:24 +00:00
# Test-suite works only for python3 flavors
2021-02-06 22:04:00 +00:00
%{python_expand export PYTHON=$python
2020-11-03 09:28:16 +00:00
export PYTHONDONTWRITEBYTECODE=1
2021-02-06 22:04:00 +00:00
cp -r test test-%{$python_bin_suffix}
pushd test-%{$python_bin_suffix}
2020-11-03 09:28:16 +00:00
%make_build check
popd
2021-02-06 22:04:00 +00:00
}
2020-11-03 09:28:16 +00:00
%endif
2021-02-06 22:04:00 +00:00
%if %{without test}
%post
%python_install_alternative %bins
%postun
%python_uninstall_alternative %bins
2020-05-29 18:55:59 +00:00
%files %{python_files}
%license LICENSE
2021-02-06 22:04:00 +00:00
%{lua: for c in string.gmatch(rpm.expand(" % b i n s " ), " % S + " ) do
print(rpm.expand(" % p y t h o n _ a l t e r n a t i v e %{_bindir} / " .. c .. " \n " ))
end}
%{python_sitearch} /ligo/
2025-06-18 12:07:58 +00:00
%{python_sitearch} /python_ligo_lw-%{version} .dist-info
2021-02-06 22:04:00 +00:00
%{python_sitearch} /python_ligo_lw-%{version} -py%{python_version} -nspkg.pth
%endif
2020-05-29 18:55:59 +00:00
%changelog