[arch-dev-public] [PATCH 2/2] Unify depend cleaning code a bit more

Dan McGee dan at archlinux.org
Tue Jun 8 00:10:45 EDT 2010


This builds on the previous commit fixing optdepend cleaning and also adds
makedepend cleaning to the mix; even though we don't use this data right now
we can get it all cleaned up via the same method.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 pacman.py |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/pacman.py b/pacman.py
index fd367d7..8d57e28 100644
--- a/pacman.py
+++ b/pacman.py
@@ -51,14 +51,19 @@ class PacmanPackage(object):
 		Also clean our optdepends and remove any trailing description.
 		The original arrays are copied to orig_depends and orig_optdepends respectively.
 		"""
+		def strip_depend_info(l):
+			for item, value in enumerate(l):
+				l[item] = value.split(':')[0].split('>')[0].split('<')[0].split('=')[0]
+
 		if hasattr(self, 'depends'):
 			self.orig_depends = self.depends[:]
-			for item, value in enumerate(self.depends):
-				self.depends[item] = value.split('>')[0].split('<')[0].split('=')[0]
+			strip_depend_info(self.depends)
+		if hasattr(self, 'makedepends'):
+			self.orig_makedepends = self.makedepends[:]
+			strip_depend_info(self.makedepends)
 		if hasattr(self, 'optdepends'):
 			self.orig_optdepends = self.optdepends[:]
-			for item, value in enumerate(self.optdepends):
-				self.optdepends[item] = value.split(':')[0].split('>')[0].split('<')[0].split('=')[0]
+			strip_depend_info(self.optdepends)
 
 	def process(self):
 		"""
-- 
1.7.1



More information about the arch-dev-public mailing list