summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/cache.py12
-rw-r--r--apt/package.py8
-rw-r--r--apt/utils.py38
-rw-r--r--debian/changelog9
4 files changed, 38 insertions, 29 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 2a62ddce..24d63361 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -306,7 +306,7 @@ class Cache(object):
try:
if fetch_progress is None:
- fetch_progress = apt.progress.FetchProgress()
+ fetch_progress = apt.progress.base.AcquireProgress()
try:
res = self._cache.update(fetch_progress, self._list,
pulse_interval)
@@ -358,9 +358,9 @@ class Cache(object):
# which is less than optimal!
if fetch_progress is None:
- fetch_progress = apt.progress.FetchProgress()
+ fetch_progress = apt.progress.base.AcquireProgress()
if install_progress is None:
- install_progress = apt.progress.InstallProgress()
+ install_progress = apt.progress.base.InstallProgress()
pm = apt_pkg.PackageManager(self._depcache)
fetcher = apt_pkg.Acquire(fetch_progress)
@@ -602,7 +602,7 @@ def _test():
"""Internal test code."""
print "Cache self test"
apt_pkg.init()
- cache = Cache(apt.progress.OpTextProgress())
+ cache = Cache(apt.progress.text.OpProgress())
cache.connect("cache_pre_change", cache_pre_changed)
cache.connect("cache_post_change", cache_post_changed)
print ("aptitude" in cache)
@@ -627,7 +627,7 @@ def _test():
os.mkdir(dir)
apt_pkg.config.set("Dir::Cache::Archives", "/tmp/pytest")
pm = apt_pkg.PackageManager(cache._depcache)
- fetcher = apt_pkg.Acquire(apt.progress.TextFetchProgress())
+ fetcher = apt_pkg.Acquire(apt.progress.text.AcquireProgress())
cache._fetch_archives(fetcher, pm)
#sys.exit(1)
@@ -644,7 +644,7 @@ def _test():
print len(filtered)
print "Testing filtered cache (no argument)"
- filtered = FilteredCache(progress=apt.progress.OpTextProgress())
+ filtered = FilteredCache(progress=apt.progress.base.OpProgress())
filtered.cache.connect("cache_pre_change", cache_pre_changed)
filtered.cache.connect("cache_post_change", cache_post_changed)
filtered.cache.upgrade()
diff --git a/apt/package.py b/apt/package.py
index 8171f57d..7f736583 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -596,7 +596,7 @@ class VersionList(Sequence):
except TypeError:
# Dictionary interface item is a string.
for ver in self._versions:
- if ver.VerStr == item:
+ if ver.ver_str == item:
return Version(self._package, ver)
raise KeyError("Version: %r not found." % (item))
@@ -612,7 +612,7 @@ class VersionList(Sequence):
item = item.version
# Dictionary interface.
for ver in self._versions:
- if ver.VerStr == item:
+ if ver.ver_str == item:
return True
return False
@@ -1127,12 +1127,12 @@ class Package(object):
@property
def is_inst_broken(self):
"""Return True if the to-be-installed package is broken."""
- return self._pcache._depcache.IsInstBroken(self._pkg)
+ return self._pcache._depcache.is_inst_broken(self._pkg)
@property
def is_now_broken(self):
"""Return True if the installed package is broken."""
- return self._pcache._depcache.IsNowBroken(self._pkg)
+ return self._pcache._depcache.is_now_broken(self._pkg)
# depcache actions
diff --git a/apt/utils.py b/apt/utils.py
index df1d0397..8949c2ab 100644
--- a/apt/utils.py
+++ b/apt/utils.py
@@ -38,39 +38,39 @@ def get_release_date_from_release_file(path):
"""
if not path or not os.path.exists(path):
return None
- tag = apt_pkg.ParseTagFile(open(path))
- tag.Step()
- if not tag.Section.has_key("Date"):
+ tag = apt_pkg.TagFile(open(path))
+ tag.step()
+ if not "Date" in tag.section:
return None
- date = tag.Section["Date"]
- return apt_pkg.StrToTime(date)
+ date = tag.section["Date"]
+ return apt_pkg.str_to_time(date)
def get_release_filename_for_pkg(cache, pkgname, label, release):
" get the release file that provides this pkg "
- if not cache.has_key(pkgname):
+ if pkgname not in cache:
return None
pkg = cache[pkgname]
ver = None
# look for the version that comes from the repos with
# the given label and origin
- for aver in pkg._pkg.VersionList:
- if aver == None or aver.FileList == None:
+ for aver in pkg._pkg.version_list:
+ if aver == None or aver.file_list == None:
continue
- for verFile, index in aver.FileList:
+ for ver_file, index in aver.file_list:
#print verFile
- if (verFile.Origin == label and
- verFile.Label == label and
- verFile.Archive == release):
+ if (ver_file.origin == label and
+ ver_file.label == label and
+ ver_file.archive == release):
ver = aver
if not ver:
return None
- indexfile = cache._list.FindIndex(ver.FileList[0][0])
- for metaindex in cache._list.List:
- for m in metaindex.IndexFiles:
+ indexfile = cache._list.find_index(ver.file_list[0][0])
+ for metaindex in cache._list.list:
+ for m in metaindex.index_files:
if (indexfile and
- indexfile.Describe == m.Describe and
- indexfile.IsTrusted):
- dir = apt_pkg.Config.FindDir("Dir::State::lists")
- name = apt_pkg.URItoFileName(metaindex.URI)+"dists_%s_Release" % metaindex.Dist
+ indexfile.describe == m.describe and
+ indexfile.is_trusted):
+ dir = apt_pkg.config.find_dir("Dir::State::lists")
+ name = apt_pkg.uri_to_filename(metaindex.uri)+"dists_%s_Release" % metaindex.dist
return dir+name
return None
diff --git a/debian/changelog b/debian/changelog
index c168de36..d981c8b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+python-apt (0.7.93.2) UNRELEASED; urgency=low
+
+ * Fix some places where the old API was still used:
+ - apt/utils.py: Completely ported, previous one was old-API from Ubuntu.
+ - apt/cache.py: Use the new progress classes instead of the old ones.
+ - apt/package.py: Various smaller issues fixed, probably caused by merge.
+
+ -- Julian Andres Klode <jak@debian.org> Sun, 07 Feb 2010 19:58:40 +0100
+
python-apt (0.7.93.1) unstable; urgency=low
[ Julian Andres Klode ]