File: lightyears

package info (click to toggle)
lightyears 1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 1,324 kB
  • ctags: 454
  • sloc: python: 3,499; makefile: 2
file content (40 lines) | stat: -rwxr-xr-x 1,086 bytes parent folder | download | duplicates (2)
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
#!/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
# home directory.

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)