[Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.29,1.30

jackjansen at users.sourceforge.net jackjansen at users.sourceforge.net
Sat Feb 28 18:18:45 EST 2004


Update of /cvsroot/python/python/dist/src/Lib/plat-mac
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26758

Modified Files:
	pimp.py 
Log Message:
getDefaultDatabase() should be a toplevel function, not a method of the
preferences object.


Index: pimp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** pimp.py	28 Feb 2004 22:34:02 -0000	1.29
--- pimp.py	28 Feb 2004 23:18:43 -0000	1.30
***************
*** 47,50 ****
--- 47,95 ----
  DEFAULT_PIMPDATABASE_FMT="http://www.python.org/packman/version-%s/%s-%s-%s-%s-%s.plist"
  
+ def getDefaultDatabase(experimental=False):
+ 	if experimental:
+ 		status = "exp"
+ 	else:
+ 		status = "prod"
+ 		
+ 	major, minor, micro, state, extra = sys.version_info
+ 	pyvers = '%d.%d' % (major, minor)
+ 	if state != 'final':
+ 		pyvers = pyvers + '%s%d' % (state, extra)
+ 		
+ 	longplatform = distutils.util.get_platform()
+ 	osname, release, machine = longplatform.split('-')
+ 	# For some platforms we may want to differentiate between
+ 	# installation types
+ 	if osname == 'darwin':
+ 		if sys.prefix.startswith('/System/Library/Frameworks/Python.framework'):
+ 			osname = 'darwin_apple'
+ 		elif sys.prefix.startswith('/Library/Frameworks/Python.framework'):
+ 			osname = 'darwin_macpython'
+ 		# Otherwise we don't know...
+ 	# Now we try various URLs by playing with the release string.
+ 	# We remove numbers off the end until we find a match.
+ 	rel = release
+ 	while True:
+ 		url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine)
+ 		try:
+ 			urllib2.urlopen(url)
+ 		except urllib2.HTTPError, arg:
+ 			pass
+ 		else:
+ 			break
+ 		if not rel:
+ 			# We're out of version numbers to try. Use the
+ 			# full release number, this will give a reasonable
+ 			# error message later
+ 			url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, release, machine)
+ 			break
+ 		idx = rel.rfind('.')
+ 		if idx < 0:
+ 			rel = ''
+ 		else:
+ 			rel = rel[:idx]
+ 	return url
+ 
  def _cmd(output, dir, *cmditems):
      """Internal routine to run a shell command in a given directory."""
***************
*** 164,168 ****
              buildDir = DEFAULT_BUILDDIR
          if not pimpDatabase:
!             pimpDatabase = self.getDefaultDatabase()
          self.setInstallDir(installDir)
          self.flavorOrder = flavorOrder
--- 209,213 ----
              buildDir = DEFAULT_BUILDDIR
          if not pimpDatabase:
!             pimpDatabase = getDefaultDatabase()
          self.setInstallDir(installDir)
          self.flavorOrder = flavorOrder
***************
*** 186,236 ****
      def isUserInstall(self):
          return self.installDir != DEFAULT_INSTALLDIR
-         
-     def getDefaultDatabase(self, experimental=False):
-         if experimental:
-             status = "exp"
-         else:
-             status = "prod"
-             
-         major, minor, micro, state, extra = sys.version_info
-         pyvers = '%d.%d' % (major, minor)
-         if state != 'final':
-             pyvers = pyvers + '%s%d' % (state, extra)
-             
-         longplatform = distutils.util.get_platform()
-         osname, release, machine = longplatform.split('-')
-         # For some platforms we may want to differentiate between
-         # installation types
-         if osname == 'darwin':
-             if sys.prefix.startswith('/System/Library/Frameworks/Python.framework'):
-                 osname = 'darwin_apple'
-             elif sys.prefix.startswith('/Library/Frameworks/Python.framework'):
-                 osname = 'darwin_macpython'
-             # Otherwise we don't know...
-         # Now we try various URLs by playing with the release string.
-         # We remove numbers off the end until we find a match.
-         rel = release
-         while True:
-             url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine)
-             try:
-                 urllib2.urlopen(url)
-             except urllib2.HTTPError, arg:
-             	print 'getDefaultDatabase: cannot open', url
-             	print 'error', arg
-                 pass
-             else:
-                 break
-             if not rel:
-                 # We're out of version numbers to try. Use the
-                 # full release number, this will give a reasonable
-                 # error message later
-                 url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, release, machine)
-                 break
-             idx = rel.rfind('.')
-             if idx < 0:
-                 rel = ''
-             else:
-                 rel = rel[:idx]
-         return url
  
      def check(self):
--- 231,234 ----




More information about the Python-checkins mailing list