[libcxx-commits] [libcxx] ecd3ce0 - [libc++] Make sure platform detection works in both Python 2 and 3

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 30 12:32:24 PDT 2020


Author: Louis Dionne
Date: 2020-04-30T15:32:08-04:00
New Revision: ecd3ce0e5a0477d77be2e154b7efa247656c3445

URL: https://github.com/llvm/llvm-project/commit/ecd3ce0e5a0477d77be2e154b7efa247656c3445
DIFF: https://github.com/llvm/llvm-project/commit/ecd3ce0e5a0477d77be2e154b7efa247656c3445.diff

LOG: [libc++] Make sure platform detection works in both Python 2 and 3

19123a3e0873 was too naive -- we really want to handle both Python 2 and
Python 3, not only Python 3.

Added: 
    

Modified: 
    libcxx/utils/libcxx/test/target_info.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/libcxx/test/target_info.py b/libcxx/utils/libcxx/test/target_info.py
index 696ad14b7829..2f4debacb6bb 100644
--- a/libcxx/utils/libcxx/test/target_info.py
+++ b/libcxx/utils/libcxx/test/target_info.py
@@ -14,7 +14,7 @@
 import subprocess
 import sys
 
-from libcxx.util import executeCommand
+from libcxx.util import executeCommand, to_string
 
 class DefaultTargetInfo(object):
     def __init__(self, full_config):
@@ -91,12 +91,12 @@ def __init__(self, full_config):
         super(DarwinLocalTI, self).__init__(full_config)
 
     def is_host_macosx(self):
-        name = subprocess.check_output(['sw_vers', '-productName']).decode().strip()
+        name = to_string(subprocess.check_output(['sw_vers', '-productName'])).strip()
         return name == "Mac OS X"
 
     def get_macosx_version(self):
         assert self.is_host_macosx()
-        version = subprocess.check_output(['sw_vers', '-productVersion']).decode().strip()
+        version = to_string(subprocess.check_output(['sw_vers', '-productVersion'])).strip()
         version = re.sub(r'([0-9]+\.[0-9]+)(\..*)?', r'\1', version)
         return version
 


        


More information about the libcxx-commits mailing list