diff options
-rw-r--r-- | pym/portage/checksum.py | 6 | ||||
-rw-r--r-- | pym/portage/getbinpkg.py | 25 | ||||
-rw-r--r-- | pym/portage/glsa.py | 3 | ||||
-rw-r--r-- | pym/portage/news.py | 3 | ||||
-rw-r--r-- | pym/portage/output.py | 11 | ||||
-rw-r--r-- | pym/portage/process.py | 6 |
6 files changed, 28 insertions, 26 deletions
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index edbd515ae..fa00247ab 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -30,14 +30,14 @@ def _generate_hash_function(hashtype, hashobject, origin="unknown"): blocksize = HASHING_BLOCKSIZE data = f.read(blocksize) size = 0L - sum = hashobject() + checksum = hashobject() while data: - sum.update(data) + checksum.update(data) size = size + len(data) data = f.read(blocksize) f.close() - return (sum.hexdigest(), size) + return (checksum.hexdigest(), size) hashfunc_map[hashtype] = pyhash hashorigin_map[hashtype] = origin return pyhash diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 1adab1b51..6e0ab5168 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -4,7 +4,14 @@ # $Id$ from portage.output import red, yellow, green -import htmllib,HTMLParser,formatter,sys,os,portage.xpak,time,tempfile,base64,urllib2 +import portage.xpak +import HTMLParser +import sys +import os +import time +import tempfile +import base64 +import urllib2 try: import cPickle @@ -13,16 +20,12 @@ except ImportError: try: import ftplib -except SystemExit, e: - raise -except Exception, e: +except ImportError, e: sys.stderr.write(red("!!! CANNOT IMPORT FTPLIB: ")+str(e)+"\n") try: import httplib -except SystemExit, e: - raise -except Exception, e: +except ImportError, e: sys.stderr.write(red("!!! CANNOT IMPORT HTTPLIB: ")+str(e)+"\n") def make_metadata_dict(data): @@ -266,11 +269,11 @@ def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): if not allow_overlap: # Not allow to overlap prefix and suffix if len(x) >= (len(prefix)+len(suffix)): - y = x[len(prefix):] + pass else: continue # Too short to match. else: - y = x # Do whatever... We're overlapping. + pass # Do whatever... We're overlapping. if suffix and (len(x) >= len(suffix)) and (x[-len(suffix):] == suffix): myarray.append(x) # It matches @@ -456,8 +459,6 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= conn,protocol,address,params,headers = create_conn(baseurl, conn) - filedict = {} - try: metadatafile = open("/var/cache/edb/remote_metadata.pickle") metadata = cPickle.load(metadatafile) @@ -484,7 +485,6 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= # Determine if our metadata file is current. metalist.sort() metalist.reverse() # makes the order new-to-old. - havecache=0 for mfile in metalist: if usingcache and \ ((metadata[baseurl]["indexname"] != mfile) or \ @@ -650,7 +650,6 @@ class PackageIndex(object): cpv_all = self.packages.keys() cpv_all.sort() if self.modified: - import time self.header["TIMESTAMP"] = str(long(time.time())) self.header["PACKAGES"] = str(len(cpv_all)) keys = self.header.keys() diff --git a/pym/portage/glsa.py b/pym/portage/glsa.py index d8053a820..5e2d5f081 100644 --- a/pym/portage/glsa.py +++ b/pym/portage/glsa.py @@ -5,8 +5,6 @@ import os import sys import urllib -import time -import codecs import re import xml.dom.minidom @@ -535,7 +533,6 @@ class Glsa: @rtype: Boolean @returns: True if the system is affected, False if not """ - vList = [] rValue = False for k in self.packages.keys(): pkg = self.packages[k] diff --git a/pym/portage/news.py b/pym/portage/news.py index d8df8c294..702a377a5 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -72,7 +72,6 @@ class NewsManager(object): path = os.path.join(self.portdb.getRepositoryPath(repoid), self.NEWS_PATH) - repo_path = self.portdb.getRepositoryPath(repoid) # Skip reading news for repoid if the news dir does not exist. Requested by # NightMorph :) if not os.path.exists(path): @@ -83,7 +82,7 @@ class NewsManager(object): try: filename = os.path.join(path, itemid, itemid + "." + self.LANGUAGE_ID + ".txt") item = NewsItem(filename, itemid, timestamp) - except (TypeError, ValueError), e: + except (TypeError, ValueError): continue if item.isRelevant(profile=self._profile_path, config=self.config, vardb=self.vdb): diff --git a/pym/portage/output.py b/pym/portage/output.py index 9f0b7950b..f4e90fb8e 100644 --- a/pym/portage/output.py +++ b/pym/portage/output.py @@ -4,7 +4,12 @@ __docformat__ = "epytext" -import commands, errno, os, re, shlex, sys, time +import commands +import errno +import os +import re +import shlex +import sys from portage.const import COLOR_MAP_FILE from portage.util import writemsg from portage.exception import PortageException, ParseError, PermissionDenied, FileNotFound @@ -170,7 +175,6 @@ def parse_color_map(onerror=None): try: s = shlex.shlex(open(myfile)) s.wordchars = s.wordchars + ";" # for ansi codes - d = {} while True: k, o, v = s.get_token(), s.get_token(), s.get_token() if k is s.eof: @@ -220,10 +224,11 @@ def parse_color_map(onerror=None): try: parse_color_map(onerror=lambda e: writemsg("%s\n" % str(e), noiselevel=-1)) -except FileNotFound, e: +except FileNotFound: pass except PortageException, e: writemsg("%s\n" % str(e)) + del e def nc_len(mystr): tmp = re.sub(esc_seq + "^m]+m", "", mystr); diff --git a/pym/portage/process.py b/pym/portage/process.py index c3f5d4df4..fad38770e 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -4,8 +4,10 @@ # $Id$ -import os, atexit, signal, sys -import portage.data +import os +import atexit +import signal +import sys from portage.util import dump_traceback from portage.const import BASH_BINARY, SANDBOX_BINARY |