From: Alec Warner <[email protected]>
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