- Use distutils to find site-python (suggested by Thomas Heller, thanks!)

- Fixed a bug for packages without MD5 checksum.
This commit is contained in:
Jack Jansen 2003-02-12 16:37:00 +00:00
parent c13f19f1fc
commit e71b9f830b
1 changed files with 3 additions and 7 deletions

View File

@ -18,6 +18,7 @@ import urllib
import urlparse import urlparse
import plistlib import plistlib
import distutils.util import distutils.util
import distutils.sysconfig
import md5 import md5
__all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main"] __all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main"]
@ -33,12 +34,7 @@ PIMP_VERSION="0.1"
DEFAULT_FLAVORORDER=['source', 'binary'] DEFAULT_FLAVORORDER=['source', 'binary']
DEFAULT_DOWNLOADDIR='/tmp' DEFAULT_DOWNLOADDIR='/tmp'
DEFAULT_BUILDDIR='/tmp' DEFAULT_BUILDDIR='/tmp'
for _p in sys.path: DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib()
if _p[-13:] == 'site-packages':
DEFAULT_INSTALLDIR=_p
break
else:
DEFAULT_INSTALLDIR=sys.prefix # Have to put things somewhere
DEFAULT_PIMPDATABASE="http://www.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform() DEFAULT_PIMPDATABASE="http://www.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform()
ARCHIVE_FORMATS = [ ARCHIVE_FORMATS = [
@ -419,7 +415,7 @@ class PimpPackage:
if not os.path.exists(self.archiveFilename): if not os.path.exists(self.archiveFilename):
return 0 return 0
if not self._dict['MD5Sum']: if not self._dict.get('MD5Sum'):
sys.stderr.write("Warning: no MD5Sum for %s\n" % self.fullname()) sys.stderr.write("Warning: no MD5Sum for %s\n" % self.fullname())
return 1 return 1
data = open(self.archiveFilename, 'rb').read() data = open(self.archiveFilename, 'rb').read()