Accepting request 1224790 from science

OBS-URL: https://build.opensuse.org/request/show/1224790
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lal?expand=0&rev=15
This commit is contained in:
Ana Guerrero 2024-11-18 19:01:50 +00:00 committed by Git OBS Bridge
commit 24b54c05a9
4 changed files with 148 additions and 1 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sun Nov 17 02:58:29 UTC 2024 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- 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 <badshah400@gmail.com>

View File

@ -43,6 +43,10 @@ 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}
@ -128,7 +132,9 @@ This package provides the header files and sources need for building software ag
%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
@ -138,7 +144,7 @@ gravitational wave data analysis routines written in C following the ISO/IEC
This package provides the octave module for lal.
%prep
%autosetup -p1 -n lal-%{version}
%autosetup -p2 -n lal-%{version}
%build
%{python_expand # Necessary to run configure with all python flavors

View File

@ -0,0 +1,33 @@
From 9dba245ab3692ecf691247a442704f13c075ed34 Mon Sep 17 00:00:00 2001
From: Karl Wette <karl.wette@ligo.org>
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

View File

@ -0,0 +1,99 @@
From e12d57e893882c1603778018139ed9060579c8a7 Mon Sep 17 00:00:00 2001
From: Karl Wette <karl.wette@ligo.org>
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 <tt>int</tt> can
/// use <b>SWIGLAL(RETURN_VALUE(int, ...))</b> to disable this behaviour.
///
-/// For functions, since <tt>%feature("new")</tt> is set, the <tt>out</tt> typemap will have <tt>$owner=1</tt>,
-/// and the <tt>newfree</tt> typemap is also applied. The <tt>out</tt> typemap ignores the <tt>int</tt> return value
-/// by setting the output argument list to <tt>VOID_Object</tt>; the wrapping function them proceeds to
-/// add other output arguments to the list, if any. After this, the <tt>newfree</tt> typemap is triggered,
-/// which appends the <tt>int</tt> return if the output argument list is empty, using the
-/// scripting-language-specific macro \b swiglal_append_output_if_empty(). For structs,
-/// <tt>$owner=0</tt>, so the int return is set straight away, and the <tt>newfree</tt> 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 <tt>newfree</tt> typemap is applied, which calls the scripting-language-specific macro
+/// \b swiglal_maybe_return_int(). For structs, the <tt>newfree</tt> 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