From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id ADD1C138247 for ; Thu, 19 Dec 2013 05:17:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 911A2E09CD; Thu, 19 Dec 2013 05:17:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 31E24E09CD for ; Thu, 19 Dec 2013 05:17:45 +0000 (UTC) Received: by smtp.gentoo.org (Postfix, from userid 2097) id 841B433F5F2; Thu, 19 Dec 2013 05:17:44 +0000 (UTC) From: antarus@gentoo.org To: gentoo-catalyst@lists.gentoo.org Subject: [gentoo-catalyst] [PATCH] The string module is deprecated, stop using it. Date: Wed, 18 Dec 2013 21:18:06 -0800 Message-Id: <1387430286-30467-1-git-send-email-antarus@gentoo.org> X-Mailer: git-send-email 1.8.1.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Archives-Salt: de6f3e76-c312-4a50-93a7-aab57530787f X-Archives-Hash: cfcf00d06480a72d3b15bdf1c674c5e8 From: Alec Warner Also the old code called string.split() on the same input a dozen times. Just split the string once (its immutable). We can re-use the result for all the checking. TESTS=I ran catalyst -f examples/stage4_template.spec and it didn't until it was supposed to. --- catalyst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/catalyst b/catalyst index 4ea4248..edc0b24 100755 --- a/catalyst +++ b/catalyst @@ -10,7 +10,6 @@ import os import sys import imp -import string import getopt import pdb import os.path @@ -116,12 +115,13 @@ def parse_config(myconfig): print "Setting",x,"to default value \""+confdefaults[x]+"\"" conf_values[x]=confdefaults[x] + options = conf_values["options"].split() # parse out the rest of the options from the config file - if "autoresume" in string.split(conf_values["options"]): + if "autoresume" in options: print "Autoresuming support enabled." conf_values["AUTORESUME"]="1" - if "bindist" in string.split(conf_values["options"]): + if "bindist" in options: print "Binary redistribution enabled" conf_values["BINDIST"]="1" else: @@ -129,43 +129,43 @@ def parse_config(myconfig): print "Binary redistribution of generated stages/isos may be prohibited by law." print "Please see the use description for bindist on any package you are including." - if "ccache" in string.split(conf_values["options"]): + if "ccache" in options: print "Compiler cache support enabled." conf_values["CCACHE"]="1" - if "clear-autoresume" in string.split(conf_values["options"]): + if "clear-autoresume" in options: print "Cleaning autoresume flags support enabled." conf_values["CLEAR_AUTORESUME"]="1" - if "distcc" in string.split(conf_values["options"]): + if "distcc" in options: print "Distcc support enabled." conf_values["DISTCC"]="1" - if "icecream" in string.split(conf_values["options"]): + if "icecream" in options: print "Icecream compiler cluster support enabled." conf_values["ICECREAM"]="1" - if "kerncache" in string.split(conf_values["options"]): + if "kerncache" in options: print "Kernel cache support enabled." conf_values["KERNCACHE"]="1" - if "pkgcache" in string.split(conf_values["options"]): + if "pkgcache" in options: print "Package cache support enabled." conf_values["PKGCACHE"]="1" - if "preserve_libs" in string.split(conf_values["options"]): + if "preserve_libs" in options: print "Preserving libs during unmerge." conf_values["PRESERVE_LIBS"]="1" - if "purge" in string.split(conf_values["options"]): + if "purge" in options: print "Purge support enabled." conf_values["PURGE"]="1" - if "seedcache" in string.split(conf_values["options"]): + if "seedcache" in options: print "Seed cache support enabled." conf_values["SEEDCACHE"]="1" - if "snapcache" in string.split(conf_values["options"]): + if "snapcache" in options: print "Snapshot cache support enabled." conf_values["SNAPCACHE"]="1" -- 1.8.1.2