diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-09-20 16:03:37 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-09-20 16:03:37 +0000 |
| commit | d75fe132ec6f5e07dfe96b99dd5ae2905a224386 (patch) | |
| tree | 07b0909c617ce80a1620649c921263674c1e1b0a /doc/examples | |
| parent | aff4a3d2c1280da136198463a51fff5026194048 (diff) | |
| download | python-apt-d75fe132ec6f5e07dfe96b99dd5ae2905a224386.tar.gz | |
* example for working with apt_inst added
Diffstat (limited to 'doc/examples')
| -rwxr-xr-x | doc/examples/deb_inspect.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/examples/deb_inspect.py b/doc/examples/deb_inspect.py new file mode 100755 index 00000000..4173c196 --- /dev/null +++ b/doc/examples/deb_inspect.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# some example for apt_inst + +import apt_pkg +import apt_inst +import sys + +def Callback(What,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor): + """ callback for debExtract """ + + print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u"\ + % (What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor); + + +if __name__ == "__main__": + if len(sys.argv) < 2: + print "need filename argumnet" + sys.exit(1) + file = sys.argv[1] + + print "Working on: %s" % file + print "Displaying data.tar.gz:" + apt_inst.debExtract(open(file), Callback, "data.tar.gz") + + print "Now extracting the control file:" + control = apt_inst.debExtractControl(open(file)) + sections = apt_pkg.ParseSection(control) + + print "Maintainer is: " + print sections["Maintainer"] + + print + print "DependsOn: " + depends = sections["Depends"] + print apt_pkg.ParseDepends(depends) + + + + |
