r349503 - Portable Python script across Python version
Serge Guelton via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 18 08:07:06 PST 2018
Author: serge_sans_paille
Date: Tue Dec 18 08:07:06 2018
New Revision: 349503
URL: http://llvm.org/viewvc/llvm-project?rev=349503&view=rev
Log:
Portable Python script across Python version
commands.getoutput has been move to subprocess module in Python3
Differential Revision: https://reviews.llvm.org/D55205
Modified:
cfe/trunk/tools/scan-view/share/startfile.py
cfe/trunk/utils/clangdiag.py
Modified: cfe/trunk/tools/scan-view/share/startfile.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/share/startfile.py?rev=349503&r1=349502&r2=349503&view=diff
==============================================================================
--- cfe/trunk/tools/scan-view/share/startfile.py (original)
+++ cfe/trunk/tools/scan-view/share/startfile.py Tue Dec 18 08:07:06 2018
@@ -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):
Modified: cfe/trunk/utils/clangdiag.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/clangdiag.py?rev=349503&r1=349502&r2=349503&view=diff
==============================================================================
--- cfe/trunk/utils/clangdiag.py (original)
+++ cfe/trunk/utils/clangdiag.py Tue Dec 18 08:07:06 2018
@@ -12,7 +12,6 @@
from __future__ import print_function
import lldb
import argparse
-import commands
import shlex
import os
import re
More information about the cfe-commits
mailing list