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() 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/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/libcxx/util.py =================================================================== --- libcxx/utils/libcxx/util.py +++ libcxx/utils/libcxx/util.py @@ -102,7 +102,7 @@ (or the PATH environment variable, if unspecified).""" if paths is None: - paths = os.environ.get('PATH','') + paths = os.environ.get('PATH', '') # Check for absolute match first. if os.path.isfile(command): @@ -202,23 +202,20 @@ stderr=subprocess.PIPE, env=env, close_fds=kUseCloseFDs) timerObject = None - # FIXME: Because of the way nested function scopes work in Python 2.x we - # need to use a reference to a mutable object rather than a plain - # bool. In Python 3 we could use the "nonlocal" keyword but we need - # to support Python 2 as well. - hitTimeOut = [False] + hitTimeOut = False try: if timeout > 0: def killProcess(): # We may be invoking a shell so we need to kill the # process and all its children. - hitTimeOut[0] = True + nonlocal hitTimeOut + hitTimeOut = True killProcessAndChildren(p.pid) timerObject = threading.Timer(timeout, killProcess) timerObject.start() - out,err = p.communicate(input=input) + out, err = p.communicate(input=input) exitCode = p.wait() finally: if timerObject != None: @@ -228,7 +225,7 @@ out = convert_string(out) err = convert_string(err) - if hitTimeOut[0]: + if hitTimeOut: raise ExecuteCommandTimeoutException( msg='Reached timeout of {} seconds'.format(timeout), out=out, 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']