diff options
author | Michael Schroeder <mls@suse.de> | 2012-10-08 16:35:13 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-10-08 16:35:13 +0200 |
commit | a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8 (patch) | |
tree | d91e6e906c3927e479ac19fbed8f4c5e1ad41b5d /examples | |
parent | ee4fa1bef4127b860cf1c8d142da7e70e08f2a1f (diff) | |
download | libsolv-a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8.tar.gz libsolv-a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8.tar.bz2 libsolv-a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8.zip |
only call add_products if the method exists
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/p5solv | 4 | ||||
-rwxr-xr-x | examples/pysolv | 3 | ||||
-rwxr-xr-x | examples/rbsolv | 4 |
3 files changed, 8 insertions, 3 deletions
diff --git a/examples/p5solv b/examples/p5solv index 015002e..58cdc9a 100755 --- a/examples/p5solv +++ b/examples/p5solv @@ -476,7 +476,9 @@ sub load { return 1; } print "reading\n"; - $self->{'handle'}->add_products("/etc/products.d", $solv::Repo::REPO_NO_INTERNALIZE); + if (defined(&solv::Repo::add_products)) { + $self->{'handle'}->add_products("/etc/products.d", $solv::Repo::REPO_NO_INTERNALIZE); + } $self->{'handle'}->add_rpmdb(undef, $solv::Repo::REPO_REUSE_REPODATA); $self->writecachedrepo(); return 1; diff --git a/examples/pysolv b/examples/pysolv index fa723a0..af86961 100755 --- a/examples/pysolv +++ b/examples/pysolv @@ -550,7 +550,8 @@ class repo_system(repo_generic): print "cached" return True print "reading" - self.handle.add_products("/etc/products.d", Repo.REPO_NO_INTERNALIZE) + if hasattr(self.handle.__class__, 'add_products'): + self.handle.add_products("/etc/products.d", Repo.REPO_NO_INTERNALIZE) self.handle.add_rpmdb(None, Repo.REPO_REUSE_REPODATA) self.writecachedrepo(None) return True diff --git a/examples/rbsolv b/examples/rbsolv index 90be909..4ff477f 100755 --- a/examples/rbsolv +++ b/examples/rbsolv @@ -484,7 +484,9 @@ class Repo_system < Repo_generic return true end puts "reading" - @handle.add_products("/etc/products.d", Solv::Repo::REPO_NO_INTERNALIZE) + if @handle.respond_to? :add_products + @handle.add_products("/etc/products.d", Solv::Repo::REPO_NO_INTERNALIZE) + end @handle.add_rpmdb(nil, Solv::Repo::REPO_REUSE_REPODATA) writecachedrepo(nil) return true |