[libcxx-commits] [libcxx] 976eba5 - [libc++] NFCI: Remove dead code in the Lit configuration

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 19 12:01:40 PDT 2021


Author: Louis Dionne
Date: 2021-03-19T12:01:30-07:00
New Revision: 976eba51d0dea36b9e0e4f6edb09883490f79684

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

LOG: [libc++] NFCI: Remove dead code in the Lit configuration

I was trying to fix something else and I stumbled upon several methods
that are not used anymore in target_info.py.

Differential Revision: https://reviews.llvm.org/D98896

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 45e3c4ae4d73..b128ab0f7726 100644
--- a/libcxx/utils/libcxx/test/target_info.py
+++ b/libcxx/utils/libcxx/test/target_info.py
@@ -21,18 +21,12 @@ def __init__(self, full_config):
         self.full_config = full_config
         self.executor = None
 
-    def platform(self):
-        return sys.platform.lower().strip()
-
     def is_windows(self):
         return False
 
     def is_mingw(self):
         return False
 
-    def is_darwin(self):
-        return False
-
     def add_cxx_flags(self, flags): pass
     def add_cxx_compile_flags(self, flags): pass
     def add_cxx_link_flags(self, flags): pass
@@ -53,33 +47,6 @@ class DarwinLocalTI(DefaultTargetInfo):
     def __init__(self, full_config):
         super(DarwinLocalTI, self).__init__(full_config)
 
-    def is_darwin(self):
-        return True
-
-    def is_host_macosx(self):
-        name = lit.util.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 = lit.util.to_string(subprocess.check_output(['sw_vers', '-productVersion'])).strip()
-        version = re.sub(r'([0-9]+\.[0-9]+)(\..*)?', r'\1', version)
-        return version
-
-    def get_sdk_version(self, name):
-        assert self.is_host_macosx()
-        cmd = ['xcrun', '--sdk', name, '--show-sdk-path']
-        try:
-            out = subprocess.check_output(cmd).strip()
-        except OSError:
-            pass
-
-        if not out:
-            self.full_config.lit_config.fatal(
-                    "cannot infer sdk version with: %r" % cmd)
-
-        return re.sub(r'.*/[^0-9]+([0-9.]+)\.sdk', r'\1', out)
-
     def add_cxx_flags(self, flags):
         out, err, exit_code = executeCommand(['xcrun', '--show-sdk-path'])
         if exit_code != 0:
@@ -120,31 +87,6 @@ class LinuxLocalTI(DefaultTargetInfo):
     def __init__(self, full_config):
         super(LinuxLocalTI, self).__init__(full_config)
 
-    def platform(self):
-        return 'linux'
-
-    def _distribution(self):
-        try:
-            # linux_distribution is not available since Python 3.8
-            # However, this function is only used to detect SLES 11,
-            # which is quite an old distribution that doesn't have
-            # Python 3.8.
-            return platform.linux_distribution()
-        except AttributeError:
-            return '', '', ''
-
-    def platform_name(self):
-        name, _, _ = self._distribution()
-        # Some distros have spaces, e.g. 'SUSE Linux Enterprise Server'
-        # lit features can't have spaces
-        name = name.lower().strip().replace(' ', '-')
-        return name # Permitted to be None
-
-    def platform_ver(self):
-        _, ver, _ = self._distribution()
-        ver = ver.lower().strip().replace(' ', '-')
-        return ver # Permitted to be None.
-
     def add_cxx_compile_flags(self, flags):
         flags += ['-D__STDC_FORMAT_MACROS',
                   '-D__STDC_LIMIT_MACROS',


        


More information about the libcxx-commits mailing list