diff options
author | 2022-06-15 22:31:42 +0800 | |
---|---|---|
committer | 2022-06-15 15:06:38 +0000 | |
commit | 7e0c12b1ba22d29a61947a331dcfd910b6ded8d9 (patch) | |
tree | 8bcbbe063bda72900e71168f5c1fa8cf14f6519d /tools/check_elf_file.py | |
parent | 6ebfaa453b576a0a803500d93638bff0c707b6ec (diff) |
Fix potential error for sys.platform
This CL is to fix gap between python2.x and 3.x.
For python2.x: sys.platform returns 'linux2'
For python3.x: sys.platform returns 'linux'
python3.x(https://docs.python.org/3.6/library/sys.html#sys.platform)
python2.x(https://docs.python.org/2.7/library/sys.html#sys.platform)
Both 2.x and 3.x recommend to use 'startswith' to identify sys.platform.
Change-Id: Id5a0a007518b329d1320baf96ecf1164cd3ebec1
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
Diffstat (limited to 'tools/check_elf_file.py')
-rwxr-xr-x | tools/check_elf_file.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/check_elf_file.py b/tools/check_elf_file.py index 045cb1dd71..0b80226935 100755 --- a/tools/check_elf_file.py +++ b/tools/check_elf_file.py @@ -72,9 +72,9 @@ ELF = collections.namedtuple( def _get_os_name(): """Get the host OS name.""" - if sys.platform == 'linux2': + if sys.platform.startswith('linux'): return 'linux' - if sys.platform == 'darwin': + if sys.platform.startswith('darwin'): return 'darwin' raise ValueError(sys.platform + ' is not supported') |