AW: [PATCH 5 of 7] setup: support executing with python3 including 2to3
Sabina und Simon Heimberg
s.heimberg at bluewin.ch
Fri Nov 11 18:06:39 CST 2011
> Mads Kiilerich wrote, On 9.11.2011 00:07
>
> Simon Heimberg wrote, On 11/08/2011 11:36 PM:
> > # HG changeset patch
> > # User Simon Heimberg<simohe at besonet.ch> # Date 1313933023 -7200 #
> > Node ID 52ba1200de770ab5bb2c600f03ee9eca4a77ac4c
> > # Parent 287a7c88281cbe54abb385305ba188afdaa8e1fe
> > setup: support executing with python3 including 2to3
> >
Snip
> >
> > if isironpython:
> > - print "warning: IronPython detected (no bz2 support)"
> > + # print statement is not compatible to python3
> > + eval('print "warning: IronPython detected (no bz2 support)"',
> {})
>
> Wouldn't
>
> print("warning: IronPython detected (no bz2 support)")
>
> work everywhere?
>
Nice trick. I did not know.
But I will probably write to stderr as mg suggests. A new patch will follow.
<snip>
> > @@ -68,6 +69,18 @@
> > from distutils.sysconfig import get_python_inc
> > from distutils.version import StrictVersion
> >
> > +convert2to3 = '--c2to3' in sys.argv
> > +if convert2to3:
> > + try:
> > + from distutils.command.build_py import build_py_2to3 as
> build_py
> > + from lib2to3.refactor import get_fixers_from_package as
> getfixers
> > + except ImportError:
> > + if sys.version_info[0]< 3:
> > + raise SystemExit("--c2to3 is only compatible with
> python3.")
> > + raise
> > + sys.path.append('contrib')
>
> Shouldn't we also fail badly if python3 is used without --c2to3?
Probably. This is kind of a new behavior and I only tried to merge. But
setup.py was not executable with python3 anyway.
We could also warn only or enable it automatically. What is best? (Probably not automatically.)
I will send this in a separate patch probably.
> /Mads
Greetings,
Simon
(Sorry Mads once again...)
More information about the Mercurial-devel
mailing list