gnome-games r7676 - in branches/gnome-2-22/glchess: . src src/lib
- From: jclinton svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r7676 - in branches/gnome-2-22/glchess: . src src/lib
- Date: Thu, 29 May 2008 22:58:52 +0000 (UTC)
Author: jclinton
Date: Thu May 29 22:58:51 2008
New Revision: 7676
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7676&view=rev
Log:
fix glchess sys.path usage
Modified:
branches/gnome-2-22/glchess/ChangeLog
branches/gnome-2-22/glchess/src/Makefile.am
branches/gnome-2-22/glchess/src/glchess.in.in
branches/gnome-2-22/glchess/src/lib/defaults.py.in
branches/gnome-2-22/glchess/src/lib/glchess.py
Modified: branches/gnome-2-22/glchess/src/Makefile.am
==============================================================================
--- branches/gnome-2-22/glchess/src/Makefile.am (original)
+++ branches/gnome-2-22/glchess/src/Makefile.am Thu May 29 22:58:51 2008
@@ -8,7 +8,5 @@
CLEANFILES = glchess
glchess: $(top_builddir)/glchess/src/glchess.in
- sed \
- -e "s|\#pyexecdir\#|$(pyexecdir)|" \
- $< > $@
+ cp $(top_builddir)/glchess/src/glchess.in $@
if test -f $@; then chmod u+x $@; fi
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 Thu May 29 22:58:51 2008
@@ -28,12 +28,10 @@
import lib;
sys.modules["glchess"] = sys.modules["lib"];
from glchess.glchess import start_game
- installed_mode = False
except ImportError:
try:
# Import glChess from pyexecdir or system installation.
- installed_mode = True
from glchess.glchess import start_game
except ImportError:
@@ -53,6 +51,4 @@
dialog.run()
sys.exit(0)
-sys.modules["glchess"].installed_mode = installed_mode
-
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 Thu May 29 22:58:51 2008
@@ -9,12 +9,9 @@
import errno
import gettext
-if (sys.modules.has_key('glchess') and
- hasattr(sys.modules["glchess"],'installed_mode') and
- sys.modules["glchess"].installed_mode):
- # If the installed_mode attribute is not set, then we are
- # importing from something other than the glchess script; we
- # assume anyone importing in this way is doing testing etc.
+root_dir = os.path.dirname(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')
TEXTURE_DIR = os.path.join(ICON_DIR, 'glchess')
@@ -28,11 +25,13 @@
UNFINISHED_FILE = os.path.join(HISTORY_DIR, 'unfinished')
LOCAL_AI_CONFIG = os.path.join(DATA_DIR, 'ai.xml')
else:
- APP_DATA_DIR = os.path.join('@abs_top_builddir@', 'glchess', 'data')
- ICON_DIR = os.path.join('@abs_top_builddir@', 'glchess', 'textures')
- TEXTURE_DIR = os.path.join('@abs_top_builddir@', 'glchess', 'textures')
- GLADE_DIR = os.path.join('@abs_top_builddir@', 'glchess', 'glade')
- BASE_DIR = os.path.join('@abs_top_builddir@', 'glchess', 'data')
+ # 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')
LOCALEDIR = os.path.join(APP_DATA_DIR, 'locale')
DATA_DIR = os.path.expanduser('~/.gnome2/glchess/')
LOG_DIR = os.path.join(DATA_DIR, 'logs')
Modified: branches/gnome-2-22/glchess/src/lib/glchess.py
==============================================================================
--- branches/gnome-2-22/glchess/src/lib/glchess.py (original)
+++ branches/gnome-2-22/glchess/src/lib/glchess.py Thu May 29 22:58:51 2008
@@ -16,7 +16,7 @@
sys.stdout = SafeStdout()
-import main
def start_game ():
+ import main
app = main.Application()
app.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]