diff options
author | Arvin Schnell <aschnell@suse.de> | 2007-09-25 12:40:49 +0000 |
---|---|---|
committer | Arvin Schnell <aschnell@suse.de> | 2007-09-25 12:40:49 +0000 |
commit | 7ca448153a21e34bce24af964c84d59c7efd4dc9 (patch) | |
tree | b478902788a51f482b8fdb07f1835e1a5cb4962d /examples | |
parent | f1e2b7af355521a967604c152342cc6e68520cfc (diff) | |
download | libzypp-bindings-7ca448153a21e34bce24af964c84d59c7efd4dc9.tar.gz libzypp-bindings-7ca448153a21e34bce24af964c84d59c7efd4dc9.tar.bz2 libzypp-bindings-7ca448153a21e34bce24af964c84d59c7efd4dc9.zip |
- sometimes include original C header file
- global rename for asString
- added examples
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/python/bytecount.py | 10 | ||||
-rwxr-xr-x | examples/python/url.py | 21 | ||||
-rwxr-xr-x | examples/ruby/bytecount.rb | 11 | ||||
-rwxr-xr-x | examples/ruby/url.rb | 22 |
4 files changed, 64 insertions, 0 deletions
diff --git a/examples/python/bytecount.py b/examples/python/bytecount.py new file mode 100755 index 0000000..912fa05 --- /dev/null +++ b/examples/python/bytecount.py @@ -0,0 +1,10 @@ +#!/usr/bin/python + +from zypp import ByteCount + +print ByteCount(ByteCount.G) +print ByteCount(ByteCount.GB) + +x = ByteCount(ByteCount.K) +print int(x) + diff --git a/examples/python/url.py b/examples/python/url.py new file mode 100755 index 0000000..07c772c --- /dev/null +++ b/examples/python/url.py @@ -0,0 +1,21 @@ +#!/usr/bin/python + +from zypp import Url + +a = Url("http://www.suse.de/download") +print "a = %s" % a +print " %s %s %s" % (a.getScheme(), a.getHost(), a.getPathData()) + +b = Url(a) +b.setHost("download.novell.com") +print "b = %s" % b + +c = a # oops +c.setPathData("/repository") +print "c = %s" % c + +print +print "a = %s" % a # oops +print "b = %s" % b +print "c = %s" % c + diff --git a/examples/ruby/bytecount.rb b/examples/ruby/bytecount.rb new file mode 100755 index 0000000..56393a8 --- /dev/null +++ b/examples/ruby/bytecount.rb @@ -0,0 +1,11 @@ +#!/usr/bin/ruby + +require 'zypp' +include Zypp + +puts ByteCount.new(ByteCount.G) +puts ByteCount.new(ByteCount.GB) + +x = ByteCount.new(ByteCount.K) +puts x.to_i + diff --git a/examples/ruby/url.rb b/examples/ruby/url.rb new file mode 100755 index 0000000..81f3848 --- /dev/null +++ b/examples/ruby/url.rb @@ -0,0 +1,22 @@ +#!/usr/bin/ruby + +require 'zypp' +include Zypp + +a = Url.new("http://www.suse.de/download") +puts "a = #{a}" +puts " #{a.get_scheme} #{a.get_host} #{a.get_path_data}" + +b = Url.new(a) +b.set_host("download.novell.com") +puts "b = #{b}" + +c = a # oops +c.set_path_data("/repository") +puts "c = #{c}" + +puts +puts "a = #{a}" # oops +puts "b = #{b}" +puts "c = #{c}" + |