* [PATCH RESEND] diffconfig: Update script to support python versions 2.5 through 3.3
@ 2013-08-20 18:41 Mike Pagano
2013-08-28 11:57 ` Mike Pagano
0 siblings, 1 reply; 5+ messages in thread
From: Mike Pagano @ 2013-08-20 18:41 UTC (permalink / raw)
To: linux-kbuild
Support past and active versions of python while maintaining backward compatibility.
Script has been tested on python versions up to and including 3.3.X.
---
scripts/diffconfig | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/scripts/diffconfig b/scripts/diffconfig
index 0ee6583..6d67283 100755
--- a/scripts/diffconfig
+++ b/scripts/diffconfig
@@ -10,7 +10,7 @@
import sys, os
def usage():
- print """Usage: diffconfig [-h] [-m] [<config1> <config2>]
+ print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
Diffconfig is a simple utility for comparing two .config files.
Using standard diff to compare .config files often includes extraneous and
@@ -33,7 +33,7 @@ Example usage:
EXT2_FS y -> n
LOG_BUF_SHIFT 14 -> 16
PRINTK_TIME n -> y
-"""
+""")
sys.exit(0)
# returns a dictionary of name/value pairs for config items in the file
@@ -54,23 +54,23 @@ def print_config(op, config, value, new_value):
if merge_style:
if new_value:
if new_value=="n":
- print "# CONFIG_%s is not set" % config
+ print("# CONFIG_%s is not set" % config)
else:
- print "CONFIG_%s=%s" % (config, new_value)
+ print("CONFIG_%s=%s" % (config, new_value))
else:
if op=="-":
- print "-%s %s" % (config, value)
+ print("-%s %s" % (config, value))
elif op=="+":
- print "+%s %s" % (config, new_value)
+ print("+%s %s" % (config, new_value))
else:
- print " %s %s -> %s" % (config, value, new_value)
+ print(" %s %s -> %s" % (config, value, new_value))
def main():
global merge_style
# parse command line args
if ("-h" in sys.argv or "--help" in sys.argv):
- usage()
+ usage()
merge_style = 0
if "-m" in sys.argv:
@@ -79,15 +79,14 @@ def main():
argc = len(sys.argv)
if not (argc==1 or argc == 3):
- print "Error: incorrect number of arguments or unrecognized option"
+ print("Error: incorrect number of arguments or unrecognized option")
usage()
if argc == 1:
# if no filenames given, assume .config and .config.old
build_dir=""
- if os.environ.has_key("KBUILD_OUTPUT"):
+ if "KBUILD_OUTPUT" in os.environ:
build_dir = os.environ["KBUILD_OUTPUT"]+"/"
-
configa_filename = build_dir + ".config.old"
configb_filename = build_dir + ".config"
else:
@@ -95,8 +94,8 @@ def main():
configb_filename = sys.argv[2]
try:
- a = readconfig(file(configa_filename))
- b = readconfig(file(configb_filename))
+ a = readconfig(open(configa_filename))
+ b = readconfig(open(configb_filename))
except (IOError):
e = sys.exc_info()[1]
print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
@@ -126,8 +125,7 @@ def main():
# now print items in b but not in a
# (items from b that were in a were removed above)
- new = b.keys()
- new.sort()
+ new = sorted(b.keys())
for config in new:
print_config("+", config, None, b[config])
--
1.8.1.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] diffconfig: Update script to support python versions 2.5 through 3.3
2013-08-20 18:41 [PATCH RESEND] diffconfig: Update script to support python versions 2.5 through 3.3 Mike Pagano
@ 2013-08-28 11:57 ` Mike Pagano
2013-08-30 14:54 ` Michal Marek
0 siblings, 1 reply; 5+ messages in thread
From: Mike Pagano @ 2013-08-28 11:57 UTC (permalink / raw)
To: linux-kbuild
On Tue, Aug 20, 2013 at 02:41:12PM -0400, Mike Pagano wrote:
> Support past and active versions of python while maintaining backward compatibility.
> Script has been tested on python versions up to and including 3.3.X.
>
> ---
> scripts/diffconfig | 28 +++++++++++++---------------
> 1 file changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/scripts/diffconfig b/scripts/diffconfig
> index 0ee6583..6d67283 100755
> --- a/scripts/diffconfig
> +++ b/scripts/diffconfig
> @@ -10,7 +10,7 @@
> import sys, os
>
> def usage():
> - print """Usage: diffconfig [-h] [-m] [<config1> <config2>]
> + print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
>
> Diffconfig is a simple utility for comparing two .config files.
> Using standard diff to compare .config files often includes extraneous and
> @@ -33,7 +33,7 @@ Example usage:
> EXT2_FS y -> n
> LOG_BUF_SHIFT 14 -> 16
> PRINTK_TIME n -> y
> -"""
> +""")
> sys.exit(0)
>
> # returns a dictionary of name/value pairs for config items in the file
> @@ -54,23 +54,23 @@ def print_config(op, config, value, new_value):
> if merge_style:
> if new_value:
> if new_value=="n":
> - print "# CONFIG_%s is not set" % config
> + print("# CONFIG_%s is not set" % config)
> else:
> - print "CONFIG_%s=%s" % (config, new_value)
> + print("CONFIG_%s=%s" % (config, new_value))
> else:
> if op=="-":
> - print "-%s %s" % (config, value)
> + print("-%s %s" % (config, value))
> elif op=="+":
> - print "+%s %s" % (config, new_value)
> + print("+%s %s" % (config, new_value))
> else:
> - print " %s %s -> %s" % (config, value, new_value)
> + print(" %s %s -> %s" % (config, value, new_value))
>
> def main():
> global merge_style
>
> # parse command line args
> if ("-h" in sys.argv or "--help" in sys.argv):
> - usage()
> + usage()
>
> merge_style = 0
> if "-m" in sys.argv:
> @@ -79,15 +79,14 @@ def main():
>
> argc = len(sys.argv)
> if not (argc==1 or argc == 3):
> - print "Error: incorrect number of arguments or unrecognized option"
> + print("Error: incorrect number of arguments or unrecognized option")
> usage()
>
> if argc == 1:
> # if no filenames given, assume .config and .config.old
> build_dir=""
> - if os.environ.has_key("KBUILD_OUTPUT"):
> + if "KBUILD_OUTPUT" in os.environ:
> build_dir = os.environ["KBUILD_OUTPUT"]+"/"
> -
> configa_filename = build_dir + ".config.old"
> configb_filename = build_dir + ".config"
> else:
> @@ -95,8 +94,8 @@ def main():
> configb_filename = sys.argv[2]
>
> try:
> - a = readconfig(file(configa_filename))
> - b = readconfig(file(configb_filename))
> + a = readconfig(open(configa_filename))
> + b = readconfig(open(configb_filename))
> except (IOError):
> e = sys.exc_info()[1]
> print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
> @@ -126,8 +125,7 @@ def main():
>
> # now print items in b but not in a
> # (items from b that were in a were removed above)
> - new = b.keys()
> - new.sort()
> + new = sorted(b.keys())
> for config in new:
> print_config("+", config, None, b[config])
>
> --
> 1.8.1.5
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Any feedback or thoughts on this patch?
--
Mike Pagano
Gentoo Developer - Kernel Project
Gentoo Sources - Lead
E-Mail : mpagano@gentoo.org
GnuPG FP : EEE2 601D 0763 B60F 848C 9E14 3C33 C650 B576 E4E3
Public Key : http://pgp.mit.edu:11371/pks/lookup?search=0xB576E4E3&op=index
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] diffconfig: Update script to support python versions 2.5 through 3.3
2013-08-28 11:57 ` Mike Pagano
@ 2013-08-30 14:54 ` Michal Marek
2013-08-30 19:41 ` Mike Pagano
0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2013-08-30 14:54 UTC (permalink / raw)
To: Mike Pagano; +Cc: linux-kbuild
On 28.8.2013 13:57, Mike Pagano wrote:
> On Tue, Aug 20, 2013 at 02:41:12PM -0400, Mike Pagano wrote:
>> Support past and active versions of python while maintaining backward compatibility.
>> Script has been tested on python versions up to and including 3.3.X.
>>
>> ---
>> scripts/diffconfig | 28 +++++++++++++---------------
>> 1 file changed, 13 insertions(+), 15 deletions(-)
>>
[...]
>
> Any feedback or thoughts on this patch?
Sorry for the delay. It works great, even with 2.4. You just forgot to
add your signoff, can I add
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
?
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] diffconfig: Update script to support python versions 2.5 through 3.3
2013-08-30 14:54 ` Michal Marek
@ 2013-08-30 19:41 ` Mike Pagano
2013-09-01 19:36 ` Michal Marek
0 siblings, 1 reply; 5+ messages in thread
From: Mike Pagano @ 2013-08-30 19:41 UTC (permalink / raw)
To: Michal Marek; +Cc: linux-kbuild
On Fri, Aug 30, 2013 at 04:54:46PM +0200, Michal Marek wrote:
> On 28.8.2013 13:57, Mike Pagano wrote:
> > On Tue, Aug 20, 2013 at 02:41:12PM -0400, Mike Pagano wrote:
> >> Support past and active versions of python while maintaining backward compatibility.
> > Any feedback or thoughts on this patch?
>
> Sorry for the delay. It works great, even with 2.4. You just forgot to
> add your signoff, can I add
>
> Signed-off-by: Mike Pagano <mpagano@gentoo.org>
>
> ?
>
> Michal
Yes, sorry about that and thanks for taking the time to look at it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] diffconfig: Update script to support python versions 2.5 through 3.3
2013-08-30 19:41 ` Mike Pagano
@ 2013-09-01 19:36 ` Michal Marek
0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2013-09-01 19:36 UTC (permalink / raw)
To: Mike Pagano; +Cc: linux-kbuild
Dne 30.8.2013 21:41, Mike Pagano napsal(a):
> On Fri, Aug 30, 2013 at 04:54:46PM +0200, Michal Marek wrote:
>> On 28.8.2013 13:57, Mike Pagano wrote:
>>> On Tue, Aug 20, 2013 at 02:41:12PM -0400, Mike Pagano wrote:
>>>> Support past and active versions of python while maintaining backward compatibility.
>>> Any feedback or thoughts on this patch?
>>
>> Sorry for the delay. It works great, even with 2.4. You just forgot to
>> add your signoff, can I add
>>
>> Signed-off-by: Mike Pagano <mpagano@gentoo.org>
>>
>> ?
>>
> Yes, sorry about that and thanks for taking the time to look at it.
OK, pushed to kbuild.git#kconfig.
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-09-01 19:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-20 18:41 [PATCH RESEND] diffconfig: Update script to support python versions 2.5 through 3.3 Mike Pagano
2013-08-28 11:57 ` Mike Pagano
2013-08-30 14:54 ` Michal Marek
2013-08-30 19:41 ` Mike Pagano
2013-09-01 19:36 ` Michal Marek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.