Python conflicting with other python when installed from
packages
John Hein
jhein at symmetricom.com
Tue Jun 5 20:06:55 UTC 2012
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.
More information about the freebsd-python
mailing list