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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 18 14:07:12 PDT 2021


ldionne created this revision.
Herald added subscribers: jkorous, arichardson.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98896

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


Index: libcxx/utils/libcxx/test/target_info.py
===================================================================
--- libcxx/utils/libcxx/test/target_info.py
+++ libcxx/utils/libcxx/test/target_info.py
@@ -21,18 +21,12 @@
         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 @@
     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 @@
     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',


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98896.331683.patch
Type: text/x-patch
Size: 3004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210318/47b00470/attachment.bin>


More information about the libcxx-commits mailing list