summaryrefslogtreecommitdiff
blob: 325c4365ded41e4850ed51602eca14e8c4cf34d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--- a/lightyears
+++ b/lightyears
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 # Set the location of the LightYears files here:
-LIGHTYEARS_DIR = "."
 # LIGHTYEARS_DIR = "/usr/share/games/lightyears" # (for Debian)
 
 # Save games and configuration files are stored in the user's
@@ -10,31 +9,6 @@
 import sys, os
 
 if __name__ == "__main__":
-    # Path to data/code dir can be overridden by environment variable
-    LIGHTYEARS_DIR = os.environ.get("LIGHTYEARS_DIR", LIGHTYEARS_DIR)
-
-    # Path does not exist? Try current directory.
-    if ((LIGHTYEARS_DIR == None)
-    or (not os.path.isdir(LIGHTYEARS_DIR))
-    or (not os.path.isfile(os.path.join(LIGHTYEARS_DIR, 
-                            'code', 'startup.py')))):
-        LIGHTYEARS_DIR = os.getcwd()
-
-    # Paths obtained
-    sys.path.insert(0, os.path.join(LIGHTYEARS_DIR, 'code'))
-    data_dir = os.path.join(LIGHTYEARS_DIR, 'data')
-
-    # Go
-    try:
-        import startup
-        assert os.path.isdir(data_dir)
-    except:
-        print "Unable to find LightYears code & data in:"
-        for p in sys.path:
-            print '  ', p
-
-        sys.exit(1)
-
-    startup.Main(data_dir)
-    
-
+    sys.path.insert(0, "@GENTOO_LIBDIR@")
+    import startup
+    startup.Main("@GENTOO_DATADIR@/data")