summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Andres <ma@suse.de>2008-09-05 16:43:40 +0000
committerMichael Andres <ma@suse.de>2008-09-05 16:43:40 +0000
commitc6fcfe47d295c4c8dabc469836fd6f4e87bbe529 (patch)
tree2c691fe1594ab99030eb49ad705dd8143549d7b5
parent743e0c0f0eb1aa853b24322e46c78bc7b981c14d (diff)
downloadlibzypp-bindings-c6fcfe47d295c4c8dabc469836fd6f4e87bbe529.tar.gz
libzypp-bindings-c6fcfe47d295c4c8dabc469836fd6f4e87bbe529.tar.bz2
libzypp-bindings-c6fcfe47d295c4c8dabc469836fd6f4e87bbe529.zip
Fix basic resolvabe attributes as needed by list_resolvables.py example.
-rwxr-xr-xexamples/python/list_resolvables.py14
-rw-r--r--libzypp-bindings.spec.cmake2
-rw-r--r--package/libzypp-bindings.changes7
-rw-r--r--swig/Arch.i1
-rw-r--r--swig/ResObject.i3
-rw-r--r--swig/ResTraits.i25
-rw-r--r--swig/zypp.i20
7 files changed, 41 insertions, 31 deletions
diff --git a/examples/python/list_resolvables.py b/examples/python/list_resolvables.py
index 69c3b7e..7654737 100755
--- a/examples/python/list_resolvables.py
+++ b/examples/python/list_resolvables.py
@@ -2,7 +2,6 @@
import zypp
Z = zypp.ZYppFactory_instance().getZYpp()
-
Z.initializeTarget( zypp.Pathname("/") )
Z.target().load();
@@ -16,7 +15,6 @@ for repo in repos:
repoManager.buildCache( repo )
repoManager.loadFromCache( repo );
-
print "Items: %d" % ( Z.pool().size() )
for item in Z.pool():
@@ -24,9 +22,9 @@ for item in Z.pool():
t = "i"
else:
t = "*"
- print "%s %s" % ( t , item.resolvable())
- #print "%s %s:%s-%s.%s\t(%s)" % ( t,
- # item.resolvable().kind(),
- ## item.resolvable().edition(),
- # item.resolvable().arch(),
- # item.resolvable().repository().info().alias() )
+ print "%s %s:%s-%s.%s\t(%s)" % ( t,
+ item.kind(),
+ item.name(),
+ item.edition(),
+ item.arch(),
+ item.repoInfo().alias() )
diff --git a/libzypp-bindings.spec.cmake b/libzypp-bindings.spec.cmake
index 6531e71..74149c2 100644
--- a/libzypp-bindings.spec.cmake
+++ b/libzypp-bindings.spec.cmake
@@ -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 >= 5.2.1
+BuildRequires: libzypp-devel >= 5.8.0
Source: %{name}-%{version}.tar.bz2
%description
diff --git a/package/libzypp-bindings.changes b/package/libzypp-bindings.changes
index f15d01d..275f4db 100644
--- a/package/libzypp-bindings.changes
+++ b/package/libzypp-bindings.changes
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Sep 5 18:41:31 CEST 2008 - ma@suse.de
+
+- Fix basic resolvabe attributes as needed by list_resolvables.py
+ example.
+- revision 10952
+
+-------------------------------------------------------------------
Thu Sep 4 11:42:50 CEST 2008 - ma@suse.de
- Added lost RepoInfo and ServiceInfo.
diff --git a/swig/Arch.i b/swig/Arch.i
index 320c7f8..417ecdf 100644
--- a/swig/Arch.i
+++ b/swig/Arch.i
@@ -1,5 +1,6 @@
// Ignore static versions shadowed by member functions
%ignore zypp::Arch::compare(const Arch &, const Arch &);
+%ignore zypp::Arch::asString( const CompatSet & cset );
template<class A, class B> class std::unary_function {};
%template(ArchCompatFun) std::unary_function<zypp::Arch, bool>;
diff --git a/swig/ResObject.i b/swig/ResObject.i
index e179e9a..d25b6ef 100644
--- a/swig/ResObject.i
+++ b/swig/ResObject.i
@@ -8,7 +8,6 @@
{
int __cmp__(intrusive_ptr<const ResObject>& other)
{
- return compareByNVRA(*self, other);
+ return *self == other;
}
}
-
diff --git a/swig/ResTraits.i b/swig/ResTraits.i
index fcd6519..0b24cac 100644
--- a/swig/ResTraits.i
+++ b/swig/ResTraits.i
@@ -5,18 +5,25 @@
typedef KindOf<Resolvable> KindType;
};*/
-/** ResTraits. Defines common types and the Kind value. */
-template<typename _Res>
+namespace zypp
+{
+ /** ResTraits. Defines common types and the Kind value. */
+ template<typename _Res>
struct ResTraits
{
- typedef intrusive_ptr<_Res> PtrType;
- typedef intrusive_ptr<const _Res> constPtrType;
+ typedef zypp::intrusive_ptr<_Res> PtrType;
+ typedef zypp::intrusive_ptr<const _Res> constPtrType;
};
-%template(ResTraitsResolvable) ResTraits<Resolvable>;
+ typedef intrusive_ptr<const ResObject> ResObject_constPtr;
+ typedef intrusive_ptr<ResObject> ResObject_Ptr;
+ %template(ResObject_constPtr) intrusive_ptr<const zypp::ResObject>;
+ %template(ResObject_Ptr) intrusive_ptr<zypp::ResObject>;
+
+}
-%template(ResObject_constPtr) intrusive_ptr<const ResObject>;
-%template(ResObject_Ptr) intrusive_ptr<ResObject>;
+%template(ResTraitsResolvable) zypp::ResTraits<zypp::Resolvable>;
+%template(ResTraitsResObject) zypp::ResTraits<zypp::ResObject>;
// Common definitions for all Resolvable types
// - *_Ptr and *_constPtr
@@ -28,8 +35,8 @@ template<typename _Res>
typedef intrusive_ptr<const X> X##_constPtr;
typedef intrusive_ptr<X> X##_Ptr;
-%template(X##_constPtr) intrusive_ptr<const X>;
-%template(X##_Ptr) intrusive_ptr<X>;
+%template(X##_constPtr) zypp::intrusive_ptr<const X>;
+%template(X##_Ptr) zypp::intrusive_ptr<X>;
bool isKind##X( const Resolvable::constPtr & p );
bool isKind##X( const PoolItem & p );
diff --git a/swig/zypp.i b/swig/zypp.i
index 06fe86d..4dbd47a 100644
--- a/swig/zypp.i
+++ b/swig/zypp.i
@@ -54,8 +54,6 @@ typedef std::list<std::string> StringList;
%}
%nodefault ByKind;
-%define DEFINE_PTR_TYPE(name)
-%enddef
%rename("+") "operator+";
%rename("<<") "operator<<";
@@ -63,12 +61,6 @@ typedef std::list<std::string> StringList;
%rename("!") "operator!";
%rename("==") "operator==";
-template < typename T >
-class intrusive_ptr {
- public:
- T *operator->();
-};
-
namespace zypp {
namespace base {
// silence 'Nothing known about class..' warning
@@ -97,6 +89,12 @@ namespace zypp {
%include "perl5/perl.i"
#endif
+%import <boost/scoped_ptr.hpp>
+%import <boost/shared_ptr.hpp>
+%import <boost/weak_ptr.hpp>
+%import <boost/intrusive_ptr.hpp>
+%import <zypp/base/PtrTypes.h>
+
%include "IdStringType.i"
%include "Pathname.i"
%include "ByteCount.i"
@@ -111,6 +109,9 @@ namespace zypp {
%include "Capability.i"
%include "Capabilities.i"
%include "CapMatch.i"
+%include "RepoType.i"
+%include "RepoInfo.i"
+%include "ServiceInfo.i"
%include "ResTraits.i"
%include "ResStatus.i"
%include "Resolvable.i"
@@ -120,9 +121,6 @@ namespace zypp {
%include "Pattern.i"
%include "Product.i"
%include "SrcPackage.i"
-%include "RepoType.i"
-%include "RepoInfo.i"
-%include "ServiceInfo.i"
%include "Repository.i"
%include "RepoStatus.i"
%include "RepoManager.i"