diff options
author | Sergej Jaskiewicz <jaskiewiczs@icloud.com> | 2020-01-21 19:40:34 +0300 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-02-19 10:32:36 +0100 |
commit | 8dbe13ff509c60dececd9d93f7ffe86c5c4456a0 (patch) | |
tree | aef2e6991e85ad9e5fc88a2752d07ac76a70fae1 /libcxx/utils | |
parent | f636e9feb9f0969e3b563d3140db5a0faa1e30d8 (diff) | |
download | bcm5719-llvm-8dbe13ff509c60dececd9d93f7ffe86c5c4456a0.tar.gz bcm5719-llvm-8dbe13ff509c60dececd9d93f7ffe86c5c4456a0.zip |
[libcxx] Support Python 3.8 in the test suite
Summary: `platform.linux_distribution()` has been deprecated in Python 3.5 and removed in Python 3.8.
Reviewers: bcain, bcraig, jroelofs, EricWF, mclow.lists, ldionne
Reviewed By: jroelofs
Subscribers: dexonsmith, christof, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D72501
(cherry picked from commit 7b8dc8c57697e95fd0b1248e4494ecc0f929aba1)
Diffstat (limited to 'libcxx/utils')
-rw-r--r-- | libcxx/utils/libcxx/test/target_info.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libcxx/utils/libcxx/test/target_info.py b/libcxx/utils/libcxx/test/target_info.py index d622daa2a87..fa57a2c7485 100644 --- a/libcxx/utils/libcxx/test/target_info.py +++ b/libcxx/utils/libcxx/test/target_info.py @@ -207,15 +207,25 @@ class LinuxLocalTI(DefaultTargetInfo): 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. |