This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Handle script shbang options
Type: Stage: resolved
Components: Distutils Versions: Python 3.6, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: dstufft, eric.araujo, hroncok, opoplawski, serhiy.storchaka, steve.dower, vstinner
Priority: normal Keywords:

Created on 2016-05-11 19:39 by opoplawski, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg265343 - (view) Author: Orion Poplawski (opoplawski) Date: 2016-05-11 19:39
Fedora would like to enforce that python scripts installed into /usr/bin use the "-s" option.  We have tried to enforce this by doing:

python setup.py build --executable '/usr/bin/python2 -s'

However, as reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1335203

this breaks scripts that already have options in them as the options are tacked onto the end, e.g.:

#!/usr/bin/python2 -s -E

Which linux doesn't handle.

It seems we have a couple options:

- Replace the entire shbang line with the argument to --executable
- Try to merge options into a single one (-sE)
- Have a separate option, say --executable-args to specify the options.  Although the question still remains as to whether or not to replace the existing option or append.
msg265344 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-11 19:47
Yet one option:

- Add a wrapper /usr/bin/python2-s and pass it to to --executable.

$ cat /usr/bin/python2-s
#!/bin/sh
exec /usr/bin/python2 -s "$@"
msg331448 - (view) Author: Miro Hrončok (hroncok) * Date: 2018-12-09 19:49
As a distro Python maintainer, I have to say that having yet another Python executable would no be accepted well by the other distro contributors or even users.

I'll try to work on a proper solution that would merge the options, hopefully soon (but most likely not before the end of the year).
msg386315 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:16
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:58:30adminsetgithub: 71191
2021-02-03 18:16:28steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386315

resolution: out of date
stage: resolved
2018-12-10 13:10:48vstinnersetnosy: + vstinner
2018-12-09 19:49:38hroncoksetnosy: + hroncok
messages: + msg331448
2016-05-11 19:47:25serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg265344
2016-05-11 19:39:10opoplawskicreate