diff options
author | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 16:07:06 +0000 |
---|---|---|
committer | Serge Guelton <sguelton@quarkslab.com> | 2018-12-18 16:07:06 +0000 |
commit | cf888dadbd8a75717f099042d4942f4a62d869ca (patch) | |
tree | 0c2fe8ea81fe494dbaeeeeefceb6405418b24761 | |
parent | bd8d3419e1b6a1c7ec82e1ceb1f22b407a38dac9 (diff) |
Portable Python script across Python version
commands.getoutput has been move to subprocess module in Python3
Differential Revision: https://reviews.llvm.org/D55205
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349503 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/scan-view/share/startfile.py | 9 | ||||
-rwxr-xr-x | utils/clangdiag.py | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/tools/scan-view/share/startfile.py b/tools/scan-view/share/startfile.py index 58023d0271..9eb548bc43 100644 --- a/tools/scan-view/share/startfile.py +++ b/tools/scan-view/share/startfile.py @@ -110,7 +110,10 @@ elif sys.platform == 'darwin': # Platform support for Unix else: - import commands + try: + from commands import getoutput + except ImportError: + from subprocess import getoutput # @WARNING: use the private API of the webbrowser module from webbrowser import _iscommand @@ -125,7 +128,7 @@ else: def detect_kde_version(self): kde_version = None try: - info = commands.getoutput('kde-config --version') + info = getoutput('kde-config --version') for line in info.splitlines(): if line.startswith('KDE'): @@ -158,7 +161,7 @@ else: desktop_environment = 'gnome' else: try: - info = commands.getoutput('xprop -root _DT_SAVE_MODE') + info = getoutput('xprop -root _DT_SAVE_MODE') if ' = "xfce4"' in info: desktop_environment = 'xfce' except (OSError, RuntimeError): diff --git a/utils/clangdiag.py b/utils/clangdiag.py index d449194e28..a9656c55d8 100755 --- a/utils/clangdiag.py +++ b/utils/clangdiag.py @@ -12,7 +12,6 @@ from __future__ import print_function import lldb import argparse -import commands import shlex import os import re |