summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-03-19 13:39:56 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2009-03-19 13:39:56 +0100
commit3e891e0fab308b7ccb4d315ac0b187676d374675 (patch)
treea26d3e4a1c401e74ec0da1cf162cf3aaaf7e8150 /doc/examples
parent85839f4f241c99f9e4ebb0a6a8847a2d433f1160 (diff)
parente3133a7e09eae842be16eb64d7888c5751d72e75 (diff)
downloadpython-apt-3e891e0fab308b7ccb4d315ac0b187676d374675.tar.gz
* apt/gtk/widgets.py:
- Handle older versions of python-gobject which do not ship glib * apt/package.py: Introduce the Version class - Deprecate Package.candidate*() and Package.installed*(), except for installedFiles. - Provide Version.get_source() (LP: #118788) - Provide Package.versions (Closes: #513236) * apt/progress/: New package, replaces apt.progress and apt.gtk - apt/progress/gtk2.py: Moved here from apt/gtk/widgets.py - apt/progress/__init__.py: Move here from apt/progress.py * doc/source/*: Improve the documentation - Document more attributes and functions of apt_pkg (they are all listed) * aptsources/distro.py: - use iso_3166.xml instead of iso_3166.tab - fix incorrect indent * debian/control: - add Recommends to iso-codes (for iso_3166.xml) * apt/package.py: - make sure to set the defaulttimeout back to the original value (in getChangelog(), LP: #314212) * apt/cache.py: - when setting a alternative rootdir, read the config from it as well * python/configuration.cc, python/apt_pkgmodule.cc: - add apt_pkg.ReadConfigDir() * python/cache.cc, tests/getcache_mem_corruption.py: - test if progress objects have the right methods and raise error if not (thanks to Emanuele Rocca) closes: #497049 * apt/package.py: - avoid uneeded interal references in the Package objects * apt/__init__.py: - remove the future warning
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/acquire.py3
-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/desc.py1
-rwxr-xr-xdoc/examples/gui-inst.py4
-rw-r--r--doc/examples/indexfile.py1
-rw-r--r--doc/examples/inst.py3
-rw-r--r--doc/examples/metaindex.py1
-rw-r--r--doc/examples/progress.py8
-rwxr-xr-xdoc/examples/records.py6
-rwxr-xr-xdoc/examples/update.py1
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