This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Resolve Python 2 FIXME
ClosedPublic

Authored by gAlfonso-bit on Aug 8 2021, 8:56 AM.

Details

Summary

We don't use Python 2 anymore, so let us do the recommended fix instead of using the workaround made for Python 2.

Diff Detail

Event Timeline

gAlfonso-bit created this revision.Aug 8 2021, 8:56 AM
gAlfonso-bit requested review of this revision.Aug 8 2021, 8:56 AM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald TranscriptAug 8 2021, 8:56 AM
gAlfonso-bit removed a reviewer: Restricted Project.

Removed all remnants of python 2 support, since python 3.6 and above is now required

Herald added a reviewer: Restricted Project. · View Herald TranscriptAug 8 2021, 9:08 AM
Herald added a subscriber: mgorny. · View Herald Transcript
Mordante added subscribers: ldionne, Mordante.

Thanks for this cleanup! Since we just branched LLVM 13 this looks a good time to do this.
I like to see it pass all builds before approving and I really would like @ldionne's approval as well.

Quuxplusone added a subscriber: Quuxplusone.

Current revision LGTM. I was less thrilled about the proposed diff in libcxx/utils/libcxx/util.py... but it seems to be gone from this latest revision?

gAlfonso-bit updated this revision to Diff 365050.
arichardson requested changes to this revision.Aug 9 2021, 3:06 AM
arichardson added inline comments.
libcxx/utils/libcxx/util.py
218

This code can be simplified with python 3: In our CHERI fork I changed this to use the timeout= parameter in https://github.com/CTSRD-CHERI/llvm-project/commit/824490b545707689e47cb6fc3a94633468c003a4. I was going to clean-up and upstream that once python3 is required but never got around to it.

However, I think we can avoid all of this complexity with Popen+communicate now that we require python 3.6:
We should be able to use subprocess.run (https://docs.python.org/3.6/library/subprocess.html#subprocess.run), translating the TimeoutExpired exception to ExecuteCommandTimeoutException (or just updating all callers).

subprocess.run(command, cwd=cwd, input=input, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) should be sufficient I believe?

This revision now requires changes to proceed.Aug 9 2021, 3:06 AM
ldionne accepted this revision.Sep 3 2021, 12:24 PM

This LGTM with or without the suggested improvements. Ideally we'd make the suggested improvements, but I'll take this patch as-is right now as an improvement over the status quo even without @arichardson's comments.

arichardson accepted this revision.Sep 3 2021, 12:40 PM

I did not intend to add a blocking review. I agree this is an improvement, was just suggesting further simplifications

This revision is now accepted and ready to land.Sep 3 2021, 12:40 PM
jloser added a subscriber: jloser.Sep 3 2021, 1:06 PM
jloser added inline comments.
libcxx/CMakeLists.txt
47

Does this message provide anything useful from just adding REQUIRED argument to the find_package(Python3 COMPONENTS Interpreter) right above?

libcxx/utils/ci/runtimes/CMakeLists.txt
6

Does this message provide anything useful from just adding REQUIRED argument to the find_package(Python3 COMPONENTS Interpreter) right above?

Rebased to main

I do not have commit access. Could someone please land this for me?

xgupta added a subscriber: xgupta.Oct 2 2021, 8:23 PM
xgupta added inline comments.
libcxx/CMakeLists.txt
47

@gAlfonso-bit can you address this comment. so I can commit this patch on your behalf.

gAlfonso-bit added inline comments.Nov 12 2021, 9:10 AM
libcxx/CMakeLists.txt
47

I mean, it tells the user Python 3 will be required. I admit it's a little quick and dirty but this will be expanded upon in future patches.

jloser added inline comments.Nov 12 2021, 9:22 AM
libcxx/CMakeLists.txt
47

I don't think it adds additional value over the error that would be provided by find_package at CMake configure time, but I won't block your review on it - just food for thought.

This comment was removed by gAlfonso-bit.
gAlfonso-bit marked 4 inline comments as done.Nov 12 2021, 10:51 AM
This revision was landed with ongoing or failed builds.Nov 12 2021, 10:55 AM
This revision was automatically updated to reflect the committed changes.