File: setup_exe.py

package info (click to toggle)
fofix-dfsg 3.121-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 27,016 kB
  • ctags: 4,131
  • sloc: python: 44,002; makefile: 99; perl: 42; sh: 39
file content (167 lines) | stat: -rwxr-xr-x 5,797 bytes parent folder | download | duplicates (4)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#####################################################################
# -*- coding: iso-8859-1 -*-                                        #
#                                                                   #
# Frets on Fire X                                                   #
# Copyright (C) 2009 FoFiX Team                                     #
#               2006 Sami Ky�stil�                                  #
#                                                                   #
# This program is free software; you can redistribute it and/or     #
# modify it under the terms of the GNU General Public License       #
# as published by the Free Software Foundation; either version 2    #
# of the License, or (at your option) any later version.            #
#                                                                   #
# This program is distributed in the hope that it will be useful,   #
# but WITHOUT ANY WARRANTY; without even the implied warranty of    #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     #
# GNU General Public License for more details.                      #
#                                                                   #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software       #
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,        #
# MA  02110-1301, USA.                                              #
#####################################################################

# Keyboard Hero setup script
from distutils.core import setup
import sys, SceneFactory, Version, glob, os

try:
  import py2exe
  from py2exe.resources.VersionInfo import RT_VERSION
  from py2exe.resources.VersionInfo import Version as VersionResource
except ImportError:
  pass

#stump: Start building a list of forced includes.
extraIncludes = [
  "PIL.PngImagePlugin",
  "PIL.JpegImagePlugin",
]

#stump: if we're running pyOpenGL 3, do the necessary black magic.
import OpenGL
import pygame
if int(OpenGL.__version__[0]) > 2:
  extraIncludes += [
    "OpenGL.platform.win32",
    "OpenGL.arrays.ctypesarrays",
    "OpenGL.arrays.numpymodule",
    "OpenGL.arrays.lists",
    "OpenGL.arrays.numbers",
    "OpenGL.arrays.strings",  #stump: needed by shader code
  ]

#stump: The pyopengl-accelerator format handlers import this
# module using the Python/C API, so py2exe doesn't know that
# it is needed.
try:
  from OpenGL_accelerate import formathandler
  extraIncludes.append("OpenGL_accelerate.formathandler")
except ImportError:
  pass

options = {
  "py2exe": {
    "dist_dir":  "../dist",
    "includes":  SceneFactory.scenes + extraIncludes,
    "excludes":  [
      "ode",
      "_ssl",
      "bz2",
      "email",
      "calendar",
      "difflib",
      "doctest",
      "ftplib",
      "getpass",
      "gopherlib",
      "macpath",
      "macurl2path",
      "multiprocessing",
      "PIL.GimpGradientFile",
      "PIL.GimpPaletteFile",
      "PIL.PaletteFile",
      "GimpGradientFile",  #stump: we still need the non-PIL names for these
      "GimpPaletteFile",   # because they get included under these names when
      "PaletteFile",       # excluded above...
      "macosx",
      "Tkinter",
      "Pyrex",
      "distutils",
      "pydoc",
      "py_compile",
      "compiler",
    ],
    "dll_excludes":  [
      "msvcp90.dll",
      "mswsock.dll",
      "powrprof.dll"
    ],
    "optimize":  2,
  }
}

dataFiles = [
  "default.ttf",
  "title.ttf",
  "international.ttf",
  "key.dae",
  "note.dae",
  "cassette.dae",
  "label.dae",
  "library.dae",
  "library_label.dae",
  "glow.png",
]


dataFiles      = ["../data/" + f for f in dataFiles]

def songFiles(song, extra = []):
  return ["../data/songs/%s/%s" % (song, f) for f in ["guitar.ogg", "notes.mid", "song.ini", "song.ogg"] + extra]

dataFiles = [
  ("data",                    dataFiles),
  ("data/translations",       glob.glob("../data/translations/*.mo")),
]

#stump: sometimes py2.6 py2exe thinks parts of pygame are "system" DLLs...
__orig_isSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
  if pathname.lower().find('pygame') != -1:
    return 0
  return __orig_isSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL

#evilynux: Grab version info from Version class
def setupWindows():
  setup(#stump: these arguments interfere with the version tagging code,
        #  but they don't really do anything important anyway.  When the
        #  version tagging code was modified, they suddenly became a valid
        #  source of info for py2exe to synthesize a version info resource
        #  of its own, which supersedes the one specified further down.
        #version = Version.VERSION,
        #description = "Rockin' it Oldskool!",
        #name = Version.appNameSexy(),
        #url = Version.URL,
        windows = [
          {
            "script":          "FoFiX.py",
            "icon_resources":  [(1, "fofix.ico")],
            "other_resources": [(RT_VERSION, 1, VersionResource(
              #stump: the parameter below must consist only of up to four numerical fields separated by dots
              Version.VERSION,
              file_description="Frets on Fire X",
              legal_copyright=r"� 2008-2009 FoFiX Team.  GNU GPL v2 or later.",
              company_name="FoFiX Team",
              internal_name="FoFiX.exe",
              original_filename="FoFiX.exe",
              product_name=Version.appNameSexy(),
              #stump: when run from the exe, FoFiX will claim to be "FoFiX v" + product_version
              product_version=Version.version()
            ).resource_bytes())]
          }
        ],
        zipfile = "data/library.zip",
        data_files = dataFiles,
        options = options)