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
# $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
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):
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
conn,protocol,address,params,headers = create_conn(baseurl, conn)
- filedict = {}
-
try:
metadatafile = open("/var/cache/edb/remote_metadata.pickle")
metadata = cPickle.load(metadatafile)
# 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 \
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()
import os
import sys
import urllib
-import time
-import codecs
import re
import xml.dom.minidom
@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]
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):
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):
__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
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:
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);
# $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