[libcxx-commits] [PATCH] D107715: [libc++][NFC] Resolve Python 2 FIXME

Alf via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 8 09:08:49 PDT 2021


gAlfonso-bit updated this revision to Diff 365029.
gAlfonso-bit removed a reviewer: libc++.
gAlfonso-bit added a comment.
Herald added a subscriber: mgorny.
Herald added a reviewer: libc++.

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


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107715/new/

https://reviews.llvm.org/D107715

Files:
  libcxx/CMakeLists.txt
  libcxx/utils/ci/runtimes/CMakeLists.txt
  libcxx/utils/gdb/libcxx/printers.py
  libcxx/utils/ssh.py


Index: libcxx/utils/ssh.py
===================================================================
--- libcxx/utils/ssh.py
+++ libcxx/utils/ssh.py
@@ -23,11 +23,7 @@
 import tarfile
 import tempfile
 
-try:
-   from shlex import quote as cmd_quote
-except ImportError:
-   # for Python 2 compatibility
-   from pipes import quote as cmd_quote
+from shlex import quote as cmd_quote
 
 def ssh(args, command):
     cmd = ['ssh', '-oBatchMode=yes']
Index: libcxx/utils/gdb/libcxx/printers.py
===================================================================
--- libcxx/utils/gdb/libcxx/printers.py
+++ libcxx/utils/gdb/libcxx/printers.py
@@ -147,10 +147,6 @@
             self.count += 1
             return ("[%d]" % self.count, child)
 
-        # TODO Delete when we drop Python 2.
-        def next(self):
-            return self.__next__()
-
     def __init__(self, val):
         self.val = val
 
@@ -370,10 +366,6 @@
                 self.offset = 0
             return ("[%d]" % self.count, outbit)
 
-        # TODO Delete when we drop Python 2.
-        def next(self):
-            return self.__next__()
-
     class _VectorIterator(object):
         """Class to iterate over the non-bool vector's children."""
 
@@ -393,10 +385,6 @@
             self.item += 1
             return ("[%d]" % self.count, entry)
 
-        # TODO Delete when we drop Python 2.
-        def next(self):
-            return self.__next__()
-
     def __init__(self, val):
         """Set val, length, capacity, and iterator for bool and normal vectors."""
         self.val = val
Index: libcxx/utils/ci/runtimes/CMakeLists.txt
===================================================================
--- libcxx/utils/ci/runtimes/CMakeLists.txt
+++ libcxx/utils/ci/runtimes/CMakeLists.txt
@@ -3,17 +3,7 @@
 
 find_package(Python3 COMPONENTS Interpreter)
 if(NOT Python3_Interpreter_FOUND)
-  message(WARNING "Python3 not found, using python2 as a fallback")
-  find_package(Python2 COMPONENTS Interpreter REQUIRED)
-  if(Python2_VERSION VERSION_LESS 2.7)
-    message(SEND_ERROR "Python 2.7 or newer is required")
-  endif()
-
-  # Treat python2 as python3
-  add_executable(Python3::Interpreter IMPORTED)
-  set_target_properties(Python3::Interpreter PROPERTIES
-    IMPORTED_LOCATION ${Python2_EXECUTABLE})
-  set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
+  message(SEND_ERROR "Python3 not found. Python3 is required")
 endif()
 
 # This needs to be set before we add any Lit target for `add_lit_target` to
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -44,17 +44,7 @@
 if (LIBCXX_STANDALONE_BUILD)
   find_package(Python3 COMPONENTS Interpreter)
   if(NOT Python3_Interpreter_FOUND)
-    message(WARNING "Python3 not found, using python2 as a fallback")
-    find_package(Python2 COMPONENTS Interpreter REQUIRED)
-    if(Python2_VERSION VERSION_LESS 2.7)
-      message(SEND_ERROR "Python 2.7 or newer is required")
-    endif()
-
-    # Treat python2 as python3
-    add_executable(Python3::Interpreter IMPORTED)
-    set_target_properties(Python3::Interpreter PROPERTIES
-      IMPORTED_LOCATION ${Python2_EXECUTABLE})
-    set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
+    message(SEND_ERROR "Python3 not found. Python3 is required")
   endif()
 endif()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107715.365029.patch
Type: text/x-patch
Size: 3352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210808/0b889e45/attachment.bin>


More information about the libcxx-commits mailing list