This is an archive of the discontinued LLVM Phabricator instance.

libclc: Use find_package to find Python 3 and require it
ClosedPublic

Authored by aaronpuchert on Sep 26 2020, 2:23 PM.

Details

Summary

The script's shebang wants Python 3, so we use FindPython3. The
original code didn't work when an unversioned python was not available.
This is explicitly allowed in PEP 394. ("Distributors may choose to set
the behavior of the python command as follows: python2, python3, not
provide python command, allow python to be configurable by an end user
or a system administrator.")

Also I think it's actually required, so let the configuration fail if we
can't find it.

Lastly remove the shebang, since the script is only run via interpreter
and doesn't have the executable bit set anyway.

Diff Detail

Event Timeline

aaronpuchert created this revision.Sep 26 2020, 2:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 26 2020, 2:23 PM
aaronpuchert requested review of this revision.Sep 26 2020, 2:23 PM

I think this should use FindPython3 and drop the shebang from gen_convert.py to fix the 2 vs. 3 issues as well.

Use FindPython3 and remove shebang. The script didn't have an executable bit anyway.

aaronpuchert retitled this revision from libclc: Use find_package to find python and require it to libclc: Use find_package to find Python 3 and require it.Sep 30 2020, 2:02 PM
aaronpuchert edited the summary of this revision. (Show Details)
jvesely accepted this revision.Oct 1 2020, 8:19 AM

LGTM

This revision is now accepted and ready to land.Oct 1 2020, 8:19 AM