Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "Zac Medico (zmedico)" <zmedico@g.o>
Subject: portage r13145 - main/trunk/pym/portage
Date: Sun, 22 Mar 2009 23:21:39 +0000
Author: zmedico
Date: 2009-03-22 23:21:38 +0000 (Sun, 22 Mar 2009)
New Revision: 13145

Modified:
   main/trunk/pym/portage/__init__.py
Log:
Replace xrange() usage with normal iteration and enumerate() where
appropriate. Thanks to Douglass Anderson <dja@...> for the
initial patch.


Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py	2009-03-22 22:05:47 UTC (rev 13144)
+++ main/trunk/pym/portage/__init__.py	2009-03-22 23:21:38 UTC (rev 13145)
@@ -1376,9 +1376,9 @@
 			self.pusemask_list = []
 			rawpusemask = [grabdict_package(os.path.join(x, "package.use.mask"),
 				recursive=1) for x in self.profiles]
-			for i in xrange(len(self.profiles)):
+			for pusemaskdict in rawpusemask:
 				cpdict = {}
-				for k, v in rawpusemask[i].iteritems():
+				for k, v in pusemaskdict.iteritems():
 					cpdict.setdefault(dep_getkey(k), {})[k] = v
 				self.pusemask_list.append(cpdict)
 			del rawpusemask
@@ -1386,9 +1386,9 @@
 			self.pkgprofileuse = []
 			rawprofileuse = [grabdict_package(os.path.join(x, "package.use"),
 				juststrings=True, recursive=1) for x in self.profiles]
-			for i in xrange(len(self.profiles)):
+			for rawpusedict in rawprofileuse:
 				cpdict = {}
-				for k, v in rawprofileuse[i].iteritems():
+				for k, v in rawpusedict.iteritems():
 					cpdict.setdefault(dep_getkey(k), {})[k] = v
 				self.pkgprofileuse.append(cpdict)
 			del rawprofileuse
@@ -1402,9 +1402,9 @@
 			rawpuseforce = [grabdict_package(
 				os.path.join(x, "package.use.force"), recursive=1) \
 				for x in self.profiles]
-			for i in xrange(len(self.profiles)):
+			for rawpusefdict in rawpuseforce:
 				cpdict = {}
-				for k, v in rawpuseforce[i].iteritems():
+				for k, v in rawpusefdict.iteritems():
 					cpdict.setdefault(dep_getkey(k), {})[k] = v
 				self.puseforce_list.append(cpdict)
 			del rawpuseforce
@@ -2129,10 +2129,11 @@
 		if pkginternaluse != self.configdict["pkginternal"].get("USE", ""):
 			self.configdict["pkginternal"]["USE"] = pkginternaluse
 			has_changed = True
+
 		defaults = []
 		pos = 0
-		for i in xrange(len(self.profiles)):
-			cpdict = self.pkgprofileuse[i].get(cp, None)
+		for i, pkgprofileuse_dict in enumerate(self.pkgprofileuse):
+			cpdict = pkgprofileuse_dict.get(cp)
 			if cpdict:
 				keys = cpdict.keys()
 				while keys:
@@ -2296,8 +2297,8 @@
 			cp = dep_getkey(pkg)
 		usemask = []
 		pos = 0
-		for i in xrange(len(self.profiles)):
-			cpdict = self.pusemask_list[i].get(cp, None)
+		for i, pusemask_dict in enumerate(self.pusemask_list):
+			cpdict = pusemask_dict.get(cp)
 			if cpdict:
 				keys = cpdict.keys()
 				while keys:
@@ -2319,8 +2320,8 @@
 			cp = dep_getkey(pkg)
 		useforce = []
 		pos = 0
-		for i in xrange(len(self.profiles)):
-			cpdict = self.puseforce_list[i].get(cp, None)
+		for i, puseforce_dict in enumerate(self.puseforce_list):
+			cpdict = puseforce_dict.get(cp)
 			if cpdict:
 				keys = cpdict.keys()
 				while keys:
@@ -2395,8 +2396,8 @@
 		pkg = "%s:%s" % (cpv, metadata["SLOT"])
 		keywords = [[x for x in metadata["KEYWORDS"].split() if x != "-*"]]
 		pos = len(keywords)
-		for i in xrange(len(self.profiles)):
-			cpdict = self._pkeywords_list[i].get(cp, None)
+		for pkeywords_dict in self._pkeywords_list:
+			cpdict = pkeywords_dict.get(cp)
 			if cpdict:
 				keys = list(cpdict)
 				while keys:



Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
gentoo-x86 commit in app-emulation/qemu-softmmu: ChangeLog qemu-softmmu-0.10.1.ebuild
Next by thread:
gentoo-x86 commit in app-emulation/qemu-user: ChangeLog qemu-user-0.10.1.ebuild
Previous by date:
gentoo-x86 commit in app-emulation/qemu-softmmu: ChangeLog qemu-softmmu-0.10.1.ebuild
Next by date:
gentoo-x86 commit in app-emulation/qemu-user: ChangeLog qemu-user-0.10.1.ebuild


Updated Jan 13, 2012

Summary: Archive of the gentoo-commits mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.