Python shebang

70 views
Skip to first unread message

Bertrand Chenal

unread,
Jan 13, 2011, 6:00:41 PM1/13/11
to tryto...@googlegroups.com

Hi,


Currently, the shebang on top of bin/trytond and bin/tryton is

#!/usr/bin/env python

I propose to use

#!/usr/bin/env python2

instead, because trytond does not work with python3 and so raise an
exception if python3 is the default (like in archlinux). I checked on
ubuntu 10.04 and python2 exist, but I don't know if it's the same on
other distribution.

Cheers,

--

Bertrand Chenal

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: bertran...@b2ck.com
Website: http://www.b2ck.com/

Tobias Paepke

unread,
Jan 13, 2011, 6:12:02 PM1/13/11
to tryto...@googlegroups.com
On 14.01.2011 00:00, Bertrand Chenal wrote:
> Hi,
>
>
> Currently, the shebang on top of bin/trytond and bin/tryton is
>
> #!/usr/bin/env python
>
> I propose to use
>
> #!/usr/bin/env python2
>
> instead, because trytond does not work with python3 and so raise an
> exception if python3 is the default (like in archlinux). I checked on
> ubuntu 10.04 and python2 exist, but I don't know if it's the same on
> other distribution.
-1

doesn't exist on upcomming debian squeeze.

greets

tobias

Phillip Heller

unread,
Jan 13, 2011, 6:20:21 PM1/13/11
to tryto...@googlegroups.com
I believe that distutils will rewrite the shebang to absolute path of the interpreter used to invoke setup.py, unless it is overridden in some manner (i.e., "python ./setup.py build --executable=path/to/python )

I personally feel this is the proper way to set the interpreter. And, for the record, a python2 symlink is not installed by either MacPorts python builds or Apple's distribution.

Raising an exception when invoked by Python 3 is certainly reasonable, though.

--phil

> --
> tryto...@googlegroups.com mailing list

Cédric Krier

unread,
Jan 14, 2011, 3:47:32 AM1/14/11
to tryto...@googlegroups.com
On 13/01/11 18:20 -0500, Phillip Heller wrote:
> I believe that distutils will rewrite the shebang to absolute path of the interpreter used to invoke setup.py, unless it is overridden in some manner (i.e., "python ./setup.py build --executable=path/to/python )

Yes, you are right. It works when you install tryton{,d} with the setuptools.

--
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59

Email/Jabber: cedric...@b2ck.com
Website: http://www.b2ck.com/

Nicolas Évrard

unread,
Jan 15, 2011, 3:55:52 AM1/15/11
to tryto...@googlegroups.com
* Phillip Heller [2011-01-14 00:20 +0100]:

>Raising an exception when invoked by Python 3 is certainly reasonable, though.

I second that. But on the other side since psycopg, lxml and genshi
has been ported to python 3 (the genshi patches are waiting for their
inclusion on trunk though) I don't see major hurdles to port tryton
on python 3 but I might be wrong.

Cédric Krier

unread,
Jan 15, 2011, 5:10:59 AM1/15/11
to tryto...@googlegroups.com

I think it is still a little bit too early.
We should wait that every major distributions got Python 3 and modules before
switching.
Because I think we can not manage to maintain 2 version of Tryton, so it will
be a one shot switch and we must be sure it will go without issue.

--
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59

Nicolas Évrard

unread,
Jan 15, 2011, 11:07:38 AM1/15/11
to tryto...@googlegroups.com
* Cᅵdric Krier [2011-01-15 11:10 +0100]:
>On 15/01/11 09:55 +0100, Nicolas ᅵvrard wrote:
>> * Phillip Heller [2011-01-14 00:20 +0100]:
>>
>> >Raising an exception when invoked by Python 3 is certainly
>> >reasonable, though.
>>
>> I second that. But on the other side since psycopg, lxml and genshi
>> has been ported to python 3 (the genshi patches are waiting for their
>> inclusion on trunk though) I don't see major hurdles to port tryton
>> on python 3 but I might be wrong.
>
>I think it is still a little bit too early.
>We should wait that every major distributions got Python 3 and
>modules before switching.
>Because I think we can not manage to maintain 2 version of Tryton, so
>it will be a one shot switch and we must be sure it will go without
>issue.

I am not sure about that.

If people want to run tryton under python 3 (either because they
compile all the necessary modules by themselves or because their
distribution has done this work for them) we should not prevent them
to do so (provided the amount of work is manageable of course).

Just a message "Yes tryton can run under python 3" seems enough for
me, after that it is the job of the distribution to make a choice
which version (or both if possible) to distribute.

Cédric Krier

unread,
Jan 15, 2011, 11:42:28 AM1/15/11
to tryto...@googlegroups.com
On 15/01/11 17:07 +0100, Nicolas Évrard wrote:
> * Cédric Krier [2011-01-15 11:10 +0100]:

But you can not have the same code running for Python 2 and Python 3 if I'm
right.
We don't force anybody to run on a specific Python version (except that we are
compatible with Python > 2.5).

Cédric Krier

unread,
Jan 16, 2011, 5:56:55 AM1/16/11
to tryto...@googlegroups.com


Here is a post from Guido van Rossum about how to migrate from 2 to 3:

http://www.artima.com/weblogs/viewpost.jsp?thread=208549

So the first step is to go for Python 2.6, which means that we must fix this
issue [1].
After that we must fix Tryton to run without Py3k warnings.
And when we will got a 2t03 working convertion, we could release separate
packages for 2 and 3.


[1] http://bugs.tryton.org/roundup/issue1350

Reply all
Reply to author
Forward
0 new messages