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
|
#! /usr/bin/env python
# BalazarBrothers
# Copyright (C) 2003-2007 Jean-Baptiste LAMY -- jiba@tuxfamily
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
import sys, os, os.path, glob, re, distutils.core, distutils.sysconfig
from distutils.core import setup
HERE = os.path.abspath(os.path.dirname(sys.argv[0]))
if "--2d" in sys.argv:
sys.argv.remove("--2d")
mode = "2d"
name = "Balazar3_2d"
extra_descr = " (2D SDL + Pygame version, 640x480, 800x480)"
extra_modules = ["balazar3.sprites"]
if "sdist" in sys.argv:
s = open(os.path.join(os.path.dirname(__file__), "globdef.py")).read()
s = re.sub(r"AVAILABLE_DRIVERS = .*", 'AVAILABLE_DRIVERS = ["2d", "2d800x480"]', s)
open(os.path.join(os.path.dirname(__file__), "globdef.py"), "w").write(s)
elif "--3d" in sys.argv:
sys.argv.remove("--3d")
mode = "3d"
name = "Balazar3_3d"
extra_descr = " (3D OpenGL + OpenAL + Soya version)"
extra_modules = []
if "sdist" in sys.argv:
s = open(os.path.join(os.path.dirname(__file__), "globdef.py")).read()
s = re.sub(r"AVAILABLE_DRIVERS = .*", 'AVAILABLE_DRIVERS = ["3d"]', s)
open(os.path.join(os.path.dirname(__file__), "globdef.py"), "w").write(s)
elif "--server" in sys.argv:
sys.argv.remove("--server")
mode = "server"
name = "Balazar3_server"
extra_descr = " (Server version)"
extra_modules = []
if "sdist" in sys.argv:
s = open(os.path.join(os.path.dirname(__file__), "globdef.py")).read()
s = re.sub(r"AVAILABLE_DRIVERS = .*", 'AVAILABLE_DRIVERS = ["dummy"]', s)
open(os.path.join(os.path.dirname(__file__), "globdef.py"), "w").write(s)
else:
mode = ""
name = "Balazar3"
extra_descr = " (2D + 3D version, with full graphic sources)"
if os.path.exists(os.path.join(os.path.dirname(__file__), "sprites")):
extra_modules = ["balazar3.sprites"]
else:
extra_modules = []
if "sdist" in sys.argv:
s = open(os.path.join(os.path.dirname(__file__), "globdef.py")).read()
s = re.sub(r"AVAILABLE_DRIVERS = .*", 'AVAILABLE_DRIVERS = ["3d", "2d", "2d800x480"]', s)
open(os.path.join(os.path.dirname(__file__), "globdef.py"), "w").write(s)
if "--no-lang" in sys.argv:
sys.argv.remove("--no-lang")
no_lang = 1
else: no_lang = 0
if "sdist" in sys.argv:
if mode == "2d":
sys.argv += ["-t", "MANIFEST_2d.in"]
elif mode == "3d":
sys.argv += ["-t", "MANIFEST_3d.in"]
elif mode == "server":
sys.argv += ["-t", "MANIFEST_server.in"]
data_files = []
def walker(dummy, dir, files):
if "CVS" in dir: return
if ".svn" in dir: return
dir2 = dir[len(HERE):]
if dir2[0] == "/": dir2 = dir2[1:]
dir2 = os.path.join("balazar3", dir2)
files = map(lambda file: os.path.join(dir, file), files)
files = filter(lambda file: os.path.isfile(file) and (not "CVS" in file) and (not ".svn" in file), files)
data_files.append((dir2, files))
subdirs_2d = [
"room_shots",
"sounds",
"sprites",
]
subdirs_3d = [
"animated_models",
"images",
"materials",
"models",
"sounds",
"worlds",
]
subdirs_all = list(set(subdirs_2d + subdirs_3d)) + [
"scripts",
"blender",
]
if mode == "2d": subdirs = subdirs_2d
elif mode == "3d": subdirs = subdirs_3d
else: subdirs = subdirs_all
for path in subdirs:
path = os.path.abspath(os.path.join(HERE, path))
os.path.walk(path, walker, None)
if not no_lang:
data_files = data_files + [
(os.path.join("balazar3", os.path.dirname(mo_file)), [mo_file])
for mo_file
in glob.glob(os.path.join(".", "locale", "*", "LC_MESSAGES", "*"))
]
distutils.core.setup(
name = name,
version = "0.1",
license = "GPL",
description = "A dungeon game%s." % extra_descr,
long_description = """A dungeon game with Balazar%s.""" % extra_descr,
author = "Jiba (LAMY Jean-Baptiste)",
author_email = "jibalamy@free.fr",
url = "http://home.gna.org/oomadness/en/balazar3/index.html",
classifiers = [
"Topic :: Games/Entertainment",
"Topic :: Games/Entertainment :: Role-Playing",
"Natural Language :: French",
"Natural Language :: English",
"Programming Language :: Python",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: GNU General Public License (GPL)",
],
scripts = ["balazar3"],
package_dir = {"balazar3" : ""},
packages = ["balazar3", "balazar3.tofu", "balazar3.rooms"] + extra_modules,
data_files = data_files,
)
|