[Python-checkins] python/nondist/sandbox/pep262 install_db.py,1.1,1.2
akuchling@users.sourceforge.net
akuchling@users.sourceforge.net
Mon, 31 Mar 2003 10:47:01 -0800
Update of /cvsroot/python/python/nondist/sandbox/pep262
In directory sc8-pr-cvs1:/tmp/cvs-serv3426
Modified Files:
install_db.py
Log Message:
Normalize whitespace
Index: install_db.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/pep262/install_db.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** install_db.py 30 Mar 2003 17:05:13 -0000 1.1
--- install_db.py 31 Mar 2003 18:46:57 -0000 1.2
***************
*** 18,26 ****
from distutils.dist import DistributionMetadata
! INSTALLDB = ('%s%slib%spython%i.%i%sinstall' % (sys.prefix, os.sep,
os.sep,
sys.version_info[0],
sys.version_info[1],
os.sep))
INSTALLDB = '/tmp/i'
--- 18,27 ----
from distutils.dist import DistributionMetadata
! INSTALLDB = ('%s%slib%spython%i.%i%sinstall' % (sys.prefix, os.sep,
os.sep,
sys.version_info[0],
sys.version_info[1],
os.sep))
+ # XXX temporary hack for testing
INSTALLDB = '/tmp/i'
***************
*** 36,40 ****
"""InstallationDatabase(path:string)
Read the installation database rooted at the specified path.
! If path is None, INSTALLDB is used as the default.
"""
if path is None:
--- 37,41 ----
"""InstallationDatabase(path:string)
Read the installation database rooted at the specified path.
! If path is None, INSTALLDB is used as the default.
"""
if path is None:
***************
*** 42,46 ****
self.path = path
self._cache = {}
!
def get_package (self, package_name):
"""get_package(package_name:string) : Package
--- 43,47 ----
self.path = path
self._cache = {}
!
def get_package (self, package_name):
"""get_package(package_name:string) : Package
***************
*** 51,70 ****
except KeyError:
for package in self:
! if package.name == package_name:
self._cache[package_name] = package
return package
return None
!
def list_packages (self):
"""list_packages() : [Package]
! Return a list of all packages installed on the system,
enumerated in no particular order.
"""
return list(self)
!
def find_package (self, path):
"""find_file(path:string) : Package
! Search and return the package containing the file 'path'.
Returns None if the file doesn't belong to any package
that the InstallationDatabase knows about.
--- 52,71 ----
except KeyError:
for package in self:
! if package.name == package_name:
self._cache[package_name] = package
return package
return None
!
def list_packages (self):
"""list_packages() : [Package]
! Return a list of all packages installed on the system,
enumerated in no particular order.
"""
return list(self)
!
def find_package (self, path):
"""find_file(path:string) : Package
! Search and return the package containing the file 'path'.
Returns None if the file doesn't belong to any package
that the InstallationDatabase knows about.
***************
*** 75,82 ****
return package
return None
!
def __iter__ (self):
return _InstallDBIterator(self)
!
# class InstallationDatabase
--- 76,83 ----
return package
return None
!
def __iter__ (self):
return _InstallDBIterator(self)
!
# class InstallationDatabase
***************
*** 86,90 ****
self.instdb = instdb
self.queue = [instdb.path]
!
def next (self):
--- 87,91 ----
self.instdb = instdb
self.queue = [instdb.path]
!
def next (self):
***************
*** 101,105 ****
return Package(filename)
!
class Package(DistributionMetadata):
--- 102,106 ----
return Package(filename)
!
class Package(DistributionMetadata):
***************
*** 109,113 ****
files : {string : (size:int, perms:int, owner:string, group:string,
digest:string)}
! Dictionary mapping the path of a file installed by this package
to information about the file.
"""
--- 110,114 ----
files : {string : (size:int, perms:int, owner:string, group:string,
digest:string)}
! Dictionary mapping the path of a file installed by this package
to information about the file.
"""
***************
*** 119,123 ****
if filename is not None:
self.read_file()
!
def __repr__ (self):
return '<Package %s: %s>' % (self.name, self.filename)
--- 120,124 ----
if filename is not None:
self.read_file()
!
def __repr__ (self):
return '<Package %s: %s>' % (self.name, self.filename)
***************
*** 131,135 ****
m = rfc822.Message(input)
self.read_pkg_info(m)
!
if 'FILES' in sections:
while 1:
--- 132,136 ----
m = rfc822.Message(input)
self.read_pkg_info(m)
!
if 'FILES' in sections:
while 1:
***************
*** 145,149 ****
input.close()
!
def add_file (self, path):
"""add_file(path:string):None
--- 146,150 ----
input.close()
!
def add_file (self, path):
"""add_file(path:string):None
***************
*** 161,166 ****
self.files[path] = (stats.st_size, stats.st_mode,
stats.st_uid, stats.st_gid, digest)
!
!
def has_file (self, path):
"""has_file(path:string) : Boolean
--- 162,167 ----
self.files[path] = (stats.st_size, stats.st_mode,
stats.st_uid, stats.st_gid, digest)
!
!
def has_file (self, path):
"""has_file(path:string) : Boolean
***************
*** 199,203 ****
return L
!
def as_text (self):
output = cStringIO.StringIO()
--- 200,204 ----
return L
!
def as_text (self):
output = cStringIO.StringIO()
***************
*** 211,215 ****
output.write('\n')
return output.getvalue()
!
# class Package
--- 212,216 ----
output.write('\n')
return output.getvalue()
!
# class Package
***************
*** 234,236 ****
f.close()
print p.check_file('/www/bin/apachectl')
!
--- 235,237 ----
f.close()
print p.check_file('/www/bin/apachectl')
!