Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jun 2012 14:06:08 -0600
From:      John Hein <jhein@symmetricom.com>
To:        Ruslan Mahmatkhanov <cvs-src@yandex.ru>
Cc:        Baptiste Daroussin <bapt@FreeBSD.org>, python@FreeBSD.org
Subject:   Re: Python conflicting with other python when installed from packages
Message-ID:  <20430.26288.949943.612255@gromit.timing.com>
In-Reply-To: <4FCE4514.1020901@yandex.ru>
References:  <20120605120755.GA71005@ithaqua.etoilebsd.net> <4FCDF80F.3070304@yandex.ru> <20430.15706.546137.332233@gromit.timing.com> <4FCE4514.1020901@yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Ruslan Mahmatkhanov wrote at 21:42 +0400 on Jun  5, 2012:
 > John Hein wrote on 05.06.2012 21:09:
 > > Ruslan Mahmatkhanov wrote at 16:14 +0400 on Jun  5, 2012:
 > >   >  Packages that using 2to3 to convert their code on install to be python3
 > >   >  compatible looking exactly for `2to3' executable. So such a modification
 > >   >  would require modifying all the setup.py's according the python version
 > >   >  user has installed as default. It's just a though. I didn't see how to
 > >   >  resolve this correctly.
 > >
 > > One way: pull out 2to3 to its own separate port and have those
 > > ports that need it specify the dependency.  And, no, I don't
 > > have patches.
 >
 > Well, then we'll get separate 2to3 ports that is conflicting :). I'm not
 > sure that 2to3 is the same in all python distributions.

It was my understanding that you should be able to use
lib/pythonXXX/lib2to3 from any recent python distribution (2.x or 3.x)
interchangeably.  A quick glance at a diff between lib2to3 on
2.7 and 3.2 seems to confirm that.  Corrections welcome.

I doubt the few ports that explicitly rely on 2to3 (sorry, I have not
fully audited the ports to figure out which ports do, but I expect
it's a small number, possibly 0 [1]) care whether XXX is 2.7 or 3.2.

If my assertion is correct, the proposed 2to3 port would just contain
one file:

% cat /usr/local/bin/2to3
#!/usr/bin/env python
import sys
from lib2to3.main import main

sys.exit(main("lib2to3.fixes"))

(where this is the only difference between old and new:

--- 2to3.orig   2012-06-05 12:44:17.000000000 -0600
+++ 2to3        2012-06-05 12:44:30.000000000 -0600
@@ -1,4 +1,4 @@
-#!/usr/local/bin/python2.7
+#!/usr/bin/env python
 import sys
 from lib2to3.main import main
 


And the 2to3 port would have a (run) dependency on python (any
installed version will do).


[1] py-sqlalchemy is one, sort of.  It has a script that imports lib2to3
directly instead of invoking 2to3.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20430.26288.949943.612255>