On Wed, Jul 22, 2020 at 3:41 AM Thomas Kluyver <tho...@kluyver.me.uk> wrote:
>
> On Tue, 21 Jul 2020, at 21:50, David Mathog wrote:
> > ./lib/python3.6/site-packages/pip/_vendor/appdirs.py:#!/usr/bin/env python
>
> Python packaging tools like pip generally differentiate between *scripts*, 
> which are installed to be run from the command line, and *modules*, which are 
> imported from other Python code. Files under site-packages are modules. Any 
> special handling for shebangs, execute bits, or Windows .exe wrappers is 
> usually done only for scripts.
>
> It's not unusual to see a shebang in modules - I think some editors put it in 
> whenever you create a new Python file. But it doesn't usually do anything. If 
> you want to run a module directly, the normal way now is with "python -m", 
> which doesn't use the shebang.

So in summary:

1.  Invalid shebangs for modules in site-packages "should" be harmless - ignore
them and hope for the best.

2.  Shebangs for scripts "should" be correct.  (They are while still
inside a venv,
but that shebang has to be corrected when the installation is moved to a normal
environment, which my code is doing now.)

Scripts usually end up in a "bin" directory on linux.  Is that part of
the installation standard or could a package put them in an arbitrary
path (other than under "site-packages") under the venv's root, for
instance in a directory named "scripts"?   Fixing the shebangs by
processing only "bin" is easy, traversing the entire tree is a bit
messier.  It would be good not to have to do so if that will never
find an invalid shebang.

Thanks,

David Mathog


Thanks,
>
> Thomas
> --
> Distutils-SIG mailing list -- distutils-sig@python.org
> To unsubscribe send an email to distutils-sig-le...@python.org
> https://mail.python.org/mailman3/lists/distutils-sig.python.org/
> Message archived at 
> https://mail.python.org/archives/list/distutils-sig@python.org/message/HPTRB3S55WNAOUEHLQTWD2QDG5BL3HM6/
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/archives/list/distutils-sig@python.org/message/UL3LLIEDEG34ZNAUAXWI5KJHKU2NS3O6/

Reply via email to