summaryrefslogtreecommitdiff
path: root/tools/scan-view/share/startfile.py
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:04:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:04:05 +0000
commit676fbe8105eeb6ff4bb2ed261cb212fcfdbe7b63 (patch)
tree02a1ac369cb734d0abfa5000dd86e5b7797e6a74 /tools/scan-view/share/startfile.py
parentc7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (diff)
Diffstat (limited to 'tools/scan-view/share/startfile.py')
-rw-r--r--tools/scan-view/share/startfile.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/scan-view/share/startfile.py b/tools/scan-view/share/startfile.py
index f58dbeeaf8179..9eb548bc4329b 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):
@@ -189,7 +192,7 @@ else:
return _controllers[controller_name].open
except KeyError:
- if _controllers.has_key('xdg-open'):
+ if 'xdg-open' in _controllers:
return _controllers['xdg-open'].open
else:
return webbrowser.open