- Removed almost all local copies of zypp header files. This also
authorMichael Andres <ma@suse.de>
Fri, 25 Jul 2008 18:07:37 +0000 (18:07 +0000)
committerMichael Andres <ma@suse.de>
Fri, 25 Jul 2008 18:07:37 +0000 (18:07 +0000)
  removed some old classes no longer present in libzypp.
- Re-enabled building of python and perl bindings. (bnc #391831)

libzypp-bindings.spec.cmake
package/libzypp-bindings.changes
swig/Capabilities.i
swig/Edition.i
swig/IdStringType.i
swig/KeyRing.i
swig/perl5/perl.i
swig/ruby/ruby.i

index c6bd1a8..3254175 100644 (file)
@@ -18,7 +18,7 @@ Summary:        Bindings for libzypp
 Group:          Development/Sources
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  cmake gcc-c++ python-devel ruby-devel swig
-BuildRequires:  libzypp-devel >= 3.0.0
+BuildRequires:  libzypp-devel >= 5.2.1
 Source:         %{name}-%{version}.tar.bz2
 
 %description
index 37e27ca..ad38a14 100644 (file)
@@ -1,7 +1,16 @@
 -------------------------------------------------------------------
+Fri Jul 25 19:29:11 CEST 2008 - ma@suse.de
+
+- Removed almost all local copies of zypp header files. This also
+  removed some old classes no longer present in libzypp.
+- Re-enabled building of python and perl bindings. (bnc #391831)
+- revision 10666
+- version 0.4.6
+
+-------------------------------------------------------------------
 Mon Jul 14 15:07:46 CEST 2008 - ma@suse.de
 
-- Remove obsolete references to Script/Message/Atom. 
+- Remove obsolete references to Script/Message/Atom.
 - Remove obsolete references to Dependencies.
 
 -------------------------------------------------------------------
@@ -32,7 +41,7 @@ Wed Mar 19 16:31:12 CET 2008 - coolo@suse.de
 -------------------------------------------------------------------
 Mon Mar  3 13:46:25 CET 2008 - schubi@suse.de
 
-- sat/repo moved to repository 
+- sat/repo moved to repository
 - Revision 8981
 - version 0.4.5
 
index 83dd370..7f3104a 100644 (file)
@@ -1,16 +1,8 @@
 
-#if 1
 %include <zypp/Capabilities.h>
-#else
-// I dont think this is correct: ctor and dtor are not taken into account
-class Capabilities
-{
-
-};
-
 
 #ifdef SWIGRUBY
-iter3(Capabilities, Capability*);
+by_value_iterator(zypp::Capabilities);
 #endif
 
 
@@ -22,19 +14,18 @@ iter3(Capabilities, Capability*);
 // #endif
 
 #ifdef SWIGPYTHON
-%extend Capabilities
+%extend zypp::Capabilities
 {
-    // just a test
-    const Capability* haha()
-    {
-       Capabilities::iterator i = self->begin();
-       const Capability* tmp = &*i;
-       return tmp;
-    }
+  // just a test
+  const Capability* haha()
+  {
+    Capabilities::const_iterator i = self->begin();
+    const Capability* tmp = &*i;
+    return tmp;
+  }
 }
 #endif
 
 #ifdef SWIGPERL5
-iter2(Capabilities, Capability);
+forwarditer(zypp::Capabilities, zypp::Capability);
 #endif
-#endif
\ No newline at end of file
index 7c2b7ec..db08090 100644 (file)
@@ -1,4 +1,5 @@
 // Ignore member functions shadowed by static versions
+// ma@: maybe one should ignore the statics and keep the members?
 %ignore zypp::Edition::match(Edition const &) const;
 %ignore zypp::Edition::match(IdString const &) const;
 %ignore zypp::Edition::match(std::string const &) const;
@@ -11,7 +12,7 @@
 //   %rename Edition::match(const Edition& lhs, const Edition& rhs) match2;
 //}
 
-%ignore zypp::Edition::compare(const Edition &, const Edition &);
+//%ignore zypp::Edition::compare(const Edition &, const Edition &);
 
 %template(IdStringEdition) zypp::IdStringType<zypp::Edition>;
 %include <zypp/Edition.h>
index d5115eb..ef67a56 100644 (file)
@@ -1,2 +1,2 @@
-
+%include <zypp/IdString.h>
 %include <zypp/IdStringType.h>
index 9ae978f..cad684c 100644 (file)
@@ -3,9 +3,10 @@
 %ignore zypp::KeyRingSignals;
 
 %include <zypp/KeyRing.h>
-nakespcae zypp
+
+namespace zypp
 {
-typedef intrusive_ptr<KeyRing> KeyRing_Ptr;
-%template(KeyRing_Ptr) intrusive_ptr<KeyRing>;
+  typedef intrusive_ptr<KeyRing> KeyRing_Ptr;
+  %template(KeyRing_Ptr) intrusive_ptr<KeyRing>;
 }
 %template(List_PublicKey) std::list<zypp::PublicKey>;
index d9d9d9d..8c60f30 100644 (file)
@@ -46,11 +46,33 @@ namespace zypp
 %define iter2(cls, storetype)
 %extend cls {
    cls::const_iterator iterator_incr(cls::const_iterator *it){
-      (*it)++;
+      ++(*it);
       return *it;
    }
    cls::const_iterator iterator_decr(cls::const_iterator *it){
-      (*it)--;
+      --(*it);
+      return *it;
+   }
+   bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
+      return (it1 == it2);
+   }
+   storetype iterator_value(cls::const_iterator it) {
+      return (*it);
+   }
+   cls::const_iterator cBegin() {
+      return self->begin();
+   }
+   cls::const_iterator cEnd() {
+      return self->end();
+   }
+};
+%enddef
+
+// no operator--
+%define forwarditer(cls, storetype)
+%extend cls {
+   cls::const_iterator iterator_incr(cls::const_iterator *it){
+      ++(*it);
       return *it;
    }
    bool iterator_equal(cls::const_iterator it1, cls::const_iterator it2) {
index cf8576e..3408609 100644 (file)
@@ -19,8 +19,8 @@ namespace zypp
        %ignore operator!=;
        %ignore operator<<;
     }
-}
 
+}
 
 /*
  *  Extend cls with an ruby-like each iterator and a to_a method.  Yields
@@ -80,6 +80,36 @@ namespace zypp
     } \
 }
 
+/*
+ *  This is for an iterator whichs operator* returns by value (i.e. a temporary).
+ *  Like e.g. the Capabilities::const_iterator does. If the compiler warns you are
+ *  taking the address of a temporary when using iter3, you most probaly need this one.
+ *
+ */
+#define by_value_iterator(cls) \
+%mixin cls "Enumerable"; \
+%extend cls \
+{ \
+    void each() { \
+       cls::const_iterator i = self->begin(); \
+        while (i != self->end()) { \
+           const cls::value_type* tmp = new cls::value_type( *i ); \
+           rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(cls::value_type*), 1)); \
+            i++; \
+        } \
+    } \
+\
+    VALUE to_a() { \
+        VALUE ary = rb_ary_new(); \
+       cls::const_iterator i = self->begin(); \
+        while (i != self->end()) { \
+           const cls::value_type* tmp = new cls::value_type( *i ); \
+            rb_ary_push(ary, SWIG_NewPointerObj((void*) tmp, $descriptor(cls::value_type*), 1)); \
+            i++; \
+        } \
+        return ary; \
+    } \
+}
 
 %exception
 {