gnome-games r7750 - in branches/gnome-2-22/glchess/src: . lib
- From: jclinton svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r7750 - in branches/gnome-2-22/glchess/src: . lib
- Date: Sun, 29 Jun 2008 19:54:37 +0000 (UTC)
Author: jclinton
Date: Sun Jun 29 19:54:36 2008
New Revision: 7750
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7750&view=rev
Log:
Fix sys.path problems
Modified:
branches/gnome-2-22/glchess/src/glchess.in.in
branches/gnome-2-22/glchess/src/lib/defaults.py.in
Modified: branches/gnome-2-22/glchess/src/glchess.in.in
==============================================================================
--- branches/gnome-2-22/glchess/src/glchess.in.in (original)
+++ branches/gnome-2-22/glchess/src/glchess.in.in Sun Jun 29 19:54:36 2008
@@ -8,6 +8,9 @@
# software under the terms of the GNU General Public License,
# version 2 or later.
+import sys
+import os
+
# Some version of PyGTK require this to be called before importing the gtk module
import pygtk
pygtk.require('2.0')
@@ -20,35 +23,31 @@
#No bugbuddy support
pass
-import sys
-installed_mode = True
+# Chek if we are installed
+root_dir = os.path.dirname(__file__)
+if os.path.exists(os.path.join(root_dir, 'Makefile.am')):
+ sys.path.insert(0, os.path.abspath(root_dir))
+ import lib
+ sys.modules['glchess'] = sys.modules['lib']
try:
- # Import glchess module from source distribution.
- import lib;
- sys.modules["glchess"] = sys.modules["lib"];
+ # Import glChess from pyexecdir or system installation.
from glchess.glchess import start_game
-
except ImportError:
- try:
- # Import glChess from pyexecdir or system installation.
- from glchess.glchess import start_game
-
- except ImportError:
- # Import of glChess failed. Show error message.
- import gtk
- import os.path
- import gettext
- from gettext import gettext as _
+ # Import of glChess failed. Show error message.
+ import gtk
+ import os.path
+ import gettext
+ from gettext import gettext as _
- gettext.bindtextdomain('gnome-games', os.path.join('@prefix@', 'share', 'locale'))
- gettext.textdomain('gnome-games')
- title = _("Chess incorrectly installed")
- description = _("""Chess is not able to start because required application files are not installed. If you are currently upgrading your system please wait until the upgrade has completed.""")
- dialog = gtk.MessageDialog(type = gtk.MESSAGE_ERROR, message_format = title)
- dialog.format_secondary_text(description)
- dialog.add_button(gtk.STOCK_QUIT, gtk.RESPONSE_CLOSE)
- dialog.run()
- sys.exit(0)
+ gettext.bindtextdomain('gnome-games', os.path.join('@prefix@', 'share', 'locale'))
+ gettext.textdomain('gnome-games')
+ title = _("Chess incorrectly installed")
+ description = _("""Chess is not able to start because required application files are not installed. If you are currently upgrading your system please wait until the upgrade has completed.""")
+ dialog = gtk.MessageDialog(type = gtk.MESSAGE_ERROR, message_format = title)
+ dialog.format_secondary_text(description)
+ dialog.add_button(gtk.STOCK_QUIT, gtk.RESPONSE_CLOSE)
+ dialog.run()
+ sys.exit(0)
start_game()
Modified: branches/gnome-2-22/glchess/src/lib/defaults.py.in
==============================================================================
--- branches/gnome-2-22/glchess/src/lib/defaults.py.in (original)
+++ branches/gnome-2-22/glchess/src/lib/defaults.py.in Sun Jun 29 19:54:36 2008
@@ -9,8 +9,8 @@
import errno
import gettext
-root_dir = os.path.dirname(os.path.dirname(__file__))
-if not os.path.exists(os.path.join(root_dir, "Makefile.am")):
+root_dir = os.path.dirname(__file__)
+if not os.path.exists(os.path.join(root_dir, 'Makefile.am')):
# Running in installed mode
APP_DATA_DIR = os.path.join('@prefix@', 'share')
ICON_DIR = os.path.join(APP_DATA_DIR, 'pixmaps')
@@ -24,14 +24,15 @@
HISTORY_DIR = os.path.join(DATA_DIR, 'history')
UNFINISHED_FILE = os.path.join(HISTORY_DIR, 'unfinished')
LOCAL_AI_CONFIG = os.path.join(DATA_DIR, 'ai.xml')
+ GGZ_DIR = os.path.expanduser('~/.ggz')
+ GGZ_CONFIG_FILE = os.path.join(GGZ_DIR, 'ggz-gtk.rc')
else:
# Running in uninstalled mode
- sys.path.insert(0, os.path.abspath(root_dir))
- APP_DATA_DIR = os.path.join(root_dir, '../data')
- ICON_DIR = os.path.join(root_dir, '../textures')
- TEXTURE_DIR = os.path.join(root_dir, '../textures')
- GLADE_DIR = os.path.join(root_dir, '../glade')
- BASE_DIR = os.path.join(root_dir, '../data')
+ APP_DATA_DIR = os.path.join(root_dir, '../../data')
+ ICON_DIR = os.path.join(root_dir, '../../textures')
+ TEXTURE_DIR = os.path.join(root_dir, '../../textures')
+ GLADE_DIR = os.path.join(root_dir, '../../glade')
+ BASE_DIR = os.path.join(root_dir, '../../data')
LOCALEDIR = os.path.join(APP_DATA_DIR, 'locale')
DATA_DIR = os.path.expanduser('~/.gnome2/glchess/')
LOG_DIR = os.path.join(DATA_DIR, 'logs')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]