[libcxx-commits] [PATCH] D72501: [libcxx] Support Python 3.8 in the test suite

Sergej Jaskiewicz via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 10 04:55:12 PST 2020


broadwaylamb created this revision.
broadwaylamb added reviewers: bcain, bcraig, jroelofs.
broadwaylamb added a project: libc++.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne, christof.
Herald added a reviewer: mclow.lists.

`platform.linux_distribution()` has been deprecated in Python 3.5 and removed in Python 3.8.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72501

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
@@ -207,15 +207,25 @@
     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, _, _ = platform.linux_distribution()
+        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, _ = platform.linux_distribution()
+        _, ver, _ = self._distribution()
         ver = ver.lower().strip().replace(' ', '-')
         return ver # Permitted to be None.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72501.237286.patch
Type: text/x-patch
Size: 1230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200110/3f0dd944/attachment-0001.bin>


More information about the libcxx-commits mailing list