Cannot infer Python version: when no /usr/bin/python symlink is found (resend)
Debian and OpenSUSE Tumblweed no longer have the /usr/bin/python symlink, at least this is explained and spelled out on the Debian Python Policy [0]. This guideline specifically requests that scripts do not use /usr/bin/env, do not use /usr/bin/python and instead use the exact version desired.
When running coccinelle on a system without this /usr/bin/python symlink Coccinelle will complain when using a python script on a cocci file:
Cannot infer Python version
Fixing this is just to create the symlink, but I *really* don't want to do that. And so I think we may need to support:
script:python3
initialize:python3
Maybe it makes sense then to always look for python2 if a version is not specified, and if that does not exist look for python3 as new systems may not have python2.
[0] https://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html#s-interpreter
Luis
Quoted 15 lines · Luis Chamberlain
Debian and OpenSUSE Tumblweed no longer have the
/usr/bin/pythonsymlink, at least this is explained and spelled out on the Debian Python Policy [0]. This guideline specifically requests that scripts do not use/usr/bin/env, do not use/usr/bin/pythonand instead use the exact version desired.When running coccinelle on a system without this
/usr/bin/pythonsymlink Coccinelle will complain when using a python script on a cocci file:Cannot infer Python version
Fixing this is just to create the symlink, but I *really* don't want to do that. And so I think we may need to support:
Quoted 6 lines
script:python3
initialize:python3Maybe it makes sense then to always look for python2 if a version is not specified, and if that does not exist look for python3 as new systems may not have python2.
Thanks for the report.
julia
Quoted 5 lines
[0] https://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html#s-interpreter
Luis
Luis Chamberlain:
Quoted 1 line
Cannot infer Python version
I was not able to reproduce this error: are you sure that it is due to a missing /usr/bin/python symlink? This error message should appear when libpython3-dev is missing (and I have to admit we should change for a better error message!).
For instance, the following Dockerfile succeeds
$ cat >Dockerfile <<EOF
FROM debian:latest
RUN apt-get update
RUN apt-get install --yes ocaml ocaml-findlib libpython3-dev curl autoconf \
automake make
RUN curl --remote-name --location \
https://gitlab.inria.fr/coccinelle/coccinelle/-/archive/1.1.1/coccinelle-1.1.1.tar.bz2
RUN tar --extract --file coccinelle-1.1.1.tar.bz2
WORKDIR coccinelle-1.1.1
RUN autoreconf
RUN ./configure
RUN make
RUN cd tests && \
../spatch.opt --sp-file countcalls_python.cocci countcalls_python.c
RUN test ! -f /usr/bin/python
EOFCheers.
Signature · 3 lines
Thierry. Luis Chamberlain :
Quoted 25 lines
Debian and OpenSUSE Tumblweed no longer have the
/usr/bin/pythonsymlink, at least this is explained and spelled out on the Debian Python Policy [0]. This guideline specifically requests that scripts do not use/usr/bin/env, do not use/usr/bin/pythonand instead use the exact version desired.When running coccinelle on a system without this
/usr/bin/pythonsymlink Coccinelle will complain when using a python script on a cocci file:Cannot infer Python version
Fixing this is just to create the symlink, but I *really* don't want to do that. And so I think we may need to support:
script:python3
initialize:python3Maybe it makes sense then to always look for python2 if a version is not specified, and if that does not exist look for python3 as new systems may not have python2.
[0] https://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html#s-interpreter
Luis
Quoted 5 lines · Thierry Martinez
Luis Chamberlain:
Quoted 1 line
Cannot infer Python version
I was not able to reproduce this error: are you sure that it is due to a missing
/usr/bin/pythonsymlink?
Odd, I can't reproduce now, but I was before.
Luis