This is an archive of the discontinued LLVM Phabricator instance.

Execute llvm-lit with the python found by CMake by default
ClosedPublic

Authored by arichardson on Jul 27 2020, 2:40 AM.

Details

Summary

The check-* targets run ${Python3_EXECUTABLE} $BUILD/bin/llvm-lit, but
running ./bin/llvm-lit $ARGS from the build directory currently always
uses "python" to run llvm-lit. On most systems this will be python2.7 even
if we found python3 at CMake time.

Diff Detail

Event Timeline

arichardson created this revision.Jul 27 2020, 2:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2020, 2:40 AM
arichardson marked an inline comment as done.Jul 27 2020, 2:41 AM
arichardson added inline comments.
llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
89

I'm not sure about this, since I haven't ever used GN but it seems to match what other files are doing.

compnerd accepted this revision.Jul 27 2020, 3:09 PM

I'm not sure that there is a better way to accomplish this other than the replacement from configure_file.

This revision is now accepted and ready to land.Jul 27 2020, 3:09 PM
This revision was landed with ongoing or failed builds.Aug 3 2020, 2:52 AM
This revision was automatically updated to reflect the committed changes.
thakis added a comment.Sep 4 2020, 7:20 AM

This puts #!/usr/bin/python3.8 instead of #!/usr/bin/env python3.8 in llvm-bulid/bin/llvm-lit (in a cmake build). That seems undesirable?

thakis added a comment.Sep 4 2020, 7:21 AM

(ps: No need to touch files in llvm/utils/gn at all, keeping that code updates is up to folks using the gn build.)

thakis added a comment.Sep 4 2020, 7:24 AM

(I fixed this in the GN build in rGc88a77620436ee475d54d3b5ced30286101e0dc9 and don't care all that much about what happens in the cmake build, so if y'all are happy with what currently happens, it's fine to not change anything here, but it looks strange to me.)

This puts #!/usr/bin/python3.8 instead of #!/usr/bin/env python3.8 in llvm-bulid/bin/llvm-lit (in a cmake build). That seems undesirable?

CMake should give an absolute path for Python3_EXECUTABLE . However, I'm not sure if that is also true if you specify it manually on the command line. I guess the same fix as the GN one would work for CMake.

rnk added a subscriber: rnk.Nov 30 2020, 10:49 AM

This works very badly on Windows. You get:
#!C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python37_64/python.exe

MSys bash doesn't like that shebang line. It works if I say "python bin/llvm-lit.py ...", but who likes to spell things out? I guess I just have to live with it.