All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] Cannot infer Python version: when no /usr/bin/python symlink is found (resend)
@ 2021-10-29 19:06 Luis Chamberlain
  2021-10-29 20:16 ` Julia Lawall
  2021-11-05 19:21 ` Thierry Martinez
  0 siblings, 2 replies; 4+ messages in thread
From: Luis Chamberlain @ 2021-10-29 19:06 UTC (permalink / raw)
  To: cocci; +Cc: Luis Chamberlain

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [cocci] Cannot infer Python version: when no /usr/bin/python symlink is found (resend)
  2021-10-29 19:06 [cocci] Cannot infer Python version: when no /usr/bin/python symlink is found (resend) Luis Chamberlain
@ 2021-10-29 20:16 ` Julia Lawall
  2021-11-05 19:21 ` Thierry Martinez
  1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2021-10-29 20:16 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: cocci



On Fri, 29 Oct 2021, Luis Chamberlain wrote:

> 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.

Thanks for the report.

julia

>
> [0] https://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html#s-interpreter
>
>   Luis
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [cocci] Cannot infer Python version: when no /usr/bin/python symlink is found (resend)
  2021-10-29 19:06 [cocci] Cannot infer Python version: when no /usr/bin/python symlink is found (resend) Luis Chamberlain
  2021-10-29 20:16 ` Julia Lawall
@ 2021-11-05 19:21 ` Thierry Martinez
  2021-11-05 21:54   ` Luis Chamberlain
  1 sibling, 1 reply; 4+ messages in thread
From: Thierry Martinez @ 2021-11-05 19:21 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: cocci

Luis Chamberlain:
> 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
EOF

Cheers.
-- 
Thierry.

Luis Chamberlain :
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [cocci] Cannot infer Python version: when no /usr/bin/python symlink is found (resend)
  2021-11-05 19:21 ` Thierry Martinez
@ 2021-11-05 21:54   ` Luis Chamberlain
  0 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2021-11-05 21:54 UTC (permalink / raw)
  To: Thierry Martinez; +Cc: cocci

On Fri, Nov 05, 2021 at 08:21:37PM +0100, Thierry Martinez wrote:
> Luis Chamberlain:
> > 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?

Odd, I can't reproduce now, but I was before.

  Luis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-05 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-29 19:06 [cocci] Cannot infer Python version: when no /usr/bin/python symlink is found (resend) Luis Chamberlain
2021-10-29 20:16 ` Julia Lawall
2021-11-05 19:21 ` Thierry Martinez
2021-11-05 21:54   ` Luis Chamberlain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.