r44761 - in /packages/fenics/ufc/trunk/debian: changelog patches/ patches/fix_swig_2.0.5_bug.patch patches/series

johannr-guest at users.alioth.debian.org johannr-guest at users.alioth.debian.org
Fri May 11 10:37:44 UTC 2012


Author: johannr-guest
Date: Fri May 11 10:37:43 2012
New Revision: 44761

URL: http://svn.debian.org/wsvn/debian-science/?sc=1&rev=44761
Log:
Add patch to fix problems with SWIG 2.0.5.

Added:
    packages/fenics/ufc/trunk/debian/patches/
    packages/fenics/ufc/trunk/debian/patches/fix_swig_2.0.5_bug.patch
    packages/fenics/ufc/trunk/debian/patches/series
Modified:
    packages/fenics/ufc/trunk/debian/changelog

Modified: packages/fenics/ufc/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/debian-science/packages/fenics/ufc/trunk/debian/changelog?rev=44761&op=diff
==============================================================================
--- packages/fenics/ufc/trunk/debian/changelog (original)
+++ packages/fenics/ufc/trunk/debian/changelog Fri May 11 10:37:43 2012
@@ -1,8 +1,9 @@
-ufc (2.0.5-2) UNRELEASED; urgency=low
+ufc (2.0.5-2) unstable; urgency=low
 
   * debian/watch: Replace http with https in URL.
+  * Add patch to fix problems with SWIG 2.0.5.
 
- -- Johannes Ring <johannr at simula.no>  Tue, 06 Mar 2012 15:56:28 +0100
+ -- Johannes Ring <johannr at simula.no>  Fri, 11 May 2012 12:24:13 +0200
 
 ufc (2.0.5-1) unstable; urgency=low
 

Added: packages/fenics/ufc/trunk/debian/patches/fix_swig_2.0.5_bug.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/fenics/ufc/trunk/debian/patches/fix_swig_2.0.5_bug.patch?rev=44761&op=file
==============================================================================
--- packages/fenics/ufc/trunk/debian/patches/fix_swig_2.0.5_bug.patch (added)
+++ packages/fenics/ufc/trunk/debian/patches/fix_swig_2.0.5_bug.patch Fri May 11 10:37:43 2012
@@ -1,0 +1,145 @@
+diff -Nru ufc-2.0.5.orig/ChangeLog ufc-2.0.5/ChangeLog
+--- ufc-2.0.5.orig/ChangeLog	2012-05-11 11:59:43.954893713 +0200
++++ ufc-2.0.5/ChangeLog	2012-05-11 12:00:10.690893450 +0200
+@@ -1,3 +1,4 @@
++ - Fix bug introduced by SWIG 2.0.5, which treated uint as Python long
+ 2.0.5 [2011-12-07]
+  - Improve configuration of libboost-math
+ 2.0.4 [2011-11-28]
+diff -Nru ufc-2.0.5.orig/src/ufc/ufc.i ufc-2.0.5/src/ufc/ufc.i
+--- ufc-2.0.5.orig/src/ufc/ufc.i	2012-05-11 11:59:43.962893711 +0200
++++ ufc-2.0.5/src/ufc/ufc.i	2012-05-11 12:00:10.690893450 +0200
+@@ -17,8 +17,6 @@
+ %ignore ufc::cell::entity_indices;
+ %ignore ufc::cell::coordinates;
+ 
+-%include "ufc.h"
+-
+ // Declare which classes should be stored using shared_ptr
+ %shared_ptr(ufc::cell_integral)
+ %shared_ptr(ufc::dofmap)
+@@ -28,11 +26,54 @@
+ %shared_ptr(ufc::exterior_facet_integral)
+ %shared_ptr(ufc::interior_facet_integral)
+ 
++%include <exception.i>
++
++//-----------------------------------------------------------------------------
++// Home brewed versions of the SWIG provided SWIG_AsVal(Type). 
++//-----------------------------------------------------------------------------
++%fragment("Py_convert_uint", "header") {
++  // A check for int and converter to uint
++  SWIGINTERNINLINE bool Py_convert_uint(PyObject* in, unsigned int& value)
++  {
++    if (!(PyInt_Check(in) && PyInt_AS_LONG(in)>=0))
++      return false;
++    value = static_cast<unsigned int>(PyInt_AS_LONG(in));
++    return true;
++  }
++}
++
++//-----------------------------------------------------------------------------
++// Out typemap (unsigned int)
++//-----------------------------------------------------------------------------
++%typemap(out) unsigned int
++{
++  // Typemap unsigned int
++  $result = PyInt_FromLong(static_cast< long >($1));
++}
++
++//-----------------------------------------------------------------------------
++// Typecheck and in typemap (unsigned int)
++//-----------------------------------------------------------------------------
++%typecheck(SWIG_TYPECHECK_INTEGER) unsigned int
++{
++  $1 = PyInt_Check($input) ? 1 : 0;
++}
++
++%typemap(in, fragment="Py_convert_uint") unsigned int
++{
++  if (!Py_convert_uint($input, $1))
++    SWIG_exception(SWIG_TypeError, "expected positive 'int' for argument $argnum");
++}
++
++
++
++//-----------------------------------------------------------------------------
++// Include the main header file
++//-----------------------------------------------------------------------------
+ %include "ufc.h"
+ 
+ // Include code to generate a __swigversion__ attribute to the cpp module
+ // Add prefix to avoid naming problems with other modules
+-
+ %inline %{
+ int ufc_swigversion() { return SWIGVERSION; }
+ %}
+diff -Nru ufc-2.0.5.orig/src/utils/python/ufc_utils/build.py ufc-2.0.5/src/utils/python/ufc_utils/build.py
+--- ufc-2.0.5.orig/src/utils/python/ufc_utils/build.py	2012-05-11 11:59:43.962893711 +0200
++++ ufc-2.0.5/src/utils/python/ufc_utils/build.py	2012-05-11 12:00:55.458893013 +0200
+@@ -1,5 +1,5 @@
+ __author__ = "Johan Hake (hake at simula.no)"
+-__date__ = "2009-03-06 -- 2011-12-06"
++__date__ = "2009-03-06 -- 2012-05-09"
+ __copyright__ = "Copyright (C) 2009 Johan Hake"
+ __license__  = "GNU LGPL Version 2.1"
+ 
+@@ -163,22 +163,23 @@
+ 
+     # Swig declarations
+     declarations =r"""
+-%pythoncode %{
+-import ufc
+-'''
+-A hack to get passed a bug in swig.
+-This is fixed in swig version 1.3.37
+-%}
+-%import "swig/ufc.i"
+-%pythoncode %{
+-'''
+-%}
+-
+ //Uncomment these to produce code for std::tr1::shared_ptr
+ //#define SWIG_SHARED_PTR_NAMESPACE std
+ //#define SWIG_SHARED_PTR_SUBNAMESPACE tr1
+ %include <boost_shared_ptr.i>
+ 
++// Declare which classes should be stored using shared_ptr
++%shared_ptr(ufc::cell_integral)
++%shared_ptr(ufc::dofmap)
++%shared_ptr(ufc::finite_element)
++%shared_ptr(ufc::function)
++%shared_ptr(ufc::form)
++%shared_ptr(ufc::exterior_facet_integral)
++%shared_ptr(ufc::interior_facet_integral)
++
++// Import types from ufc
++%import(module="ufc") "ufc.h"
++
+ // Swig shared_ptr macro declarations
+ """
+ 
+@@ -191,23 +192,9 @@
+         ufc_classes       = re.findall(r"public[ ]+(ufc::[\w]+).*", code)
+         ufc_proxy_classes = [s.replace("ufc::", "") for s in ufc_classes]
+ 
+-        shared_ptr_format = "SWIG_SHARED_PTR_DERIVED(%(der_class)s,%(ufc_class)s,%(der_class)s)"
+         new_share_ptr_format = "%%shared_ptr(%s)"
+ 
+         # Write shared_ptr code for swig 2.0.0 or higher
+-        declarations += "\n"
+-        declarations += "#if SWIG_VERSION >= 0x020000\n"
+         declarations += "\n".join(new_share_ptr_format%c for c in derived_classes)
+-
+-        declarations += "\n"
+-        declarations += "#else\n"
+-        declarations += "\n"
+-        declarations += "\n".join(\
+-            shared_ptr_format % { "ufc_proxy_class": c[0], "ufc_class": c[1], "der_class": c[2] }\
+-            for c in zip(ufc_proxy_classes, ufc_classes, derived_classes)\
+-            )
+-        declarations += "\n"
+-        declarations += "\n"
+-        declarations += "#endif\n"
+         declarations += "\n"
+     return declarations

Added: packages/fenics/ufc/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/debian-science/packages/fenics/ufc/trunk/debian/patches/series?rev=44761&op=file
==============================================================================
--- packages/fenics/ufc/trunk/debian/patches/series (added)
+++ packages/fenics/ufc/trunk/debian/patches/series Fri May 11 10:37:43 2012
@@ -1,0 +1,1 @@
+fix_swig_2.0.5_bug.patch




More information about the debian-science-commits mailing list