~facundo/enjuewemela/trunk

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
#!/usr/bin/env python

# -*- coding: utf8 -*-

# This code is part of the 'enjuewemela' game
# License: GPLv3
# Main author: Facundo Batista
# Code, bug tracker, etc:
#   https://launchpad.net/enjuewemela/

"""Script to start enjuewemela."""

import os
import sys 

# this will be replaced at install time
INSTALLED_BASE_DIR = "@ INSTALLED_BASE_DIR @"

# get the replaced-at-install-time name if exists, or the project one
if os.path.exists(INSTALLED_BASE_DIR):
    project_basedir = INSTALLED_BASE_DIR
else:
    project_basedir = os.path.abspath(os.path.dirname(os.path.dirname(
                                            os.path.realpath(sys.argv[0]))))

# add the main package to the path
if project_basedir not in sys.path:
    sys.path.insert(0, project_basedir)

# cocos2d needs to be directly accessible to import, for 
# director's singleton magic work properly
cocosdir = os.path.join(project_basedir, 'enjuewemela', 'cocos')
if cocosdir not in sys.path:
    sys.path.insert(0, cocosdir)

# the base directory for the rest of the game
from enjuewemela import config
config.BASEDIR = os.path.join(project_basedir, 'enjuewemela')

# go baby go!
from enjuewemela import main
main.start()