[libcxx-commits] [PATCH] D70991: [libc++][test] Replace platform.linux_distribution by distro.linux_distribution

Aaron Puchert via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 3 16:00:37 PST 2019


aaronpuchert created this revision.
aaronpuchert added reviewers: ldionne, EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, christof.
Herald added a project: libc++.

Since Python 3.5, platform.linux_distribution is deprecated [1], and in
Python 3.8 it has been removed entirely. The supposed replacement is
from the package distro. Unfortunately this adds another dependency to
the tests, but only on Linux (I think).

[1] https://docs.python.org/3.5/library/platform.html#platform.linux_distribution


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70991

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
@@ -191,25 +191,21 @@
     def platform(self):
         return 'linux'
 
-    def platform_name(self):
-        name, _, _ = platform.linux_distribution()
+    def platform_name_ver(self):
+        import distro
+        name, ver, _ = distro.linux_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, _ = platform.linux_distribution()
         ver = ver.lower().strip().replace(' ', '-')
-        return ver # Permitted to be None.
+        return (name, ver) # Both permitted to be None
 
     def add_locale_features(self, features):
         add_common_locales(features, self.full_config.lit_config)
         # Some linux distributions have different locale data than others.
         # Insert the distributions name and name-version into the available
         # features to allow tests to XFAIL on them.
-        name = self.platform_name()
-        ver = self.platform_ver()
+        name, ver = self.platform_name_ver()
         if name:
             features.add(name)
         if name and ver:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70991.232006.patch
Type: text/x-patch
Size: 1431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191204/c73656e6/attachment.bin>


More information about the libcxx-commits mailing list