Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1542436 - python3-django requires Python 2
Summary: python3-django requires Python 2
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-django
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthias Runge
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3-PYTHON2
TreeView+ depends on / blocked
 
Reported: 2018-02-06 11:13 UTC by Iryna Shcherbina
Modified: 2018-02-07 17:57 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-07 11:32:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Iryna Shcherbina 2018-02-06 11:13:12 UTC
After the latest update python3-django RPM started to require Python 2:

$ dnf repoquery --disablerepo=* --enablerepo=rawhide --requires python3-django
/usr/bin/python2
/usr/bin/python3
python(abi) = 3.6
python-django-bash-completion = 2.0.2-1.fc28
python3-pytz

Apparently the shebangs in the following 2 files were mangled from /usr/bin/env python to /usr/bin/python2:

$ grep -r usr/bin/python2
usr/lib/python3.6/site-packages/django/conf/project_template/manage.py-tpl:#!/usr/bin/python2
usr/lib/python3.6/site-packages/django/bin/django-admin.py:#!/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?

Comment 1 Miro Hrončok 2018-02-06 16:30:58 UTC
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:

 * .../site-packages/django/bin/django-admin.py

This should be changed to `/usr/bin/python3` if needed, or removed and `chmod -x`, if not actually needed.


 * .../site-packages/django/conf/project_template/manage.py-tpl

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.

Comment 2 Matthias Runge 2018-02-07 11:32:34 UTC
thanks for the heads-up. It is fixed in 2.0.2-2

Comment 3 Vít Ondruch 2018-02-07 11:41:24 UTC
The shebang is mangled only in executable files. Does the template file need to have executable bit set?

Comment 4 Matthias Runge 2018-02-07 12:03:20 UTC
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.

Comment 5 Miro Hrončok 2018-02-07 17:57:59 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.