This revision was automatically updated to reflect the committed changes.
Closed by commit rC349503: Portable Python script across Python version 
(authored by serge_sans_paille, committed by ).
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55205/new/

https://reviews.llvm.org/D55205

Files:
  tools/scan-view/share/startfile.py
  utils/clangdiag.py


Index: utils/clangdiag.py
===================================================================
--- utils/clangdiag.py
+++ utils/clangdiag.py
@@ -12,7 +12,6 @@
 from __future__ import print_function
 import lldb
 import argparse
-import commands
 import shlex
 import os
 import re
Index: tools/scan-view/share/startfile.py
===================================================================
--- tools/scan-view/share/startfile.py
+++ tools/scan-view/share/startfile.py
@@ -110,7 +110,10 @@
 # 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 @@
         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 @@
             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):


Index: utils/clangdiag.py
===================================================================
--- utils/clangdiag.py
+++ utils/clangdiag.py
@@ -12,7 +12,6 @@
 from __future__ import print_function
 import lldb
 import argparse
-import commands
 import shlex
 import os
 import re
Index: tools/scan-view/share/startfile.py
===================================================================
--- tools/scan-view/share/startfile.py
+++ tools/scan-view/share/startfile.py
@@ -110,7 +110,10 @@
 # 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 @@
         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 @@
             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):
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to