summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-03-01 17:12:09 +0100
committerJulian Andres Klode <jak@debian.org>2010-03-01 17:12:09 +0100
commit78e152429187ef145124b0ac0a69ffd1d52f4ed7 (patch)
tree781f35c83798f4d1d9a2019fd0f9409e3312be6d /apt
parent28fcce3fe36ab2c3855d4c3766490272a7310392 (diff)
downloadpython-apt-78e152429187ef145124b0ac0a69ffd1d52f4ed7.tar.gz
Style fixes.
Diffstat (limited to 'apt')
-rw-r--r--apt/cache.py27
-rw-r--r--apt/package.py1
-rw-r--r--apt/progress/base.py6
-rw-r--r--apt/progress/old.py3
-rw-r--r--apt/utils.py14
5 files changed, 30 insertions, 21 deletions
diff --git a/apt/cache.py b/apt/cache.py
index b5733d98..e8688d64 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -46,12 +46,12 @@ class Cache(object):
"""Dictionary-like package cache.
This class has all the packages that are available in it's
- dictionary.
+ dictionary.
Keyword arguments:
progress -- a OpProgress object
- rootdir -- a alternative root directory. if that is given
- the system sources.list and system lists/ files are
+ rootdir -- a alternative root directory. if that is given
+ the system sources.list and system lists/ files are
not read, only files relative to the given rootdir
memonly -- build the cache in memory only
"""
@@ -95,12 +95,12 @@ class Cache(object):
"/var/lib/apt/lists/partial",
]
for d in dirs:
- if not os.path.exists(rootdir+d):
- print "creating: ",rootdir+d
- os.makedirs(rootdir+d)
+ if not os.path.exists(rootdir + d):
+ print "creating: ", rootdir + d
+ os.makedirs(rootdir + d)
for f in files:
- if not os.path.exists(rootdir+f):
- open(rootdir+f,"w")
+ if not os.path.exists(rootdir + f):
+ open(rootdir + f, "w")
def _run_callbacks(self, name):
""" internal helper to run a callback """
@@ -125,12 +125,12 @@ class Cache(object):
self._weakref.clear()
progress.op = _("Building data structures")
- i=last=0
- size=len(self._cache.packages)
+ i = last = 0
+ size = len(self._cache.packages)
for pkg in self._cache.packages:
if progress is not None and last+100 < i:
progress.update(i/float(size)*100)
- last=i
+ last = i
# drop stuff with no versions (cruft)
if len(pkg.version_list) > 0:
self._set.add(pkg.name)
@@ -376,9 +376,10 @@ class Cache(object):
elif res == pm.RESULT_FAILED:
raise SystemError("installArchives() failed")
elif res == pm.RESULT_INCOMPLETE:
- pass
+ pass
else:
- raise SystemError("internal-error: unknown result code from InstallArchives: %s" % res)
+ raise SystemError("internal-error: unknown result code "
+ "from InstallArchives: %s" % res)
# reload the fetcher for media swaping
fetcher.shutdown()
return (res == pm.RESULT_COMPLETED)
diff --git a/apt/package.py b/apt/package.py
index 84a1f1e6..6bf9554b 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -79,7 +79,6 @@ class BaseDependency(object):
def __ne__(self, other):
return str.__eq__(self, other) and str.__ne__(2 * self, other)
-
def __init__(self, name, rel, ver, pre, rawtype=None):
self.name = name
self.relation = len(rel) == 1 and self.__dstr(rel) or rel
diff --git a/apt/progress/base.py b/apt/progress/base.py
index 8075f790..d4342de8 100644
--- a/apt/progress/base.py
+++ b/apt/progress/base.py
@@ -197,7 +197,8 @@ class InstallProgress(object):
os._exit(obj.do_install(self.write_stream.fileno()))
except AttributeError:
os._exit(os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "--status-fd",
- str(self.write_stream.fileno()), "-i", obj))
+ str(self.write_stream.fileno()), "-i",
+ obj))
except Exception:
os._exit(apt_pkg.PackageManager.RESULT_FAILED)
@@ -266,7 +267,8 @@ class InstallProgress(object):
(pid, res) = (0, 0)
while True:
try:
- select.select([self.status_stream], [], [], self.select_timeout)
+ select.select([self.status_stream], [], [],
+ self.select_timeout)
except select.error, (errno_, errstr):
if errno_ != errno.EINTR:
raise
diff --git a/apt/progress/old.py b/apt/progress/old.py
index 15ead890..b2f6f0d5 100644
--- a/apt/progress/old.py
+++ b/apt/progress/old.py
@@ -191,7 +191,8 @@ class InstallProgress(DumbInstallProgress, base.InstallProgress):
selectTimeout = AttributeDeprecatedBy('select_timeout')
statusChange = function_deprecated_by(base.InstallProgress.status_change)
- updateInterface = function_deprecated_by(base.InstallProgress.update_interface)
+ updateInterface = function_deprecated_by(
+ base.InstallProgress.update_interface)
waitChild = function_deprecated_by(base.InstallProgress.wait_child)
diff --git a/apt/utils.py b/apt/utils.py
index 61d5d54f..dd52f824 100644
--- a/apt/utils.py
+++ b/apt/utils.py
@@ -17,9 +17,11 @@
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-import apt_pkg
import os.path
+import apt_pkg
+
+
def get_maintenance_end_date(release_date, m_months):
"""
get the (year, month) tuple when the maintenance for the distribution
@@ -28,10 +30,12 @@ def get_maintenance_end_date(release_date, m_months):
"""
years = m_months / 12
months = m_months % 12
- support_end_year = release_date.year + years + (release_date.month + months)/12
+ support_end_year = (release_date.year + years +
+ (release_date.month + months)/12)
support_end_month = (release_date.month + months) % 12
return (support_end_year, support_end_month)
+
def get_release_date_from_release_file(path):
"""
return the release date as time_t for the given release file
@@ -45,6 +49,7 @@ def get_release_date_from_release_file(path):
date = 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 pkgname not in cache:
@@ -54,7 +59,7 @@ def get_release_filename_for_pkg(cache, pkgname, label, release):
# look for the version that comes from the repos with
# the given label and origin
for aver in pkg._pkg.version_list:
- if aver == None or aver.file_list == None:
+ if aver is None or aver.file_list is None:
continue
for ver_file, index in aver.file_list:
#print verFile
@@ -71,6 +76,7 @@ def get_release_filename_for_pkg(cache, pkgname, label, release):
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
+ name = (apt_pkg.uri_to_filename(metaindex.uri) +
+ "dists_%s_Release" % metaindex.dist)
return dir+name
return None