summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-03-08 20:25:59 +0100
committerJulian Andres Klode <jak@debian.org>2009-03-08 20:25:59 +0100
commite3133a7e09eae842be16eb64d7888c5751d72e75 (patch)
tree10f507ad8b7f5a4e11cfbd22618cb4d644377137 /doc
parentd012f1c89a5f773d9b9ae7128e24d708bb4117cb (diff)
downloadpython-apt-e3133a7e09eae842be16eb64d7888c5751d72e75.tar.gz
* doc/examples/*.py: Fix some examples, cleanup
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/acquire.py2
-rw-r--r--doc/examples/action.py1
-rwxr-xr-xdoc/examples/build-deps.py2
-rw-r--r--doc/examples/cdrom.py6
-rwxr-xr-xdoc/examples/configisc.py1
-rw-r--r--doc/examples/depcache.py3
-rw-r--r--doc/examples/inst.py3
-rw-r--r--doc/examples/progress.py6
8 files changed, 6 insertions, 18 deletions
diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py
index a23c41c6..41a38588 100644
--- a/doc/examples/acquire.py
+++ b/doc/examples/acquire.py
@@ -2,8 +2,6 @@
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/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/progress.py b/doc/examples/progress.py
index 304bd117..2231001f 100644
--- a/doc/examples/progress.py
+++ b/doc/examples/progress.py
@@ -40,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
@@ -81,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>"