1
1
#!/usr/bin/env python
3
"""setup -- setuptools setup file for Enjuewemela."""
3
# Copyright 2011 Facundo Batista
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 3, as published
7
# by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranties of
11
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License along
15
# with this program. If not, see <http://www.gnu.org/licenses/>.
17
# For further info, check https://launchpad.net/encuentro
5
__author__ = "Facundo Batista"
6
__author_email__ = "facundo en taniquetil punto com punto ar"
8
__date__ = "2010-04-08"
19
"""Setup file for Enjuewemela."""
24
from distutils.command.install import install
13
25
from distutils.core import setup
16
Crazy game with a lot of gems that tend to dissappear strangely
17
following user actions.
20
def recursive(base, dirs):
23
for basedir, dirnames, filenames in os.walk(os.path.join(base, d)):
24
# all_files.extend(os.path.join(basedir, x) for x in dirnames)
25
all_files.extend(os.path.join(basedir, x) for x in filenames)
28
lenbase = len(base) + 1
29
return [x[lenbase:] for x in all_files]
31
def get_sub_packages(basedir):
33
for directory, dirnames, filenames in os.walk(basedir):
34
if "__init__.py" in filenames:
35
packpath = directory.replace("/", ".")
36
all_packages.append(packpath)
28
class CustomInstall(install):
29
"""Custom installation class on package files.
31
It copies all the files into the "PREFIX/share/PROJECTNAME" dir.
34
"""Run parent install, and then save the install dir in the script."""
37
for script in self.distribution.scripts:
38
script_path = os.path.join(self.install_scripts,
39
os.path.basename(script))
40
with open(script_path, 'rb') as fh:
42
content = content.replace('@ INSTALLED_BASE_DIR @',
43
self._custom_data_dir)
44
with open(script_path, 'wb') as fh:
48
def finalize_options(self):
49
"""Alter the installation path."""
50
install.finalize_options(self)
52
# the data path is under 'prefix'
53
data_dir = os.path.join(self.prefix, "share",
54
self.distribution.get_name())
56
# if we have 'root', put the building path also under it (used normally
61
build_dir = os.path.join(self.root, data_dir[1:])
63
# change the lib install directory so all package files go inside here
64
self.install_lib = build_dir
66
# save this custom data dir to later change the scripts
67
self._custom_data_dir = data_dir
70
#def recursive(base, dirs):
73
# for basedir, dirnames, filenames in os.walk(os.path.join(base, d)):
74
## all_files.extend(os.path.join(basedir, x) for x in dirnames)
75
# all_files.extend(os.path.join(basedir, x) for x in filenames)
77
# # remove the base dir
78
# lenbase = len(base) + 1
79
# return [x[lenbase:] for x in all_files]
81
#def get_sub_packages(basedir):
83
# for directory, dirnames, filenames in os.walk(basedir):
84
# if "__init__.py" in filenames:
85
# packpath = directory.replace("/", ".")
86
# all_packages.append(packpath)
90
# first of all, remove .pyc files
91
for dirpath, dirname, filenames in os.walk('enjuewemela'):
92
for fname in filenames:
93
if fname.endswith('.pyc'):
94
os.remove(os.path.join(dirpath, fname))
40
97
name = 'enjuewemela',
41
version = __version__,
43
author_email = __author_email__,
44
description = __description__,
45
url = 'https://launchpad.net/enjuewemela/',
47
packages = ['enjuewemela', 'enjuewemela.cocos'] +
48
get_sub_packages("enjuewemela/cocos/cocos"),
51
'enjuewemela': recursive('enjuewemela',
52
['audio', 'fonts', 'images', 'jewels', 'locale', 'tests']),
53
'enjuewemela.cocos': ['README'] + glob.glob('LICENSE*'),
54
'enjuewemela.cocos.cocos': ['resources/*'],
100
author = 'Facundo Batista',
101
author_email = 'facundo@taniquetil.com.ar',
102
description = "The crazy gems game",
103
long_description = "Crazy game with a lot of gems that tend to dissappear"\
104
" strangely following user actions.",
105
url = 'http://launchpad.net/enjuewemela/',
107
packages = ['enjuewemela', 'enjuewemela.cocos'],
108
# packages = ['enjuewemela'] +
109
# get_sub_packages("enjuewemela/cocos/cocos"),
112
# 'enjuewemela': recursive('enjuewemela',
113
# ['audio', 'fonts', 'images', 'jewels', 'locale', 'tests']),
114
# 'enjuewemela.cocos': ['README'] + glob.glob('LICENSE*'),
115
# 'enjuewemela.cocos.cocos': ['resources/*'],
117
scripts = ["bin/enjuewemela"],
119
'install': CustomInstall,