Bug 1342507 - starcal: starcal requires both Python 2 and Python 3
Summary: starcal: starcal requires both Python 2 and Python 3
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: starcal
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Hedayat Vatankhah
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3 PYTHON3-PYTHON2
TreeView+ depends on / blocked
 
Reported: 2016-06-03 11:57 UTC by Tomas Orsava
Modified: 2016-06-06 18:57 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-04 21:00:35 UTC


Attachments (Terms of Use)

Description Tomas Orsava 2016-06-03 11:57:19 UTC
The starcal RPM requires both Python 2 and Python 3.

Except in very special circumstances, there is no need for one package
to drag in both Python stacks. Usually, this is a packaging error: for
example, a stray "/usr/bin/python" shebang in a Python 3 package can
introduce a Python 2 dependency.

Please split your package, or remove the stray dependencies.
There is a section on shebangs in the Python RPM Porting Guide [0]
which covers this issue.

It's ok to do this in Rawhide only, however, it would be greatly
appreciated if you could push it to Fedora 24 as well.


If anything is unclear, or if you need any kind of assistance, you can
ask on IRC (#fedora-python on Freenode), or reply here. We'll be happy
to help investigating or fixing this issue!


[0] http://python-rpm-porting.readthedocs.io/en/latest/application-modules.html#are-shebangs-dragging-you-down-to-python-2

Comment 1 Hedayat Vatankhah 2016-06-04 21:00:35 UTC
Thanks, fixed. 
BTW, the shebang fix commands in the given link are incorrect and need a few changes to work correctly:

find -type f -exec sed -i '1s=^#!/usr/bin/\(python\|env python.*\)$=#!%{__python3}=' {} \;

Comment 2 Tomas Orsava 2016-06-06 13:24:03 UTC
Hi Hedayat!

Thank you very much for the heads up! The %{__python3} macro was a later addition, so I did not notice the clash with my favourite separator—the underscore. It should be fixed now!

The linu thus should be:

find -type f -executable -exec sed -i '1s=^#!/usr/bin/\(python\|env python\)=#!%{__python3}=' {} +

Notice it's a bit different than the one you posted, because this one works also with e.g. the shebang `#!/usr/bin/python --some-flag`, which is important. Your sed line only allows for flags following `/usr/bin/env python` as you put the `.*` inside it's branch.

Thanks again for the bug report!

Comment 3 Hedayat Vatankhah 2016-06-06 14:30:18 UTC
Hi & thank you for the description.
However, there is a problem with your version too: it modifies the following shebangs too:

/usr/bin/env python3
/usr/bin/python3

to
/usr/bin/env python33
/usr/bin/python33

so you should exclude the cases where python is followed by 3! :)

Comment 4 Tomas Orsava 2016-06-06 15:02:26 UTC
Ah, good point! How about this?

find -type f -exec sed -i '1s=^#!/usr/bin/\(python\|env python\)[23]\?=#!%{__python3}=' {} +

That should work every time!

Comment 5 Hedayat Vatankhah 2016-06-06 18:57:33 UTC
Yes, it looks great :)


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