commit 859a89a8f74b84fa590a921436d68ce720720675d527996bb643db072d6bc8c2 Author: Dmitry Roshchin Date: Mon Nov 18 08:12:47 2024 +0000 Accepting request 1224617 from home:StefanBruens:branches:science - Fix building without octave. The requires_eq macro must expand correctly, even when its result is discarded. - Add compatibility with SWIG 4.3.0, add * lalsuite_fix_swig_4_3_0_compat.patch * lalsuite_fix_swig_4_3_0_compat_2.patch OBS-URL: https://build.opensuse.org/request/show/1224617 OBS-URL: https://build.opensuse.org/package/show/science/lal?expand=0&rev=39 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_constraints b/_constraints new file mode 100644 index 0000000..a2b6e52 --- /dev/null +++ b/_constraints @@ -0,0 +1,8 @@ + + + + 4 + + + + diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..fcc7b97 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + diff --git a/lal-7.4.1.tar.xz b/lal-7.4.1.tar.xz new file mode 100644 index 0000000..19c10c4 --- /dev/null +++ b/lal-7.4.1.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c840d00e91a51d03d3d8cdc358fd8e5597929e52eecefd15c49cc9833fc1ace +size 2366072 diff --git a/lal-7.5.0.tar.xz b/lal-7.5.0.tar.xz new file mode 100644 index 0000000..e16bfdb --- /dev/null +++ b/lal-7.5.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bb692013c534880cf3eeb7c8e45c2a32bd6d74e7cf0c6918f638bc15bd0cf5d +size 2358600 diff --git a/lal-7.6.0.tar.xz b/lal-7.6.0.tar.xz new file mode 100644 index 0000000..0b72a02 --- /dev/null +++ b/lal-7.6.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c173ff3112065706dc0ad1cc5062b32ae72a25de1a079bad9d198f657b82e463 +size 2384632 diff --git a/lal.changes b/lal.changes new file mode 100644 index 0000000..2827f03 --- /dev/null +++ b/lal.changes @@ -0,0 +1,300 @@ +------------------------------------------------------------------- +Sun Nov 17 02:58:29 UTC 2024 - Stefan Brüns + +- Fix building without octave. The requires_eq macro must expand + correctly, even when its result is discarded. +- Add compatibility with SWIG 4.3.0, add + * lalsuite_fix_swig_4_3_0_compat.patch + * lalsuite_fix_swig_4_3_0_compat_2.patch + +------------------------------------------------------------------- +Sun Sep 8 20:22:02 UTC 2024 - Atri Bhattacharya + +- Update to version 7.6.0: + * No release notes. + * Numpy 2 compatibilty. + +------------------------------------------------------------------- +Sat Jul 20 01:52:02 UTC 2024 - Atri Bhattacharya + +- Update to version 7.5.0: + * No release notes. + +------------------------------------------------------------------- +Thu Jan 18 15:13:14 UTC 2024 - Atri Bhattacharya + +- Update to version 7.4.1: + * No release notes. +- Enable builds on non-x84_64 archs, issue fixed. + +------------------------------------------------------------------- +Fri May 26 14:30:47 UTC 2023 - Atri Bhattacharya + +- Fix a couple of incorrect hashbangs on executable scripts. + +------------------------------------------------------------------- +Tue Apr 18 10:35:22 UTC 2023 - pgajdos@suse.com + +- version update to 7.3.1 + * no changelog found +- python-six is not required + https://trello.com/c/MO53MocR/143-remove-python3-six +- deleted patches + - replace_numpy_object.patch (upstreamed) + - swig_4_1_compat.patch (upstreamed) + +------------------------------------------------------------------- +Sat Jan 28 06:06:33 UTC 2023 - Stefan Brüns + +- Fix build after numpy 1.24 API changes, add + replace_numpy_object.patch +- Explicitly add python3-py dependency, no longer pulled in by + pytest +- Replace broken python_compileall macro by correct compileall + invocation (>= 3.9 only, skip with 3.8), make reproducible +- Disable build on all architecture where char is unsigned + +------------------------------------------------------------------- +Sat Nov 26 02:40:59 UTC 2022 - Stefan Brüns + +- Update to version 7.2.4: + * No release notes. +- Fix build with Swig 4.1.0, add swig_4_1_compat.patch + +------------------------------------------------------------------- +Fri Aug 19 11:54:33 UTC 2022 - Atri Bhattacharya + +- Update to version 7.2.0: + * No release notes. +- Update source URL. + +------------------------------------------------------------------- +Thu Jun 23 22:58:37 UTC 2022 - Atri Bhattacharya + +- Update to version 7.1.7: + * No release notes. + +------------------------------------------------------------------- +Sun Jan 2 23:16:49 UTC 2022 - Atri Bhattacharya + +- Update to version 7.1.5: + * No release notes. +- Disable python2 since this is no longer supported by upstream. + +------------------------------------------------------------------- +Fri Sep 10 14:48:22 UTC 2021 - Atri Bhattacharya + +- Fix test flavour after renaming srcrpm in previous commit. + +------------------------------------------------------------------- +Sun May 16 15:14:20 UTC 2021 - Atri Bhattacharya + +- Fix srcrpm name for test flavor. + +------------------------------------------------------------------- +Wed Apr 21 10:59:16 UTC 2021 - Atri Bhattacharya + +- Split tests into a multibuild flavor to avoid circular + BuildRequires with python-ligo-lw and other test requirements. + +------------------------------------------------------------------- +Fri Feb 26 22:23:19 UTC 2021 - Atri Bhattacharya + +- Update to version 7.1.2: + * no release notes. + +------------------------------------------------------------------- +Fri Feb 12 20:32:18 UTC 2021 - Ben Greiner + +- Update to 7.1.1 + * no release notes +- Skip python36 build. Due to NEP 29, python36-numpy and scipy in + TW are no more. + +------------------------------------------------------------------- +Thu Jan 21 22:58:57 UTC 2021 - Atri Bhattacharya + +- Recommend rather than require python-ligo-lw and + python-ligo-segments to avoid circular dependencies (these pkgs + also require lal). + +------------------------------------------------------------------- +Mon Jan 18 21:09:11 UTC 2021 - Benjamin Greiner + +- Fix the test suite setup to actually call the tests + +------------------------------------------------------------------- +Mon Jan 18 13:49:55 UTC 2021 - Atri Bhattacharya + +- Drop lscsoft-glue BuildRequires: no longer required and prevents + circular dependency with lscsoft-glue which indeed needs lal for + its tests. + +------------------------------------------------------------------- +Mon Dec 21 22:11:03 UTC 2020 - Atri Bhattacharya + +- Update to version 7.1.0: + * No release notes. +- Drop lal-implicit-conversion-XLALError.patch: fixed properly + upstream. +- Add BuildRequires: python3-ligo-lw, needed for new tests. +- Disable octave bindings: does not support octave >= 6. + +------------------------------------------------------------------- +Fri Oct 30 09:52:37 UTC 2020 - Stefan Brüns + +- Build without octave bindings on Leap 15.x, requires SWIG 4.0 + +------------------------------------------------------------------- +Sun Oct 25 17:56:07 UTC 2020 - Atri Bhattacharya + +- Specfile cleanups with spec-cleaner. +- Update URL in keeping with upstream change. + +------------------------------------------------------------------- +Sat Aug 15 08:25:42 UTC 2020 - Atri Bhattacharya + +- Run tests as part of %check; add necessary BuildRequires: + python3-scipy, python3-six, python3-freezegun, + python3-python-dateutil, python3-ligo-segments, and + python3-pytest for python3 tests to succeed (don't run tests for + python2). +- Add Requires: python-six, python-freezegun, + python-python-dateutil, python-scipy, and python-ligo-segments + as tests show these packages are needed for the python modules + to work meaningfully. +- ExcludeArch 32-bit, as tests fail and upstream confirms that it + is not supported + (https://git.ligo.org/lscsoft/lalsuite/-/issues/371). + +------------------------------------------------------------------- +Mon Jul 6 21:17:26 UTC 2020 - Atri Bhattacharya + +- Update to version 7.0.0: + * No release notes. +- Re-enable octave support; compilation error seems to be fixed + upstream. + +------------------------------------------------------------------- +Tue Jun 30 09:30:36 UTC 2020 - Atri Bhattacharya + +- Disable octave support as compilation error with current swig. + +------------------------------------------------------------------- +Sat Jun 6 12:09:59 UTC 2020 - Atri Bhattacharya + +- Add lal-implicit-conversion-XLALError.patch to fix an implicit + conversion error flagged by GCC 10. + +------------------------------------------------------------------- +Fri May 15 13:07:39 UTC 2020 - Atri Bhattacharya + +- Drop ExclusiveArch: x86_64: recent versions build on other archs + just fine. +- swig >= 4.0 is required when building octave support (for octave + >= 5.0). + +------------------------------------------------------------------- +Thu Apr 23 13:33:00 UTC 2020 - Atri Bhattacharya + +- Add Requires: python-numpy, python-lscsoft-glue required by the + python module. + +------------------------------------------------------------------- +Fri Apr 3 01:15:58 UTC 2020 - Atri Bhattacharya + +- Update to version 6.22.0. +- Drop lal-build-octave44-with-swig3.patch: Incorporated upstream; + drop BuildRequires: libtool and don't run autoreconf before + configure required due to this patch. + +------------------------------------------------------------------- +Sun Feb 2 22:59:09 UTC 2020 - Atri Bhattacharya + +- Update to version 6.21.0: + * O3b release +- Rebase lal-build-octave44-with-swig3.patch to conform to + upstream's reworking for swig and octave version tests. + +------------------------------------------------------------------- +Mon Sep 30 15:11:36 UTC 2019 - Atri Bhattacharya + +- Build both python2 and python3 flavours. + +------------------------------------------------------------------- +Mon Jul 22 12:25:58 UTC 2019 - Atri Bhattacharya + +- Update to version 6.20.2 + * MKL FFT fixes +- Changes from version 6.20.1: + * O3 point release. +- Changes from version 6.20.0: + * O3 release. +- Update shared lib package names in keeping with upstream so + versioning. +- Rebase lal-build-octave44-with-swig3.patch to conform to + upstream's reworking for swig and octave version tests. + +------------------------------------------------------------------- +Fri Feb 8 13:32:33 UTC 2019 - badshah400@gmail.com + +- Switch builds to python2. + +------------------------------------------------------------------- +Thu Feb 7 14:28:59 UTC 2019 - badshah400@gmail.com + +- Add fftw3 and gsl to -devel package's Requires. +- Drop -devel pkg requirement for octave-lal. + +------------------------------------------------------------------- +Sun Jan 27 15:00:41 UTC 2019 - badshah400@gmail.com + +- Add zlib-devel Requires for -devel pkg: required for compiling + code that makes use of lalsupport. + +------------------------------------------------------------------- +Sat Jan 26 21:27:42 UTC 2019 - badshah400@gmail.com + +- Update to version 6.19.1. + +------------------------------------------------------------------- +Sat Jan 26 20:27:31 UTC 2019 - badshah400@gmail.com + +- Add _constraints file to ensure enough memory during building. + +------------------------------------------------------------------- +Fri Jan 25 16:46:55 UTC 2019 - badshah400@gmail.com + +- Add lal-build-octave44-with-swig3.patch: allow building octave + bindings with swig 3.0.x rather than requiring swig 4.x. + +------------------------------------------------------------------- +Wed Nov 28 17:20:43 UTC 2018 - badshah400@gmail.com + +- Update to version 6.19.0. +- Drop patches incorporated upstream: + * lal-int-in-boolean-context.patch + * lal-implicit-fallthrough.patch + * lal-format-truncate.patch +- New BuildRequires: python-numpy-devel +- Update lalsupport shlib version: 11 -> 12. +- Exclusively build on x86_64 arch; other archs not supported. +- Update URL: upstream URL changed. + +------------------------------------------------------------------- +Fri Jun 15 11:22:10 UTC 2018 - badshah400@gmail.com + +- Add patches from upstream to fix compilation against gcc >= 7.1: + * lal-int-in-boolean-context.patch: Avoid '*' in boolean + expressions to avoid int-in-boolean-context warnings from gcc. + * lal-implicit-fallthrough.patch: Avoid implict-fallthrough + warnings when compiling against GCC >= 7. + * lal-format-truncate.patch: GCC >= 7 does not allow snprintf() + return values to go unchecked when it believes there is a risk + of the result being truncated; update patch to include + additional fix. + +------------------------------------------------------------------- +Fri Jun 15 11:22:07 UTC 2018 - badshah400@gmail.com + +- Initial package. diff --git a/lal.spec b/lal.spec new file mode 100644 index 0000000..235d4b1 --- /dev/null +++ b/lal.spec @@ -0,0 +1,252 @@ +# +# spec file for package lal +# +# Copyright (c) 2024 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/ +# + + +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%bcond_without test +%define psuffix -test +%else +%bcond_with test +%define psuffix %{nil} +%endif + +# NEP 29: numpy, scipy do not have a python36 flavor package in TW +%define skip_python36 1 +# Py2 no longer supported by upstream +%define skip_python2 1 + +%define shliblal liblal20 +%define shliblalsupport liblalsupport14 + +# No support for octave >= 6 +%bcond_with octave +Name: lal%{psuffix} +Version: 7.6.0 +Release: 0 +Summary: A collection of various gravitational wave data analysis routines +License: GPL-2.0-only +Group: Productivity/Scientific/Physics +URL: https://wiki.ligo.org/Computing/LALSuite +Source: https://software.igwn.org/sources/source/lalsuite/lal-%{version}.tar.xz +# PATCH-FIX-UPSTREAM +Patch0: https://git.ligo.org/lscsoft/lalsuite/-/commit/9dba245ab3692ecf691247a442704f13c075ed34.patch#/lalsuite_fix_swig_4_3_0_compat.patch +# PATCH-FIX-UPSTREAM +Patch1: https://git.ligo.org/lscsoft/lalsuite/-/commit/e12d57e893882c1603778018139ed9060579c8a7.patch#/lalsuite_fix_swig_4_3_0_compat_2.patch +BuildRequires: %{python_module devel} +BuildRequires: %{python_module numpy-devel} +BuildRequires: %{python_module numpy} +BuildRequires: %{python_module xml} +BuildRequires: bc +BuildRequires: fdupes +BuildRequires: hdf5-devel +BuildRequires: pkgconfig +BuildRequires: python-rpm-macros +BuildRequires: pkgconfig(fftw3) +BuildRequires: pkgconfig(gsl) +BuildRequires: pkgconfig(zlib) +Requires: python-freezegun +Requires: python-numpy +Requires: python-python-dateutil +Requires: python-scipy +Recommends: python-ligo-lw +Recommends: python-ligo-segments +%if %{with octave} +BuildRequires: octave-devel +BuildRequires: swig >= 4.0 +%else +BuildRequires: swig >= 3.0 +%endif +%if %{with test} +# SECTION For tests (only the default python3 flavor) +BuildRequires: python3-freezegun +BuildRequires: python3-ligo-lw +BuildRequires: python3-ligo-segments +# python3-py - remove with next update -- https://git.ligo.org/lscsoft/lalsuite/-/merge_requests/2033 +BuildRequires: python3-py +BuildRequires: python3-pytest +BuildRequires: python3-python-dateutil +BuildRequires: python3-scipy +# /SECTION +%endif + +%python_subpackages + +%description +The LSC Algorithm Library Suite (LALSuite) is comprised of various +gravitational wave data analysis routines written in C following the ISO/IEC +9899:1999 standard. + +%package -n %{shliblal} +Summary: Shared library for LAL +Group: System/Libraries + +%description -n %{shliblal} +The LSC Algorithm Library Suite (LALSuite) is comprised of various +gravitational wave data analysis routines written in C following the ISO/IEC +9899:1999 standard. + +This package provides the shared library for lal. + +%package -n %{shliblalsupport} +Summary: Shared library for LALSupport +Group: System/Libraries + +%description -n %{shliblalsupport} +The LSC Algorithm Library Suite (LALSuite) is comprised of various +gravitational wave data analysis routines written in C following the ISO/IEC +9899:1999 standard. + +This package provides the shared library for lalsupport. + +%package -n %{name}-devel +Summary: Headers and source files for building against lal +Group: Productivity/Scientific/Physics +Requires: %{shliblalsupport} = %{version} +Requires: %{shliblal} = %{version} +Requires: pkgconfig(fftw3) +Requires: pkgconfig(gsl) +Requires: pkgconfig(zlib) + +%description -n %{name}-devel +The LSC Algorithm Library Suite (LALSuite) is comprised of various +gravitational wave data analysis routines written in C following the ISO/IEC +9899:1999 standard. + +This package provides the header files and sources need for building software against lal. + +%package -n octave-lal +Summary: Octave module for lal +Group: Productivity/Scientific/Physics +%if %{with octave} +%requires_eq octave-cli +%endif + +%description -n octave-lal +The LSC Algorithm Library Suite (LALSuite) is comprised of various +gravitational wave data analysis routines written in C following the ISO/IEC +9899:1999 standard. + +This package provides the octave module for lal. + +%prep +%autosetup -p2 -n lal-%{version} + +%build +%{python_expand # Necessary to run configure with all python flavors +export PYTHON=$python +mkdir ../${PYTHON}_build +cp -pr ./ ../${PYTHON}_build +pushd ../${PYTHON}_build +%configure \ + %{?with_octave:--enable-swig-octave} \ + %{!?with_octave:--disable-swig-octave} +%make_build +popd +} + +%install +%if %{without test} +%{python_expand # all python flavors as configured above +export PYTHON=$python +pushd ../${PYTHON}_build +%make_install +popd +} + +rm %{buildroot}%{_sysconfdir}/* + +find %{buildroot} -type f -name "*.la" -delete -print +find %{buildroot}%{_libdir} -name "*.a" -delete -print + +%{python_expand # FIX env HASHBANGS +sed -Ei "1{/^#!\/usr\/bin\/env python/d}" \ + %{buildroot}%{$python_sitearch}/lal/{gpstime,series,antenna}.py +rm %{buildroot}%{$python_sitearch}/lal/__pycache__/{gpstime,series,antenna}*.pyc + +# Only compileall >= 3.9 has '-s strip_prefix' option +if [ %{$python_version_nodots} -ge 39 ]; then \ + for d in %{buildroot}%{$python_sitelib} %{buildroot}%{$python_sitearch}; do \ + if [ -d $d ]; then \ + $python -m compileall -s %{buildroot} $d; \ + $python -O -m compileall -s %{buildroot} $d; \ + fi; \ + done \ +fi; +} +# python_compileall is broken, see https://github.com/openSUSE/python-rpm-macros/issues/150 +#%%{?python_compileall} + +%{python_expand # Verify we don't have broken cache files +# "-exec false {} +" makes the return code nonzero on match +find %{buildroot}%{$python_sitearch} -iname \*pyc -type f \( -exec grep 'home/abuild' '{}' \; -and -exec false '{}' \+ \) +} + +%python_expand %fdupes %{buildroot}%{$python_sitearch}/ + +# Fix broken hashbang +sed -Ei "1{s|(python3\.?[0-9]*)|%{_bindir}/\1|}" %{buildroot}%{_bindir}/lal_{path2cache,searchsum2cache} +%endif + +%check +%if %{with test} +%{python_expand # Run tests from the build dir of the primary python3 flavor only +if [ "$python_" = "python3_" -o "%{$python_provides}" = "python3" ]; then +export PYTHON=$python +pushd ../${PYTHON}_build +%make_build check +popd +fi +} +%endif + +%if %{without test} +%post -n %{shliblal} -p /sbin/ldconfig +%post -n %{shliblalsupport} -p /sbin/ldconfig +%postun -n %{shliblal} -p /sbin/ldconfig +%postun -n %{shliblalsupport} -p /sbin/ldconfig + +%files %{python_files} +%{python_sitearch}/lal/ + +%files -n %{shliblal} +%{_libdir}/liblal.so.* + +%files -n %{shliblalsupport} +%{_libdir}/liblalsupport.so.* + +%files -n %{name}-devel +%doc AUTHORS README.md +%license COPYING +%{_bindir}/* +%{_includedir}/lal/ +%{_libdir}/liblal.so +%{_libdir}/liblalsupport.so +%{_libdir}/pkgconfig/*.pc +%{_mandir}/man7/*.7%{?ext_man} + +%if %{with octave} +%files -n octave-lal +%dir %{_libdir}/octave/*/site +%dir %{_libdir}/octave/*/site/oct +%dir %{_libdir}/octave/*/site/oct/* +%{_libdir}/octave/*/site/oct/*/*.oct +%endif + +%endif + +%changelog diff --git a/lalsuite_fix_swig_4_3_0_compat.patch b/lalsuite_fix_swig_4_3_0_compat.patch new file mode 100644 index 0000000..046f5ff --- /dev/null +++ b/lalsuite_fix_swig_4_3_0_compat.patch @@ -0,0 +1,33 @@ +From 9dba245ab3692ecf691247a442704f13c075ed34 Mon Sep 17 00:00:00 2001 +From: Karl Wette +Date: Thu, 24 Oct 2024 18:06:30 +1100 +Subject: [PATCH] common/swig/generate_swig_iface.py: prefer "stringval" before + "value" attribute + +- As of SWIG 4.3.0 "value" attribute contains quote characters +- "stringval" attribute appears to still contain the raw string +--- + common/swig/generate_swig_iface.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/common/swig/generate_swig_iface.py b/common/swig/generate_swig_iface.py +index 530b026d5d..eaee2d41ce 100644 +--- a/common/swig/generate_swig_iface.py ++++ b/common/swig/generate_swig_iface.py +@@ -195,9 +195,11 @@ class SwigSymbols(object): + """Parse a swiglal macro + """ + cdecl_name = get_swig_attr(cdecl, 'name') +- cdecl_value = get_swig_attr(cdecl, 'value') ++ cdecl_value = get_swig_attr(cdecl, 'stringval') + if not cdecl_value: +- raise ValueError("cdecl '{}' has no value".format(cdecl_name)) ++ cdecl_value = get_swig_attr(cdecl, 'value') ++ if not cdecl_value: ++ raise ValueError("cdecl '{}' has no value".format(cdecl_name)) + macro = re.sub(r'\s', '', cdecl_value) + if cdecl_name == '__swiglal__': + if macro in clear_macros: +-- +GitLab + diff --git a/lalsuite_fix_swig_4_3_0_compat_2.patch b/lalsuite_fix_swig_4_3_0_compat_2.patch new file mode 100644 index 0000000..b52d9e5 --- /dev/null +++ b/lalsuite_fix_swig_4_3_0_compat_2.patch @@ -0,0 +1,99 @@ +From e12d57e893882c1603778018139ed9060579c8a7 Mon Sep 17 00:00:00 2001 +From: Karl Wette +Date: Thu, 24 Oct 2024 21:37:48 +1100 +Subject: [PATCH] lal/swig/SWIGCommon.i: refactor SWIGLAL_MAYBE_RETURN_INT + typemap + +- New behaviour of SWIG_Python_AppendOutput() makes it more difficult + to not add XLAL error code at start of output argument list +- Instead, always add XLAL error code at start of output argument list, + them remove it later in "newfree" typemap +--- + lal/swig/SWIGCommon.i | 23 +++++------------------ + lal/swig/SWIGOctave.i | 6 ++++-- + lal/swig/SWIGPython.i | 16 +++++++++++++--- + 3 files changed, 22 insertions(+), 23 deletions(-) + +diff --git a/lal/swig/SWIGCommon.i b/lal/swig/SWIGCommon.i +index bb6dc62e6e..3ce595e232 100644 +--- a/lal/swig/SWIGCommon.i ++++ b/lal/swig/SWIGCommon.i +@@ -1650,24 +1650,11 @@ if (strides[I-1] == 0) { + /// ignored in the wrappings. Functions which fit this criteria but do return a useful int can + /// use SWIGLAL(RETURN_VALUE(int, ...)) to disable this behaviour. + /// +-/// For functions, since %feature("new") is set, the out typemap will have $owner=1, +-/// and the newfree typemap is also applied. The out typemap ignores the int return value +-/// by setting the output argument list to VOID_Object; the wrapping function them proceeds to +-/// add other output arguments to the list, if any. After this, the newfree typemap is triggered, +-/// which appends the int return if the output argument list is empty, using the +-/// scripting-language-specific macro \b swiglal_append_output_if_empty(). For structs, +-/// $owner=0, so the int return is set straight away, and the newfree typemap is never +-/// applied. +-/// +-%typemap(out, noblock=1, fragment=SWIG_From_frag(int)) int SWIGLAL_MAYBE_RETURN_INT { +-%#if $owner +- %set_output(VOID_Object); +-%#else +- %set_output(SWIG_From(int)($1)); +-%#endif +-} +-%typemap(newfree, noblock=1, fragment=SWIG_From_frag(int)) int SWIGLAL_MAYBE_RETURN_INT { +- swiglal_append_output_if_empty(SWIG_From(int)($1)); ++/// For functions, the newfree typemap is applied, which calls the scripting-language-specific macro ++/// \b swiglal_maybe_return_int(). For structs, the newfree typemap is never applied. ++/// ++%typemap(newfree, noblock=1) int SWIGLAL_MAYBE_RETURN_INT { ++ swiglal_maybe_return_int(); + } + + /// +diff --git a/lal/swig/SWIGOctave.i b/lal/swig/SWIGOctave.i +index d2ef3cbdbc..8c0ea50da4 100644 +--- a/lal/swig/SWIGOctave.i ++++ b/lal/swig/SWIGOctave.i +@@ -65,9 +65,11 @@ extern "C++" { + #define swiglal_get_reference(v) (v) + %} + +-// Append an argument to the output argument list of an Octave SWIG-wrapped function, if the list is empty. ++// Remove the first argument (i.e. the XLAL error code) from the output argument list of an ++// Octave SWIG-wrapped function, if the list has more than one output argument. + %header %{ +-#define swiglal_append_output_if_empty(v) if (_outp->length() == 0) _outp = SWIG_Octave_AppendOutput(_outp, v) ++#define swiglal_maybe_return_int() \ ++ if (_out.length() > 1) _out = _out.slice(1, _out.length() - 1) + %} + + // Evaluates true if an octave_value represents a null pointer, false otherwise. +diff --git a/lal/swig/SWIGPython.i b/lal/swig/SWIGPython.i +index 2482a8580f..8f332822d1 100644 +--- a/lal/swig/SWIGPython.i ++++ b/lal/swig/SWIGPython.i +@@ -86,10 +86,20 @@ import_array(); + SWIGINTERNINLINE PyObject* swiglal_get_reference(PyObject* v) { Py_XINCREF(v); return v; } + %} + +-// Append an argument to the output argument list of an Python SWIG-wrapped function, if the list is +-// empty. ++// Remove the first argument (i.e. the XLAL error code) from the output argument list of a ++// Python SWIG-wrapped function, if the list has more than one output argument. + %header %{ +-#define swiglal_append_output_if_empty(v) if (resultobj == Py_None) resultobj = SWIG_Python_AppendOutput(resultobj, v) ++SWIGINTERN PyObject* swiglal_py_remove_first_output(PyObject *result) { ++ PySequence_DelItem(result, 0); ++ if (PySequence_Size(result) == 1) { ++ PyObject *obj = result; ++ result = PySequence_GetItem(obj, 0); ++ Py_DECREF(obj); ++ } ++ return result; ++} ++#define swiglal_maybe_return_int() \ ++ if (PySequence_Check(resultobj) && PySequence_Size(resultobj) > 1) resultobj = swiglal_py_remove_first_output(resultobj) + %} + + // Evaluates true if a PyObject represents a null pointer, false otherwise. +-- +GitLab +