CVS: src/si/extras entitycheck.py,1.30,1.31
Mats Wichmann <[email protected]>
| Newsgroups | gmane.linux.lsb.implementation |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/lsb/src/si/extras
In directory sc8-pr-cvs1:/tmp/cvs-serv28406/si/extras
Modified Files:
entitycheck.py
Log Message:
De-tabify
Index: entitycheck.py
===================================================================
RCS file: /cvsroot/lsb/src/si/extras/entitycheck.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** entitycheck.py 20 Mar 2003 19:44:25 -0000 1.30
--- entitycheck.py 22 Mar 2003 14:38:37 -0000 1.31
***************
*** 87,101 ****
"""Callback function for urllib.urlretrieve()"""
so_far = block_count * block_size
! if not so_far: return
! pct = so_far * 100L / total
! # Work out remaining time: need transfer rate first
! now = time.time()
! elapsed = now - self.start
! rate = so_far / elapsed
! left = (total - so_far) / rate
! tmp = time.gmtime(left)
! if tmp[3]: timestr = "%2d:" % tmp[3]
! else: timestr = "" # skip hours if zero
! timestr = "%s%02d:%02d remaining" % (timestr, tmp[4], tmp[5])
self.message = "%d of %d bytes (%d%%) %s" % (so_far, total, pct, timestr)
self.running_output()
--- 87,101 ----
"""Callback function for urllib.urlretrieve()"""
so_far = block_count * block_size
! if not so_far: return
! pct = so_far * 100L / total
! # Work out remaining time: need transfer rate first
! now = time.time()
! elapsed = now - self.start
! rate = so_far / elapsed
! left = (total - so_far) / rate
! tmp = time.gmtime(left)
! if tmp[3]: timestr = "%2d:" % tmp[3]
! else: timestr = "" # skip hours if zero
! timestr = "%s%02d:%02d remaining" % (timestr, tmp[4], tmp[5])
self.message = "%d of %d bytes (%d%%) %s" % (so_far, total, pct, timestr)
self.running_output()
***************
*** 119,124 ****
if dry_run: # just print a message and bail
! self.message = "fetch %s from (%s, ...) to %s" % (self.file,
! loc.path, destination)
self.running_output()
print # line break so previous message isn't overwritten
--- 119,124 ----
if dry_run: # just print a message and bail
! self.message = "fetch %s from (%s, ...) to %s" % \
! (self.file, loc.path, destination)
self.running_output()
print # line break so previous message isn't overwritten
***************
*** 132,138 ****
try:
! self.start = time.time()
filename, mime = urllib.urlretrieve(to_get, pkgpath,
! self.feedback)
if mime and mime.gettype() == 'text/html':
raise IOError
--- 132,138 ----
try:
! self.start = time.time()
filename, mime = urllib.urlretrieve(to_get, pkgpath,
! self.feedback)
if mime and mime.gettype() == 'text/html':
raise IOError
***************
*** 169,175 ****
patches = []
for line in entities.readlines():
! # in lieu of proper xml parsing, skip commented lines
! if line[0:4] == '<!--':
! continue
match = package_re.search(line)
if match:
--- 169,175 ----
patches = []
for line in entities.readlines():
! # in lieu of proper xml parsing, skip commented lines
! if line[0:4] == '<!--':
! continue
match = package_re.search(line)
if match:
***************
*** 343,359 ****
global initial_text
if os.access(package_path, os.W_OK):
! print "Retrieving..."
! for pkg in missing_packages:
! if pkg.fetch(locations, fallback_url, package_path):
! retrieved = retrieved + 1
! else:
! if pkg.message == 'retrieval failed':
! fails.append(pkg)
! if pkg.message == 'not found':
! # should not happen, but we track 'em so we can catch where
! # an entity is defined but not listed in package_locations
! missing.append(pkg)
else:
! print 'Error: cannot write to package directory "%s"' % package_path
return (retrieved, fails, missing)
--- 343,359 ----
global initial_text
if os.access(package_path, os.W_OK):
! print "Retrieving..."
! for pkg in missing_packages:
! if pkg.fetch(locations, fallback_url, package_path):
! retrieved = retrieved + 1
! else:
! if pkg.message == 'retrieval failed':
! fails.append(pkg)
! if pkg.message == 'not found':
! # should not happen, but we track 'em so we can catch where
! # an entity is defined but not listed in package_locations
! missing.append(pkg)
else:
! print 'Error: cannot write to package directory "%s"' % package_path
return (retrieved, fails, missing)