[libcxx-commits] [libcxx] 19123a3 - [libc++] Fix MacOS platform detection broken in Python 3

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 29 07:02:01 PDT 2020


Author: Louis Dionne
Date: 2020-04-29T10:00:56-04:00
New Revision: 19123a3e0873f238f88c25cb0d8e63f263311f9b

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

LOG: [libc++] Fix MacOS platform detection broken in Python 3

Since 88af3ddb1e8a, libc++ will prefer Python 3 when available. It is
available on Apple platforms, so subprocess.check_output will return
bytes instead of str. This lead to comparisons against str to be false,
and the MacOS platform not being detected properly.

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 caa161ec93be..696ad14b7829 100644
--- a/libcxx/utils/libcxx/test/target_info.py
+++ b/libcxx/utils/libcxx/test/target_info.py
@@ -91,13 +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']).strip()
+        name = subprocess.check_output(['sw_vers', '-productName']).decode().strip()
         return name == "Mac OS X"
 
     def get_macosx_version(self):
         assert self.is_host_macosx()
-        version = subprocess.check_output(
-            ['sw_vers', '-productVersion']).strip()
+        version = subprocess.check_output(['sw_vers', '-productVersion']).decode().strip()
         version = re.sub(r'([0-9]+\.[0-9]+)(\..*)?', r'\1', version)
         return version
 


        


More information about the libcxx-commits mailing list