Exemplo n.º 1
0
	def detectComponents(self):
		print 'Scanning for components...'
		dirNames = filter(lambda dir: not dir.startswith('.')
				and os.path.isdir(dir), os.listdir(os.curdir))
		dirNames.sort()
		self._maxCompLen = max(map(len, dirNames))
		oldPyVersion = 0
		column = 0
		for dirName in dirNames:
			propName = dirName + '/Properties.py'
			try:
				print dirName.ljust(self._maxCompLen, '.'),
			except TypeError:
				print dirName.ljust(self._maxCompLen),
			if os.path.exists(propName):
				comp = PropertiesObject(propName)
				comp['dirname'] = dirName
				for key in self._props.keys():
					if not comp.has_key(key):
						comp[key] = self._props[key]
				if sys.version_info[:3] < comp['requiredPyVersion']:
					oldPyVersion += 1
					print 'no*',
				else:
					self._comps.append(comp)
					print 'yes',
			else:
				print 'no ',
			if column < 2 and not self._verbose:
				print '   ',
				column += 1
			else:
				print
				column = 0
		if column:
			print
		if oldPyVersion:
			print "* some components require a newer Python version"
		self._comps.sort(lambda a, b: cmp(a['name'], b['name']))
		print