forked from OSchip/llvm-project
Portable Python script across Python version
commands.getoutput has been move to subprocess module in Python3 Differential Revision: https://reviews.llvm.org/D55205 llvm-svn: 349503
This commit is contained in:
parent
ae7ac3ca5b
commit
3ee1ffc9fc
|
@ -110,7 +110,10 @@ elif sys.platform == 'darwin':
|
||||||
# Platform support for Unix
|
# Platform support for Unix
|
||||||
else:
|
else:
|
||||||
|
|
||||||
import commands
|
try:
|
||||||
|
from commands import getoutput
|
||||||
|
except ImportError:
|
||||||
|
from subprocess import getoutput
|
||||||
|
|
||||||
# @WARNING: use the private API of the webbrowser module
|
# @WARNING: use the private API of the webbrowser module
|
||||||
from webbrowser import _iscommand
|
from webbrowser import _iscommand
|
||||||
|
@ -125,7 +128,7 @@ else:
|
||||||
def detect_kde_version(self):
|
def detect_kde_version(self):
|
||||||
kde_version = None
|
kde_version = None
|
||||||
try:
|
try:
|
||||||
info = commands.getoutput('kde-config --version')
|
info = getoutput('kde-config --version')
|
||||||
|
|
||||||
for line in info.splitlines():
|
for line in info.splitlines():
|
||||||
if line.startswith('KDE'):
|
if line.startswith('KDE'):
|
||||||
|
@ -158,7 +161,7 @@ else:
|
||||||
desktop_environment = 'gnome'
|
desktop_environment = 'gnome'
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
info = commands.getoutput('xprop -root _DT_SAVE_MODE')
|
info = getoutput('xprop -root _DT_SAVE_MODE')
|
||||||
if ' = "xfce4"' in info:
|
if ' = "xfce4"' in info:
|
||||||
desktop_environment = 'xfce'
|
desktop_environment = 'xfce'
|
||||||
except (OSError, RuntimeError):
|
except (OSError, RuntimeError):
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import lldb
|
import lldb
|
||||||
import argparse
|
import argparse
|
||||||
import commands
|
|
||||||
import shlex
|
import shlex
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
Loading…
Reference in New Issue