Bug 1342507

Summary: starcal: starcal requires both Python 2 and Python 3
Product: [Fedora] Fedora Reporter: Tomas Orsava <torsava>
Component: starcalAssignee: Hedayat Vatankhah <hedayatv>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: hedayatv
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-04 21:00:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1285816, 1340802    

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 :)