diff options
Diffstat (limited to 'doc/examples')
| -rw-r--r-- | doc/examples/acquire.py | 3 | ||||
| -rw-r--r-- | doc/examples/action.py | 1 | ||||
| -rwxr-xr-x | doc/examples/build-deps.py | 2 | ||||
| -rw-r--r-- | doc/examples/cdrom.py | 6 | ||||
| -rwxr-xr-x | doc/examples/configisc.py | 1 | ||||
| -rw-r--r-- | doc/examples/depcache.py | 3 | ||||
| -rw-r--r-- | doc/examples/desc.py | 1 | ||||
| -rwxr-xr-x | doc/examples/gui-inst.py | 4 | ||||
| -rw-r--r-- | doc/examples/indexfile.py | 1 | ||||
| -rw-r--r-- | doc/examples/inst.py | 3 | ||||
| -rw-r--r-- | doc/examples/metaindex.py | 1 | ||||
| -rw-r--r-- | doc/examples/progress.py | 8 | ||||
| -rwxr-xr-x | doc/examples/records.py | 6 | ||||
| -rwxr-xr-x | doc/examples/update.py | 1 |
14 files changed, 18 insertions, 23 deletions
diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 58372961..41a38588 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -1,8 +1,7 @@ +#!/usr/bin/python import apt import apt_pkg import os -import sys -import tempfile def get_file(fetcher, uri, destFile): diff --git a/doc/examples/action.py b/doc/examples/action.py index 9b9d7dd3..8ee86eb7 100644 --- a/doc/examples/action.py +++ b/doc/examples/action.py @@ -3,7 +3,6 @@ import apt_pkg import sys -import copy from apt.progress import OpTextProgress from progress import TextFetchProgress diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py index aeb5667c..b5ac88a2 100755 --- a/doc/examples/build-deps.py +++ b/doc/examples/build-deps.py @@ -32,7 +32,7 @@ if len(sys.argv) < 2: print "need a package name as argument" sys.exit(1) try: - base = cache[sys.argv[1]] + pkg = base = cache[sys.argv[1]] except KeyError: print "No package %s found" % sys.argv[1] sys.exit(1) diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py index 743220a6..408bd720 100644 --- a/doc/examples/cdrom.py +++ b/doc/examples/cdrom.py @@ -3,10 +3,8 @@ import apt_pkg import sys -import os -import copy -from progress import CdromProgress +from progress import TextCdromProgress # init @@ -15,7 +13,7 @@ apt_pkg.init() cdrom = apt_pkg.GetCdrom() print cdrom -progress = CdromProgress() +progress = TextCdromProgress() (res, ident) = cdrom.Ident(progress) print "ident result is: %s (%s) " % (res, ident) diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index de8ec6be..8da1ad0a 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -10,7 +10,6 @@ import apt_pkg import sys -import posixpath ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py index 790cc9d6..de038fe8 100644 --- a/doc/examples/depcache.py +++ b/doc/examples/depcache.py @@ -1,10 +1,7 @@ #!/usr/bin/python # example how to deal with the depcache -import apt import apt_pkg -import sys -import copy from progress import TextProgress diff --git a/doc/examples/desc.py b/doc/examples/desc.py index f47517cf..2febf348 100644 --- a/doc/examples/desc.py +++ b/doc/examples/desc.py @@ -1,3 +1,4 @@ +#!/usr/bin/python import apt_pkg diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py index 8138d922..68f06fc0 100755 --- a/doc/examples/gui-inst.py +++ b/doc/examples/gui-inst.py @@ -5,13 +5,13 @@ import pygtk pygtk.require('2.0') import gtk -import apt.gtk.widgets +import apt.progress.gtk2 if __name__ == "__main__": win = gtk.Window() - progress = apt.gtk.widgets.GtkAptProgress() + progress = apt.progress.gtk2.GtkAptProgress() win.set_title("GtkAptProgress Demo") win.add(progress) progress.show() diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py index 22d0b635..2f1f27f8 100644 --- a/doc/examples/indexfile.py +++ b/doc/examples/indexfile.py @@ -1,3 +1,4 @@ +#!/usr/bin/python import apt_pkg diff --git a/doc/examples/inst.py b/doc/examples/inst.py index a3a50356..5a7fc993 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -3,9 +3,6 @@ import apt import sys -import os -import copy -import time from apt.progress import InstallProgress diff --git a/doc/examples/metaindex.py b/doc/examples/metaindex.py index f00a7e01..816a3fd7 100644 --- a/doc/examples/metaindex.py +++ b/doc/examples/metaindex.py @@ -1,3 +1,4 @@ +#!/usr/bin/python import apt_pkg diff --git a/doc/examples/progress.py b/doc/examples/progress.py index 83847598..2231001f 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -1,3 +1,5 @@ +#!/usr/bin/python + import sys import time @@ -38,7 +40,7 @@ class TextFetchProgress(apt.FetchProgress): def pulse(self): print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( - apt.SizeToStr(self.currentCPS), SizeToStr(self.currentBytes), + apt.SizeToStr(self.currentCPS), apt.SizeToStr(self.currentBytes), apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) return True @@ -79,12 +81,12 @@ class TextCdromProgress(apt.CdromProgress): def update(self, text, step): # check if we actually have some text to display if text != "": - print "Update: %s %s" % (string.strip(text), step) + print "Update: %s %s" % (text.strip(), step) def askCdromName(self): print "Please enter cd-name: ", cd_name = sys.stdin.readline() - return (True, string.strip(cd_name)) + return (True, cd_name.strip()) def changeCdrom(self): print "Please insert cdrom and press <ENTER>" diff --git a/doc/examples/records.py b/doc/examples/records.py index a0fc8dc4..681eac0c 100755 --- a/doc/examples/records.py +++ b/doc/examples/records.py @@ -5,9 +5,9 @@ import apt cache = apt.Cache() for pkg in cache: - if not pkg.candidateRecord: + if not pkg.candidate.record: continue - if "Task" in pkg.candidateRecord: + if "Task" in pkg.candidate.record: print "Pkg %s is part of '%s'" % ( - pkg.name, pkg.candidateRecord["Task"].split()) + pkg.name, pkg.candidate.record["Task"].split()) #print pkg.candidateRecord diff --git a/doc/examples/update.py b/doc/examples/update.py index 364fa1c9..5929c9f8 100755 --- a/doc/examples/update.py +++ b/doc/examples/update.py @@ -1,3 +1,4 @@ +#!/usr/bin/python import apt import apt_pkg import os.path |
