diff mbox

RFA: speeding up dg-extract-results.sh

Message ID E2115262-E3CE-4043-9C72-7F89B182FA0B@comcast.net
State New
Headers show

Commit Message

Mike Stump May 24, 2014, 5:14 p.m. UTC
On May 24, 2014, at 4:17 AM, Bernd Schmidt <bernds_cb1@t-online.de> wrote:
> On 02/13/2014 10:18 AM, Richard Sandiford wrote:
>> contrib/
>> 	* dg-extract-results.py: New file.
>> 	* dg-extract-results.sh: Use it if the environment seems suitable.
> 
> I'm now seeing the following:
> 
> Traceback (most recent call last):
>  File "../../git/gcc/../contrib/dg-extract-results.py", line 581, in <module>
>    Prog().main()
>  File "../../git/gcc/../contrib/dg-extract-results.py", line 569, in main
>    self.output_tool (self.runs[name])
>  File "../../git/gcc/../contrib/dg-extract-results.py", line 534, in output_tool
>    self.output_variation (tool, variation)
>  File "../../git/gcc/../contrib/dg-extract-results.py", line 483, in output_variation
>    for harness in sorted (variation.harnesses.values()):
> TypeError: unorderable types: HarnessRun() < HarnessRun()
> 
> $ /usr/bin/python --version
> Python 3.3.3

Seems unfortunate…  I’d put in a, if on 3.3 or later, don’t use line until a python person can address it.

Can you try something like the below and see if it works better for you…  If it does, I’d approve it, if you would like to put it in.

Comments

Trevor Saunders May 24, 2014, 5:54 p.m. UTC | #1
On Sat, May 24, 2014 at 10:14:54AM -0700, Mike Stump wrote:
> On May 24, 2014, at 4:17 AM, Bernd Schmidt <bernds_cb1@t-online.de> wrote:
> > On 02/13/2014 10:18 AM, Richard Sandiford wrote:
> >> contrib/
> >> 	* dg-extract-results.py: New file.
> >> 	* dg-extract-results.sh: Use it if the environment seems suitable.
> > 
> > I'm now seeing the following:
> > 
> > Traceback (most recent call last):
> >  File "../../git/gcc/../contrib/dg-extract-results.py", line 581, in <module>
> >    Prog().main()
> >  File "../../git/gcc/../contrib/dg-extract-results.py", line 569, in main
> >    self.output_tool (self.runs[name])
> >  File "../../git/gcc/../contrib/dg-extract-results.py", line 534, in output_tool
> >    self.output_variation (tool, variation)
> >  File "../../git/gcc/../contrib/dg-extract-results.py", line 483, in output_variation
> >    for harness in sorted (variation.harnesses.values()):
> > TypeError: unorderable types: HarnessRun() < HarnessRun()
> > 
> > $ /usr/bin/python --version
> > Python 3.3.3
> 
> Seems unfortunate…  I’d put in a, if on 3.3 or later, don’t use line until a python person can address it.

it looks like __cmp__ which the named class implements doesn't work in
python3, and instead you get to implement __eq__, __ne__, __gt__,
__ge__, __lt__, and __le__ or whatever subset of those is enough to make
sorted happy.

Trev

> 
> Can you try something like the below and see if it works better for you…  If it does, I’d approve it, if you would like to put it in.
> 
> Index: dg-extract-results.sh
> ===================================================================
> --- dg-extract-results.sh	(revision 210894)
> +++ dg-extract-results.sh	(working copy)
> @@ -32,7 +32,7 @@ PROGNAME=dg-extract-results.sh
>  PYTHON_VER=`echo "$0" | sed 's/sh$/py/'`
>  if test "$PYTHON_VER" != "$0" &&
>     test -f "$PYTHON_VER" &&
> -   python -c 'import sys; sys.exit (0 if sys.version_info >= (2, 6) else 1)' \
> +   python -c 'import sys; sys.exit (0 if sys.version_info >= (2, 6) and sys.version_info < (3, 3) else 1)' \
>       > /dev/null 2> /dev/null; then
>    exec python $PYTHON_VER "$@"
>  fi
diff mbox

Patch

Index: dg-extract-results.sh
===================================================================
--- dg-extract-results.sh	(revision 210894)
+++ dg-extract-results.sh	(working copy)
@@ -32,7 +32,7 @@  PROGNAME=dg-extract-results.sh
 PYTHON_VER=`echo "$0" | sed 's/sh$/py/'`
 if test "$PYTHON_VER" != "$0" &&
    test -f "$PYTHON_VER" &&
-   python -c 'import sys; sys.exit (0 if sys.version_info >= (2, 6) else 1)' \
+   python -c 'import sys; sys.exit (0 if sys.version_info >= (2, 6) and sys.version_info < (3, 3) else 1)' \
      > /dev/null 2> /dev/null; then
   exec python $PYTHON_VER "$@"
 fi