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 [thread overview]
Message-ID: <1387430286-30467-1-git-send-email-antarus@gentoo.org> (raw)
From: Alec Warner <antarus@gentoo.org>
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
next reply other threads:[~2013-12-19 5:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-19 5:18 antarus [this message]
2013-12-19 6:39 ` [gentoo-catalyst] [PATCH] The string module is deprecated, stop using it W. Trevor King
2013-12-19 7:05 ` Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387430286-30467-1-git-send-email-antarus@gentoo.org \
--to=antarus@gentoo.org \
--cc=gentoo-catalyst@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox