[libclc] r200413 - Enforce python2 for systems that use python3 as their default.
Daniel Liew
daniel.liew at imperial.ac.uk
Wed Jan 29 13:32:38 PST 2014
Hi Nico,
> This breaks systems that keep "python" as python2 and don't have a "python2"
> binary, no?
It would totally depend on the distro but in my experience
"/usr/bin/python" and "/usr/bin/python2" are both symbolic links to
the real python executables. So it works fine for many distros that
only have python2.x and do not have python3 as well.
E.g. on Ubuntu 12.04 LTS (Python2 is default)
$ ls /usr/bin/python*
/usr/bin/python /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python-mkdebian
dan at Sputnik:~$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root 9 Jun 18 2013 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root 9 Jun 18 2013 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 2989496 Sep 26 21:29 /usr/bin/python2.7
-rwxr-xr-x 1 root root 14078 Jul 12 2012 /usr/bin/python-mkdebian
and similarly on Fedora 18 (python2 is default)
$ ls -l /usr/bin/python*
lrwxrwxrwx. 1 root root 7 Jan 22 2013 /usr/bin/python -> python2
lrwxrwxrwx. 1 root root 9 Jan 22 2013 /usr/bin/python2 -> python2.7
-rwxr-xr-x. 1 root root 7120 Aug 9 2012 /usr/bin/python2.7
-rwxr-xr-x. 1 root root 1785 Aug 9 2012 /usr/bin/python2.7-config
lrwxrwxrwx. 1 root root 16 Jan 24 2013 /usr/bin/python2-config ->
python2.7-config
lrwxrwxrwx. 1 root root 14 Jan 24 2013 /usr/bin/python-config ->
python2-config
lrwxrwxrwx. 1 root root 3 Aug 1 23:06 /usr/bin/python-pip -> pip
and on something like Arch Linux where Python3 is default (I also have
python2.7 installed along side)
$ ls /usr/bin/python*
lrwxrwxrwx 1 root root 7 Nov 26 16:42 /usr/bin/python -> python3
lrwxrwxrwx 1 root root 9 Nov 26 15:53 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 6224 Nov 26 15:53 /usr/bin/python2.7
-rwxr-xr-x 1 root root 1668 Nov 26 15:53 /usr/bin/python2.7-config
lrwxrwxrwx 1 root root 16 Nov 26 15:53 /usr/bin/python2-config ->
python2.7-config
-rwxr-xr-x 1 root root 94 Aug 22 13:15 /usr/bin/python2-pyuic4
lrwxrwxrwx 1 root root 9 Nov 26 16:42 /usr/bin/python3 -> python3.3
-rwxr-xr-x 2 root root 10384 Nov 26 16:42 /usr/bin/python3.3
lrwxrwxrwx 1 root root 17 Nov 26 16:42 /usr/bin/python3.3-config ->
python3.3m-config
-rwxr-xr-x 2 root root 10384 Nov 26 16:42 /usr/bin/python3.3m
-rwxr-xr-x 1 root root 1972 Nov 26 16:42 /usr/bin/python3.3m-config
lrwxrwxrwx 1 root root 16 Nov 26 16:42 /usr/bin/python3-config ->
python3.3-config
lrwxrwxrwx 1 root root 14 Nov 26 16:42 /usr/bin/python-config ->
python3-config
The patch is fine for the Linux distros that I use but I cannot speak
for everybody. Do you know anyone that uses a (still supported)
distribution that does not provide the python2 symlink? I haven't
talked about OSX at all... I don't use it so I can't test it but I
would be surprised if it didn't work because I've written python
scripts before (with the same shebang) that I know OSX users use.
Thanks,
Dan Liew
More information about the cfe-commits
mailing list