[game-data-packager] 01/01: doom2-masterlevels: give a tip about missing Gtk depedencies
Alexandre Detiste
detiste-guest at moszumanska.debian.org
Tue Apr 28 04:57:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
detiste-guest pushed a commit to branch master
in repository game-data-packager.
commit 867f677aa5cb7e72dc59eca59bb748767b8be92f
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Tue Apr 28 06:56:35 2015 +0200
doom2-masterlevels: give a tip about missing Gtk depedencies
---
runtime/doom2-masterlevels.py | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/runtime/doom2-masterlevels.py b/runtime/doom2-masterlevels.py
index bce6ab9..e4f1449 100755
--- a/runtime/doom2-masterlevels.py
+++ b/runtime/doom2-masterlevels.py
@@ -15,12 +15,36 @@
# You can find the GPL license text on a Debian system under
# /usr/share/common-licenses/GPL-2
-import gi
import os
+import stat
import subprocess
-gi.require_version('Gtk', '3.0')
-from gi.repository import Gtk, Pango
+def which(exe):
+ for path in os.environ.get('PATH', '/usr/bin:/bin').split(os.pathsep):
+ try:
+ abspath = os.path.join(path, exe)
+ statbuf = os.stat(abspath)
+ except:
+ continue
+ if stat.S_IMODE(statbuf.st_mode) & 0o111:
+ return abspath
+
+ return None
+
+# ValueError: Namespace Gtk not available
+try:
+ import gi
+ gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk, Pango
+except (ImportError,ValueError):
+ message = 'You need to install the packages python3-gi and gir1.2-gtk-3.0'
+ if which('zenity'):
+ subprocess.call(['zenity', '--error', '--title=Doom 2 Master Levels', '--text', message])
+ elif which('kdialog'):
+ subprocess.call(['kdialog', '--error', message, '--title=Doom 2 Master Levels'])
+ elif which('xmessage'):
+ subprocess.call(['xmessage', '-center', message])
+ exit(message)
# wad : (warp, longname, 'http://doomwiki.org/wiki/' + url)
levels = {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list