Compare commits

...

3 Commits
master ... f15

Author SHA1 Message Date
Adam Tkac 0332f3072d - backport r12814 from trunk (#753321)
- improve Octave compatibility (#679948)

Signed-off-by: Adam Tkac <atkac@redhat.com>
2011-11-15 13:59:04 +01:00
Adam Tkac e3972dc4c4 Upload 2.0.4 tarball.
Signed-off-by: Adam Tkac <atkac@redhat.com>
2011-07-11 10:14:22 +02:00
Adam Tkac 5425f1816f Update to 2.0.4.
- patches merged
 - swig200-rh666429.patch
 - swig200-rh623854.patch

Signed-off-by: Adam Tkac <atkac@redhat.com>

Conflicts:

	swig.spec
2011-07-11 10:08:55 +02:00
7 changed files with 318 additions and 166 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ swig-2.0.0.tar.gz
/swig-2.0.1.tar.gz
/swig-2.0.2.tar.gz
/swig-2.0.3.tar.gz
/swig-2.0.4.tar.gz

View File

@ -1 +1 @@
e548ea3882b994c4907d6be86bef90f2 swig-2.0.3.tar.gz
4319c503ee3a13d2a53be9d828c3adc0 swig-2.0.4.tar.gz

View File

@ -3,15 +3,15 @@
Summary: Connects C/C++/Objective C to some high-level programming languages
Name: swig
Version: 2.0.3
Release: 1%{?dist}
Version: 2.0.4
Release: 2%{?dist}
License: GPLv3+ and BSD
Group: Development/Tools
URL: http://swig.sourceforge.net/
Source: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz
Patch1: swig-1.3.23-pylib.patch
Patch2: swig200-rh623854.patch
Patch3: swig200-rh666429.patch
Patch2: swig204-rh679948.patch
Patch3: swig204-rh753321.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: perl, python-devel, pcre-devel
@ -44,8 +44,8 @@ This package contains documentation for SWIG and useful examples
%prep
%setup -q -n swig-%{version}
%patch1 -p1 -b .pylib
%patch2 -p1 -b .rh623854
%patch3 -p1 -b .rh666429
%patch2 -p0 -b .rh679948
%patch3 -p0 -b .rh753321
# as written on https://fedoraproject.org/wiki/Packaging_talk:Perl, section 2
# (specific req/prov filtering). Before you remove this hack make sure you don't
@ -117,6 +117,16 @@ rm -rf %{buildroot}
%doc Doc Examples LICENSE LICENSE-GPL LICENSE-UNIVERSITIES COPYRIGHT
%changelog
* Tue Nov 15 2011 Adam Tkac <atkac redhat com> 2.0.4-2
- backport r12814 from trunk (#753321)
- improve Octave compatibility (#679948)
* Mon Jun 20 2011 Adam Tkac <atkac redhat com> 2.0.4-1
- update to 2.0.4
- patches merged
- swig200-rh666429.patch
- swig200-rh623854.patch
* Fri Apr 22 2011 Adam Tkac <atkac redhat com> 2.0.3-1
- update to 2.0.3
- swig202-rh691513.patch merged

View File

@ -1,92 +0,0 @@
diff -up swig-2.0.0/Lib/python/pyrun.swg.rh623854 swig-2.0.0/Lib/python/pyrun.swg
--- swig-2.0.0/Lib/python/pyrun.swg.rh623854 2010-02-28 00:26:02.000000000 +0100
+++ swig-2.0.0/Lib/python/pyrun.swg 2010-08-17 16:32:16.581604656 +0200
@@ -45,8 +45,18 @@
#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
-#define SWIG_fail goto fail
+#define SWIG_fail goto fail
+/*
+ * Python 2.7 and newer and Python 3.1 and newer should use Capsules API instead of
+ * CObjects API.
+ */
+#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
+ (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0))
+#define USE_CAPSULES
+#define TYPE_POINTER_NAME \
+ ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
+#endif
/* Runtime API implementation */
@@ -1356,8 +1366,12 @@ SWIG_Python_GetModule(void) {
#ifdef SWIG_LINK_RUNTIME
type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
#else
+#ifdef USE_CAPSULES
+ type_pointer = PyCapsule_Import(TYPE_POINTER_NAME, 0);
+#else
type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
(char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
+#endif
if (PyErr_Occurred()) {
PyErr_Clear();
type_pointer = (void *)0;
@@ -1402,9 +1416,14 @@ PyModule_AddObject(PyObject *m, char *na
SWIGRUNTIME void
SWIG_Python_DestroyModule(void *vptr)
{
+ size_t i;
+#ifdef USE_CAPSULES
+ swig_module_info *swig_module =
+ (swig_module_info *) PyCapsule_GetPointer((PyObject *)vptr, TYPE_POINTER_NAME);
+#else
swig_module_info *swig_module = (swig_module_info *) vptr;
+#endif
swig_type_info **types = swig_module->types;
- size_t i;
for (i =0; i < swig_module->size; ++i) {
swig_type_info *ty = types[i];
if (ty->owndata) {
@@ -1426,9 +1445,18 @@ SWIG_Python_SetModule(swig_module_info *
PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
swig_empty_runtime_method_table);
#endif
+#ifdef USE_CAPSULES
+ PyObject *pointer = PyCapsule_New((void *)swig_module, TYPE_POINTER_NAME,
+ (PyCapsule_Destructor)SWIG_Python_DestroyModule);
+#else
PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
+#endif
if (pointer && module) {
+#ifdef USE_CAPSULES
+ PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
+#else
PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
+#endif
} else {
Py_XDECREF(pointer);
}
@@ -1449,12 +1477,20 @@ SWIG_Python_TypeQuery(const char *type)
PyObject *obj = PyDict_GetItem(cache, key);
swig_type_info *descriptor;
if (obj) {
+#ifdef USE_CAPSULES
+ descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, type);
+#else
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
+#endif
} else {
swig_module_info *swig_module = SWIG_Python_GetModule();
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) {
+#ifdef USE_CAPSULES
+ obj = PyCapsule_New(descriptor, type, NULL);
+#else
obj = PyCObject_FromVoidPtr(descriptor, NULL);
+#endif
PyDict_SetItem(cache, key, obj);
Py_DECREF(obj);
}

View File

@ -1,67 +0,0 @@
diff -up swig-2.0.3/Lib/python/pycontainer.swg.rh666429 swig-2.0.3/Lib/python/pycontainer.swg
--- swig-2.0.3/Lib/python/pycontainer.swg.rh666429 2010-10-19 08:31:31.000000000 +0200
+++ swig-2.0.3/Lib/python/pycontainer.swg 2011-04-22 15:42:42.185982189 +0200
@@ -630,6 +630,7 @@ namespace swig
return x;
}
+#if !NO_PYSLICE
/* typemap for slice object support */
%typemap(in) PySliceObject* {
$1 = (PySliceObject *) $input;
@@ -637,6 +638,7 @@ namespace swig
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) PySliceObject* {
$1 = PySlice_Check($input);
}
+#endif
Sequence* __getslice__(difference_type i, difference_type j) throw (std::out_of_range) {
return swig::getslice(self, i, j);
@@ -659,7 +661,11 @@ namespace swig
/* Overloaded methods for Python 3 compatibility
* (Also useful in Python 2.x)
*/
+#if NO_PYSLICE
+ Sequence* __getitem__(PyObject *slice) throw (std::out_of_range) {
+#else
Sequence* __getitem__(PySliceObject *slice) throw (std::out_of_range) {
+#endif
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
@@ -668,8 +674,11 @@ namespace swig
PySlice_GetIndices(slice, self->size(), &i, &j, &step);
return swig::getslice(self, i, j);
}
-
+#if NO_PYSLICE
+ void __setitem__(PyObject *slice, const Sequence& v)
+#else
void __setitem__(PySliceObject *slice, const Sequence& v)
+#endif
throw (std::out_of_range, std::invalid_argument) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
@@ -680,7 +689,11 @@ namespace swig
swig::setslice(self, i, j, v);
}
+#if NO_PYSLICE
+ void __delitem__(PyObject *slice)
+#else
void __delitem__(PySliceObject *slice)
+#endif
throw (std::out_of_range) {
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
diff -up swig-2.0.3/Source/Modules/python.cxx.rh666429 swig-2.0.3/Source/Modules/python.cxx
--- swig-2.0.3/Source/Modules/python.cxx.rh666429 2011-03-14 08:22:08.000000000 +0100
+++ swig-2.0.3/Source/Modules/python.cxx 2011-04-22 15:43:45.122661120 +0200
@@ -438,6 +438,7 @@ public:
if (py3) {
/* force disable features that not compatible with Python 3.x */
classic = 0;
+ Preprocessor_define((DOH *) "NO_PYSLICE 1", 0);
}
if (cppcast) {

273
swig204-rh679948.patch Normal file
View File

@ -0,0 +1,273 @@
Index: configure.in
===================================================================
--- configure.in (revision 12773)
+++ configure.in (revision 12774)
@@ -923,19 +923,20 @@
AC_MSG_CHECKING(for Octave header files)
if test -n "$OCTAVE"; then
- OCTAVEDIR="/usr/include"
+ OCTAVECONFIG=[`echo $OCTAVEBIN | sed 's|octave\([^/]*\)$|octave-config\1|'`]
+ if test -r "$OCTAVECONFIG"; then
+ OCTAVEDIR=`$OCTAVECONFIG -p OCTINCLUDEDIR | sed 's|/octave$||'`
+ else
+ OCTAVEDIR="/usr/include"
+ fi
if test "$OCTAVEDIR" != ""; then
- dirs="$OCTAVEDIR"
+ dirs="$OCTAVEDIR/octave $OCTAVEDIR"
OCTAVEEXT=""
for i in $dirs; do
if test -r $i/octave/oct.h; then
OCTAVEEXT="$i"
break;
fi
- if test -r $i/octave/octave/oct.h; then
- OCTAVEEXT="$i/octave"
- break;
- fi
done
if test "$OCTAVEEXT" = "" ; then
AC_MSG_RESULT(not found)
Index: Lib/octave/octrun.swg
===================================================================
--- Lib/octave/octrun.swg (revision 12773)
+++ Lib/octave/octrun.swg (revision 12774)
@@ -399,6 +399,10 @@
Swig::erase_rtdir(types[j].second.ptr);
}
+ dim_vector dims(void) const {
+ return dim_vector(1,1);
+ }
+
octave_value as_value() {
++count;
return Swig::swig_value_ref(this);
@@ -928,6 +932,9 @@
octave_base_value *empty_clone() const
{ return new octave_swig_ref(0); }
+ dim_vector dims(void) const
+ { return ptr->dims(); }
+
bool is_defined() const
{ return ptr->is_defined(); }
Index: Examples/octave/functor/Makefile
===================================================================
--- Examples/octave/functor/Makefile (revision 12773)
+++ Examples/octave/functor/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/pointer/Makefile
===================================================================
--- Examples/octave/pointer/Makefile (revision 12773)
+++ Examples/octave/pointer/Makefile (revision 12774)
@@ -17,3 +17,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/funcptr/Makefile
===================================================================
--- Examples/octave/funcptr/Makefile (revision 12773)
+++ Examples/octave/funcptr/Makefile (revision 12774)
@@ -17,3 +17,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/extend/Makefile
===================================================================
--- Examples/octave/extend/Makefile (revision 12773)
+++ Examples/octave/extend/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/simple/Makefile
===================================================================
--- Examples/octave/simple/Makefile (revision 12773)
+++ Examples/octave/simple/Makefile (revision 12774)
@@ -17,3 +17,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/operator/runme.m
===================================================================
--- Examples/octave/operator/runme.m (revision 12773)
+++ Examples/octave/operator/runme.m (revision 12774)
@@ -4,21 +4,21 @@
a = example.ComplexVal(2,3);
b = example.ComplexVal(-5,10);
-printf("a = %s\n",a);
-printf("b = %s\n",b);
+printf("a = %s\n",disp(a));
+printf("b = %s\n",disp(b));
c = a + b;
-printf("c = %s\n",c);
-printf("a*b = %s\n",a*b);
-printf("a-c = %s\n",a-c);
+printf("c = %s\n",disp(c));
+printf("a*b = %s\n",disp(a*b));
+printf("a-c = %s\n",disp(a-c));
e = example.ComplexVal(a-c);
-printf("e = %s\n",e);
+printf("e = %s\n",disp(e));
# Big expression
f = ((a+b)*(c+b*e)) + (-a);
-printf("f = %s\n",f);
+printf("f = %s\n",disp(f));
# paren overloading
-printf("a(3)= %s\n",a(3));
+printf("a(3)= %s\n",disp(a(3)));
Index: Examples/octave/operator/example.i
===================================================================
--- Examples/octave/operator/example.i (revision 12773)
+++ Examples/octave/operator/example.i (revision 12774)
@@ -10,13 +10,13 @@
/* An output method that turns a complex into a short string */
%extend ComplexVal {
- char *__str() {
+ char *__str__() {
static char temp[512];
sprintf(temp,"(%g,%g)", $self->re(), $self->im());
return temp;
}
- ComplexVal __paren(int j) {
+ ComplexVal __paren__(int j) {
return ComplexVal($self->re()*j,$self->im()*j);
}
};
Index: Examples/octave/operator/Makefile
===================================================================
--- Examples/octave/operator/Makefile (revision 12773)
+++ Examples/octave/operator/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).m
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/callback/Makefile
===================================================================
--- Examples/octave/callback/Makefile (revision 12773)
+++ Examples/octave/callback/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/reference/Makefile
===================================================================
--- Examples/octave/reference/Makefile (revision 12773)
+++ Examples/octave/reference/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/funcptr2/Makefile
===================================================================
--- Examples/octave/funcptr2/Makefile (revision 12773)
+++ Examples/octave/funcptr2/Makefile (revision 12774)
@@ -17,3 +17,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/enum/Makefile
===================================================================
--- Examples/octave/enum/Makefile (revision 12773)
+++ Examples/octave/enum/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/class/Makefile
===================================================================
--- Examples/octave/class/Makefile (revision 12773)
+++ Examples/octave/class/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/variables/Makefile
===================================================================
--- Examples/octave/variables/Makefile (revision 12773)
+++ Examples/octave/variables/Makefile (revision 12774)
@@ -17,3 +17,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/template/Makefile
===================================================================
--- Examples/octave/template/Makefile (revision 12773)
+++ Examples/octave/template/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/constants/Makefile
===================================================================
--- Examples/octave/constants/Makefile (revision 12773)
+++ Examples/octave/constants/Makefile (revision 12774)
@@ -19,3 +19,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/octave/contract/Makefile
===================================================================
--- Examples/octave/contract/Makefile (revision 12773)
+++ Examples/octave/contract/Makefile (revision 12774)
@@ -17,3 +17,4 @@
rm -f $(TARGET).py
check: all
+ $(MAKE) -f $(TOP)/Makefile octave_run
Index: Examples/Makefile.in
===================================================================
--- Examples/Makefile.in (revision 12773)
+++ Examples/Makefile.in (revision 12774)
@@ -333,6 +333,7 @@
# Make sure these locate your Octave installation
OCTAVE_INCLUDE= $(DEFS) @OCTAVEEXT@
OCTAVE_LIB =
+OCTAVE = @OCTAVE@
# Extra Octave specific dynamic linking options
OCTAVE_DLNK = @OCTAVEDYNAMICLINKING@
@@ -359,6 +360,15 @@
$(CXXSHARED) -g $(CFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO)
# -----------------------------------------------------------------
+# Running an Octave example
+# -----------------------------------------------------------------
+
+OCTSCRIPT = runme.m
+
+octave_run: $(OCTSCRIPT)
+ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVEPATH=$(srcdir):$$OCTAVEPATH $(OCTAVE) $(OCTSCRIPT) >/dev/null
+
+# -----------------------------------------------------------------
# Cleaning the octave examples
# -----------------------------------------------------------------

27
swig204-rh753321.patch Normal file
View File

@ -0,0 +1,27 @@
Index: Source/Swig/stype.c
===================================================================
--- Source/Swig/stype.c (revision 12813)
+++ Source/Swig/stype.c (revision 12814)
@@ -823,7 +823,8 @@
Insert(result, 0, "(");
Append(result, ")");
}
- isreference = 1;
+ if (!isfunction)
+ isreference = 1;
} else if (SwigType_isarray(element)) {
DOH *size;
if (firstarray && !isreference) {
@@ -869,10 +870,8 @@
cast = NewStringf("(%s)", result);
}
if (name) {
- if (!isfunction) {
- if (isreference) {
- Append(cast, "*");
- }
+ if (isreference) {
+ Append(cast, "*");
}
Append(cast, name);
}