After the latest update python3-django RPM started to require Python 2:
$ dnf repoquery --disablerepo=* --enablerepo=rawhide --requires python3-django
python(abi) = 3.6
python-django-bash-completion = 2.0.2-1.fc28
Apparently the shebangs in the following 2 files were mangled from /usr/bin/env python to /usr/bin/python2:
$ grep -r usr/bin/python2
I am not sure if it is correct, maybe shebangs mangling should be disabled in this case, or both scripts should be switched to non-executable?
Disabling the mangler will hide the issue. We should either change the shebangs to python3 or make the files non-executable. With the template file, this might bring problems (as the templating mechanism may just preserve the executable flag instead of setting it directly).
We should treat those two cases separately:
This should be changed to `/usr/bin/python3` if needed, or removed and `chmod -x`, if not actually needed.
This should be `chmod -x` and check whether it doesn't break anything. We should consider pushing this upstream (i.e. do not set executable permission on template file, but instead set it after the template file is copied somewhere).
If this approach is impossible, the mangling should be disabled as a workaround until a path based opt-out is provided. See also bug 1541318.
thanks for the heads-up. It is fixed in 2.0.2-2
The shebang is mangled only in executable files. Does the template file need to have executable bit set?
I can't really say for sure.
The template file is used as a template to be copied in all new generated projects. The template then named manage.py is actually an executable python script.
That's why I'd choose to keep it executable.
Apparently, the template being executable is the only source of information that determines that the target file will be executable as well. Changing this to something else would require a new source of information about the executable flag (the system is used for multiple files, some executable, some not).
See https://github.com/django/django/blob/248fa208cb2c7607fb7a464238fb8ebe62e6a54c/django/core/management/templates.py#L170 and lines around.
I say we keep it executable to stay close to upstream.