summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-03-01 17:48:06 +0100
committerJulian Andres Klode <jak@debian.org>2010-03-01 17:48:06 +0100
commita8dda6d93b07b7226a3aa41baa50ca059674566e (patch)
tree3a47fc78dbdd11c93096409b00212b42341e2e0e /apt
parenta72f4f9fd0ce0e8c1e49486fd779003b7f05c882 (diff)
downloadpython-apt-a8dda6d93b07b7226a3aa41baa50ca059674566e.tar.gz
Some stylistic changes.
Diffstat (limited to 'apt')
-rw-r--r--apt/cache.py10
-rw-r--r--apt/debfile.py22
-rw-r--r--apt/progress/base.py9
-rw-r--r--apt/progress/gtk2.py1
-rw-r--r--apt/progress/old.py10
-rw-r--r--apt/utils.py6
6 files changed, 35 insertions, 23 deletions
diff --git a/apt/cache.py b/apt/cache.py
index e8688d64..2e6d24e5 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -57,6 +57,10 @@ class Cache(object):
"""
def __init__(self, progress=None, rootdir=None, memonly=False):
+ self._cache = None
+ self._depcache = None
+ self._records = None
+ self._list = None
self._callbacks = {}
self._weakref = weakref.WeakValueDictionary()
self._set = set()
@@ -624,9 +628,9 @@ def _test():
# see if fetching works
- for dir in ["/tmp/pytest", "/tmp/pytest/partial"]:
- if not os.path.exists(dir):
- os.mkdir(dir)
+ for dirname in ["/tmp/pytest", "/tmp/pytest/partial"]:
+ if not os.path.exists(dirname):
+ os.mkdir(dirname)
apt_pkg.config.set("Dir::Cache::Archives", "/tmp/pytest")
pm = apt_pkg.PackageManager(cache._depcache)
fetcher = apt_pkg.Acquire(apt.progress.text.AcquireProgress())
diff --git a/apt/debfile.py b/apt/debfile.py
index e27917d5..ccaa25e4 100644
--- a/apt/debfile.py
+++ b/apt/debfile.py
@@ -43,6 +43,9 @@ class DebPackage(object):
def __init__(self, filename=None, cache=None):
self._cache = cache
self._need_pkgs = []
+ self._debfile = None
+ self.pkgname = ""
+ self.filename = filename
self._sections = {}
self._installed_conflicts = set()
self._failure_string = ""
@@ -168,9 +171,6 @@ class DebPackage(object):
"""Check the or-group for conflicts with installed pkgs."""
self._dbg(2, "_check_conflicts_or_group(): %s " % (or_group))
- or_found = False
- virtual_pkg = None
-
for dep in or_group:
depname = dep[0]
ver = dep[1]
@@ -287,13 +287,13 @@ class DebPackage(object):
else:
cachever = self._cache[pkgname].candidate.version
if cachever is not None:
- cmp = apt_pkg.version_compare(cachever, debver)
- self._dbg(1, "CompareVersion(debver,instver): %s" % cmp)
- if cmp == 0:
+ cmpres = apt_pkg.version_compare(cachever, debver)
+ self._dbg(1, "CompareVersion(debver,instver): %s" % cmpres)
+ if cmpres == 0:
return VERSION_SAME
- elif cmp < 0:
+ elif cmpres < 0:
return VERSION_NEWER
- elif cmp > 0:
+ elif cmpres > 0:
return VERSION_OUTDATED
return VERSION_NONE
@@ -361,7 +361,7 @@ class DebPackage(object):
for pkg in self._need_pkgs:
try:
self._cache[pkg].mark_install(fromUser=False)
- except SystemError, e:
+ except SystemError:
self._failure_string = _("Cannot install '%s'" % pkg)
self._cache.clear()
return False
@@ -427,7 +427,8 @@ class DscSrcPackage(DebPackage):
DebPackage.__init__(self, None, cache)
self._depends = []
self._conflicts = []
- self._binaries = []
+ self.pkgname = ""
+ self.binaries = []
if filename is not None:
self.open(filename)
@@ -465,7 +466,6 @@ class DscSrcPackage(DebPackage):
if 'Version' in sec:
self._sections['Version'] = sec['Version']
finally:
- del sec
del tagfile
fobj.close()
diff --git a/apt/progress/base.py b/apt/progress/base.py
index d4342de8..6822b74a 100644
--- a/apt/progress/base.py
+++ b/apt/progress/base.py
@@ -16,6 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+# pylint: disable-msg = R0201
"""Base classes for progress reporting.
Custom progress classes should inherit from these classes. They can also be
@@ -28,7 +29,6 @@ import re
import select
import apt_pkg
-from apt.deprecation import function_deprecated_by
__all__ = ['AcquireProgress', 'CdromProgress', 'InstallProgress', 'OpProgress']
@@ -137,7 +137,7 @@ class CdromProgress(object):
class InstallProgress(object):
"""Class to report the progress of installing packages."""
- percent, select_timeout, status = 0.0, 0.1, ""
+ child_pid, percent, select_timeout, status = 0, 0.0, 0.1, ""
def __init__(self):
(self.statusfd, self.writefd) = os.pipe()
@@ -159,9 +159,6 @@ class InstallProgress(object):
def status_change(self, pkg, percent, status):
"""(Abstract) Called when the APT status changed."""
- # compat with 0.7
- if apt_pkg._COMPAT_0_7 and hasattr(self, "statusChange"):
- self.statusChange(pkg, percent, status)
def dpkg_status_change(self, pkg, status):
"""(Abstract) Called when the dpkg status changed."""
@@ -269,7 +266,7 @@ class InstallProgress(object):
try:
select.select([self.status_stream], [], [],
self.select_timeout)
- except select.error, (errno_, errstr):
+ except select.error, (errno_, _errstr):
if errno_ != errno.EINTR:
raise
diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py
index 29e730a3..acb01eed 100644
--- a/apt/progress/gtk2.py
+++ b/apt/progress/gtk2.py
@@ -124,6 +124,7 @@ class GInstallProgress(gobject.GObject, base.InstallProgress):
base.InstallProgress.__init__(self)
gobject.GObject.__init__(self)
self.finished = False
+ self.apt_status = -1
self.time_last_update = time.time()
self.term = term
reaper = vte.reaper_get()
diff --git a/apt/progress/old.py b/apt/progress/old.py
index b2f6f0d5..c64eee57 100644
--- a/apt/progress/old.py
+++ b/apt/progress/old.py
@@ -18,6 +18,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
+# pylint: disable-msg = C0103
"""Deprecated progress reporting classes.
This module provides classes for compatibility with python-apt 0.7. They are
@@ -195,10 +196,19 @@ class InstallProgress(DumbInstallProgress, base.InstallProgress):
base.InstallProgress.update_interface)
waitChild = function_deprecated_by(base.InstallProgress.wait_child)
+ def status_change(self, pkg, percent, status):
+ """(Abstract) Called when the APT status changed."""
+ # compat with 0.7
+ if apt_pkg._COMPAT_0_7 and hasattr(self, "statusChange"):
+ self.statusChange(pkg, percent, status)
+
class DpkgInstallProgress(InstallProgress):
"""Progress handler for a local Debian package installation."""
+ debfile = ""
+ debname = ""
+
def run(self, debfile):
"""Start installing the given Debian package."""
# Deprecated stuff
diff --git a/apt/utils.py b/apt/utils.py
index dd52f824..80ba6d65 100644
--- a/apt/utils.py
+++ b/apt/utils.py
@@ -61,7 +61,7 @@ def get_release_filename_for_pkg(cache, pkgname, label, release):
for aver in pkg._pkg.version_list:
if aver is None or aver.file_list is None:
continue
- for ver_file, index in aver.file_list:
+ for ver_file, _index in aver.file_list:
#print verFile
if (ver_file.origin == label and
ver_file.label == label and
@@ -75,8 +75,8 @@ def get_release_filename_for_pkg(cache, pkgname, label, release):
if (indexfile and
indexfile.describe == m.describe and
indexfile.is_trusted):
- dir = apt_pkg.config.find_dir("Dir::State::lists")
+ dirname = 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 dirname + name
return None