public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/nordugrid-arc] f45: Use upstream's patch for SWIG 4.5.0 support
@ 2026-08-18 19:06 Mattias Ellert
  0 siblings, 0 replies; only message in thread
From: Mattias Ellert @ 2026-08-18 19:06 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/nordugrid-arc
Branch : f45
Commit : 14fb7a5945f9c44c4f84e3d7bb2f20789adb04a4
Author : Mattias Ellert <mattias.ellert@physics.uu.se>
Date   : 2026-08-18T21:04:10+02:00
Stats  : +99/-114 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/nordugrid-arc/c/14fb7a5945f9c44c4f84e3d7bb2f20789adb04a4?branch=f45

Log:
Use upstream's patch for SWIG 4.5.0 support

---
diff --git a/0001-Use-Python-3-API-in-SWIG-wrwppers.patch b/0001-Use-Python-3-API-in-SWIG-wrwppers.patch
new file mode 100644
index 0000000..411154a
--- /dev/null
+++ b/0001-Use-Python-3-API-in-SWIG-wrwppers.patch
@@ -0,0 +1,93 @@
+From 2dbee3b5a003ff9c8fb5f9ecbac9640eae6ea9d5 Mon Sep 17 00:00:00 2001
+From: Mattias Ellert <mattias.ellert@physics.uu.se>
+Date: Tue, 18 Aug 2026 10:26:08 +0200
+Subject: [PATCH] Use Python 3 API in SWIG wrwppers
+
+Don't rely on Python 2 compatibility macros in the SWIG headers.
+They were removed in SWIG 4.5.0.
+---
+ swig/Arc.i  | 10 ++++++++++
+ swig/data.i | 16 ++++++++++++----
+ 2 files changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/swig/Arc.i b/swig/Arc.i
+index 28ce22c58..b5667df22 100644
+--- a/swig/Arc.i
++++ b/swig/Arc.i
+@@ -90,7 +90,9 @@ class StaticPropertyWrapper(object):
+ %typemap(in) time_t
+ {
+   if      (PyLong_Check($input))  $1 = (time_t) PyLong_AsLong($input);
++%#if PY_VERSION_HEX < 0x03000000
+   else if (PyInt_Check($input))   $1 = (time_t) PyInt_AsLong($input);
++%#endif
+   else if (PyFloat_Check($input)) $1 = (time_t) PyFloat_AsDouble($input);
+   else {
+     PyErr_SetString(PyExc_TypeError,"Expected a large type");
+@@ -107,7 +109,11 @@ class StaticPropertyWrapper(object):
+ 
+ %typemap(in) uint32_t
+ {
++%#if PY_VERSION_HEX < 0x03000000
+   if      (PyInt_Check($input))   $1 = (uint32_t) PyInt_AsLong($input);
++%#else
++  if      (PyLong_Check($input))  $1 = (uint32_t) PyLong_AsLong($input);
++%#endif
+   else if (PyFloat_Check($input)) $1 = (uint32_t) PyFloat_AsDouble($input);
+   else {
+     PyErr_SetString(PyExc_TypeError,"Unable to convert type to 32bit number (int/float)");
+@@ -118,7 +124,11 @@ class StaticPropertyWrapper(object):
+ 
+ %typemap(out) uint32_t
+ {
++%#if PY_VERSION_HEX < 0x03000000
+   $result = PyInt_FromLong((int)$1);
++%#else
++  $result = PyLong_FromLong((int)$1);
++%#endif
+ }
+ #endif
+ 
+diff --git a/swig/data.i b/swig/data.i
+index 8a6dba612..66a8efee6 100644
+--- a/swig/data.i
++++ b/swig/data.i
+@@ -121,23 +121,31 @@ typedef struct {
+ 
+ %typemap(out) Arc::DataBufferForWriteResult {
+   $result = PyTuple_New(5);
++%#if PY_VERSION_HEX >= 0x03000000
++  PyTuple_SetItem($result,0,PyLong_FromLong($1.result));
++  PyTuple_SetItem($result,1,PyLong_FromLong($1.handle));
++  PyTuple_SetItem($result,2,PyLong_FromLong($1.size));
++  PyTuple_SetItem($result,3,PyLong_FromLong($1.offset));
++  PyTuple_SetItem($result,4,$1.buffer?PyUnicode_FromStringAndSize($1.buffer,$1.size):Py_None);
++%#else
+   PyTuple_SetItem($result,0,PyInt_FromLong($1.result));
+   PyTuple_SetItem($result,1,PyInt_FromLong($1.handle));
+   PyTuple_SetItem($result,2,PyInt_FromLong($1.size));
+   PyTuple_SetItem($result,3,PyInt_FromLong($1.offset));
+-%#if PY_VERSION_HEX>=0x03000000
+-  PyTuple_SetItem($result,4,$1.buffer?PyUnicode_FromStringAndSize($1.buffer,$1.size):Py_None);
+-%#else
+   PyTuple_SetItem($result,4,$1.buffer?PyString_FromStringAndSize($1.buffer,$1.size):Py_None);
+ %#endif
+ }
+ 
+ %typemap(out) Arc::DataBufferForReadResult {
++%#if PY_VERSION_HEX >= 0x03000000
++  $result = PyTuple_Pack(3, PyLong_FromLong($1.result), PyLong_FromLong($1.handle), PyLong_FromLong($1.size));
++%#else
+   $result = PyTuple_Pack(3, PyInt_FromLong($1.result), PyInt_FromLong($1.handle), PyInt_FromLong($1.size));
++%#endif
+ }
+ 
+ %typemap(in) (char* DataBufferIsReadBuf, unsigned int DataBufferIsReadSize) {
+-%#if PY_VERSION_HEX>=0x03000000
++%#if PY_VERSION_HEX >= 0x03000000
+   $input = PyUnicode_AsUTF8String($input);
+   $1 = PyBytes_AsString($input);
+   $2 = ($1)?PyBytes_Size($input):0;
+-- 
+2.55.0
+

diff --git a/nordugrid-arc-swig45.patch b/nordugrid-arc-swig45.patch
deleted file mode 100644
index df15128..0000000
--- a/nordugrid-arc-swig45.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-diff -up nordugrid-arc-7.1.2/src/hed/acc/PythonBroker/PythonBrokerPlugin.cpp.swig45 nordugrid-arc-7.1.2/src/hed/acc/PythonBroker/PythonBrokerPlugin.cpp
---- nordugrid-arc-7.1.2/src/hed/acc/PythonBroker/PythonBrokerPlugin.cpp.swig45	2026-07-28 10:13:28.445651632 +0200
-+++ nordugrid-arc-7.1.2/src/hed/acc/PythonBroker/PythonBrokerPlugin.cpp	2026-07-28 10:13:28.454210671 +0200
-@@ -126,7 +126,7 @@ namespace Arc {
- #if PY_MAJOR_VERSION >= 3
-     PyObjectP py_arc_module_name = PyUnicode_FromString("arc");
- #else
--    PyObjectP py_arc_module_name = PyString_FromString("arc");
-+    PyObjectP py_arc_module_name = PyUnicode_FromString("arc");
- #endif
-     if (!py_arc_module_name) {
-       logger.msg(ERROR, "Cannot convert ARC module name to Python string");
-@@ -201,7 +201,7 @@ namespace Arc {
- #if PY_MAJOR_VERSION >= 3
-     PyObjectP py_module_name = PyUnicode_FromString(module_name.c_str());
- #else
--    PyObjectP py_module_name = PyString_FromString(module_name.c_str());
-+    PyObjectP py_module_name = PyUnicode_FromString(module_name.c_str());
- #endif
-     if (!py_module_name) {
-       logger.msg(ERROR, "Cannot convert module name to Python string");
-diff -up nordugrid-arc-7.1.2/src/services/wrappers/python/pythonwrapper.cpp.swig45 nordugrid-arc-7.1.2/src/services/wrappers/python/pythonwrapper.cpp
---- nordugrid-arc-7.1.2/src/services/wrappers/python/pythonwrapper.cpp.swig45	2026-07-28 10:13:28.447651675 +0200
-+++ nordugrid-arc-7.1.2/src/services/wrappers/python/pythonwrapper.cpp	2026-07-28 10:13:28.455079702 +0200
-@@ -151,7 +151,7 @@ Service_PythonWrapper::Service_PythonWra
- #if PY_MAJOR_VERSION >= 3
-     py_module_name = PyUnicode_FromString(module_name.c_str());
- #else
--    py_module_name = PyString_FromString(module_name.c_str());
-+    py_module_name = PyUnicode_FromString(module_name.c_str());
- #endif
-     if (py_module_name == NULL) {
-         logger.msg(Arc::ERROR, "Cannot convert module name to Python string");
-@@ -172,7 +172,7 @@ Service_PythonWrapper::Service_PythonWra
- #if PY_MAJOR_VERSION >= 3
-     py_arc_module_name = PyUnicode_FromString("arc");
- #else
--    py_arc_module_name = PyString_FromString("arc");
-+    py_arc_module_name = PyUnicode_FromString("arc");
- #endif
-     if (py_arc_module_name == NULL) {
-         logger.msg(Arc::ERROR, "Cannot convert ARC module name to Python string");
-diff -up nordugrid-arc-7.1.2/swig/Arc.i.swig45 nordugrid-arc-7.1.2/swig/Arc.i
---- nordugrid-arc-7.1.2/swig/Arc.i.swig45	2026-07-28 10:13:28.449651717 +0200
-+++ nordugrid-arc-7.1.2/swig/Arc.i	2026-07-28 10:13:28.456239355 +0200
-@@ -90,7 +90,7 @@ class StaticPropertyWrapper(object):
- %typemap(in) time_t
- {
-   if      (PyLong_Check($input))  $1 = (time_t) PyLong_AsLong($input);
--  else if (PyInt_Check($input))   $1 = (time_t) PyInt_AsLong($input);
-+  else if (PyLong_Check($input))   $1 = (time_t) PyLong_AsLong($input);
-   else if (PyFloat_Check($input)) $1 = (time_t) PyFloat_AsDouble($input);
-   else {
-     PyErr_SetString(PyExc_TypeError,"Expected a large type");
-@@ -107,7 +107,7 @@ class StaticPropertyWrapper(object):
- 
- %typemap(in) uint32_t
- {
--  if      (PyInt_Check($input))   $1 = (uint32_t) PyInt_AsLong($input);
-+  if      (PyLong_Check($input))   $1 = (uint32_t) PyLong_AsLong($input);
-   else if (PyFloat_Check($input)) $1 = (uint32_t) PyFloat_AsDouble($input);
-   else {
-     PyErr_SetString(PyExc_TypeError,"Unable to convert type to 32bit number (int/float)");
-@@ -118,7 +118,7 @@ class StaticPropertyWrapper(object):
- 
- %typemap(out) uint32_t
- {
--  $result = PyInt_FromLong((int)$1);
-+  $result = PyLong_FromLong((int)$1);
- }
- #endif
- 
-diff -up nordugrid-arc-7.1.2/swig/data.i.swig45 nordugrid-arc-7.1.2/swig/data.i
---- nordugrid-arc-7.1.2/swig/data.i.swig45	2026-07-28 10:13:28.450651739 +0200
-+++ nordugrid-arc-7.1.2/swig/data.i	2026-07-28 10:13:28.456694868 +0200
-@@ -121,10 +121,10 @@ typedef struct {
- 
- %typemap(out) Arc::DataBufferForWriteResult {
-   $result = PyTuple_New(5);
--  PyTuple_SetItem($result,0,PyInt_FromLong($1.result));
--  PyTuple_SetItem($result,1,PyInt_FromLong($1.handle));
--  PyTuple_SetItem($result,2,PyInt_FromLong($1.size));
--  PyTuple_SetItem($result,3,PyInt_FromLong($1.offset));
-+  PyTuple_SetItem($result,0,PyLong_FromLong($1.result));
-+  PyTuple_SetItem($result,1,PyLong_FromLong($1.handle));
-+  PyTuple_SetItem($result,2,PyLong_FromLong($1.size));
-+  PyTuple_SetItem($result,3,PyLong_FromLong($1.offset));
- %#if PY_VERSION_HEX>=0x03000000
-   PyTuple_SetItem($result,4,$1.buffer?PyUnicode_FromStringAndSize($1.buffer,$1.size):Py_None);
- %#else
-@@ -133,7 +133,7 @@ typedef struct {
- }
- 
- %typemap(out) Arc::DataBufferForReadResult {
--  $result = PyTuple_Pack(3, PyInt_FromLong($1.result), PyInt_FromLong($1.handle), PyInt_FromLong($1.size));
-+  $result = PyTuple_Pack(3, PyLong_FromLong($1.result), PyLong_FromLong($1.handle), PyLong_FromLong($1.size));
- }
- 
- %typemap(in) (char* DataBufferIsReadBuf, unsigned int DataBufferIsReadSize) {
-@@ -142,8 +142,8 @@ typedef struct {
-   $1 = PyBytes_AsString($input);
-   $2 = ($1)?PyBytes_Size($input):0;
- %#else
--  $1 = PyString_AsString($input);
--  $2 = ($1)?PyString_Size($input):0;
-+  $1 = PyBytes_AsString($input);
-+  $2 = ($1)?PyBytes_Size($input):0;
- %#endif
- }
- 

diff --git a/nordugrid-arc.spec b/nordugrid-arc.spec
index fa8ce0f..439fdc7 100644
--- a/nordugrid-arc.spec
+++ b/nordugrid-arc.spec
@@ -23,7 +23,7 @@
 
 Name:		nordugrid-arc
 Version:	7.1.2
-Release:	7%{?dist}
+Release:	8%{?dist}
 Summary:	Advanced Resource Connector Middleware
 #		Apache-2.0: most files
 #		MIT: src/external/cJSON/cJSON.c src/external/cJSON/cJSON.h
@@ -38,9 +38,8 @@ Patch0:		0001-Handle-Python-multi-phase-initialization-support-in-.patch
 Patch1:		0001-Fix-compilation-with-Python-3.15.patch
 #		https://source.coderefinery.org/nordugrid/arc/-/merge_requests/1997
 Patch2:		0001-Support-OpenSSL-4.patch
-# Replace removed Python 2 C API macros with Python 3 equivalents
-# for compatibility with SWIG 4.5.0
-Patch3:		nordugrid-arc-swig45.patch
+#		https://source.coderefinery.org/nordugrid/arc/-/merge_requests/2012
+Patch3:		0001-Use-Python-3-API-in-SWIG-wrwppers.patch
 
 #		Packages dropped without replacements
 Obsoletes:	%{name}-arcproxyalt < 6.0.0
@@ -1144,6 +1143,9 @@ semanage fcontext -a -t slapd_var_run_t "/var/run/arc/bdii/db(/.*)?" 2>/dev/null
 %{_sbindir}/arc-exporter
 
 %changelog
+* Tue Aug 18 2026 Mattias Ellert <mattias.ellert@physics.uu.se> - 7.1.2-8
+- Use upstream's patch for SWIG 4.5.0 support
+
 * Tue Jul 28 2026 Jitka Plesnikova <jplesnik@redhat.com> - 7.1.2-7
 - Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-18 19:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-18 19:06 [rpms/nordugrid-arc] f45: Use upstream's patch for SWIG 4.5.0 support Mattias Ellert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox