comparison setup.py @ 301:8d6647c912b3

Initial stab at setup.py.
author Simon Cross <hodgestar@gmail.com>
date Sat, 05 Sep 2009 16:47:10 +0000
parents
children 2db4673ea6c2
comparison
equal deleted inserted replaced
300:de97648d279e 301:8d6647c912b3
1 # setup.py
2 # -*- coding: utf8 -*-
3 # vim:fileencoding=utf8 ai ts=4 sts=4 et sw=4
4
5 """Setuptools setup.py file for Operation Fox Assault."""
6
7 from setuptools import setup, find_packages
8 from gamelib import version
9
10 try:
11 import py2exe
12 from py2exe.build_exe import py2exe as builder
13 import os
14 import glob
15
16 class PkgResourceBuilder(builder):
17 def copy_extensions(self, extensions):
18 """Hack the py2exe C extension copier
19 to put pkg_resources into the
20 library.zip file.
21 """
22 builder.copy_extensions(self, extensions)
23 package_data = self.distribution.package_data.copy()
24
25 for package, patterns in self.distribution.package_data.items():
26 package_dir = os.path.join(*package.split('.'))
27 collect_dir = os.path.join(self.collect_dir, package_dir)
28
29 # create sub-dirs in py2exe collection area
30 # Copy the media files to the collection dir.
31 # Also add the copied file to the list of compiled
32 # files so it will be included in zipfile.
33 for pattern in patterns:
34 pattern = os.path.join(*pattern.split('/'))
35 for f in glob.glob(os.path.join(package_dir, pattern)):
36 name = os.path.basename(f)
37 folder = os.path.join(collect_dir, os.path.dirname(f))
38 if not os.path.exists(folder):
39 self.mkpath(folder)
40 self.copy_file(f, os.path.join(collect_dir, name))
41 self.compiled_files.append(os.path.join(package_dir, name))
42
43 except ImportError:
44 PkgResourceBuilder = None
45
46 setup ( # Metadata
47 name = version.NAME,
48 version = version.VERSION_STR,
49 description = version.DESCRIPTION,
50
51 author = version.AUTHOR_NAME,
52 author_email = version.AUTHOR_EMAIL,
53
54 maintainer = version.MAINTAINER_NAME,
55 maintainer_email = version.MAINTAINER_EMAIL,
56
57 # url = version.SOURCEFORGE_URL,
58 # download_url = version.PYPI_URL,
59
60 license = version.LICENSE,
61
62 classifiers = version.CLASSIFIERS,
63
64 platforms = version.PLATFORMS,
65
66 # Dependencies
67 install_requires = version.INSTALL_REQUIRES,
68
69 # Files
70 packages = find_packages(),
71 package_data = {
72 # NOTE: PkgResourceBuilder cannot handle the
73 # catch-all empty package ''.
74 # Include SVG files from sutekh.gui package
75 #'sutekh.gui': ['*.svg'],
76 # Include LICENSE information for sutekh package
77 # Include everything under the docs directory
78 #'sutekh': ['COPYING', 'docs/html/*'],
79 },
80 scripts = ['scripts/foxassault.py','scripts/testconsole.py'],
81
82 # py2exe
83 console = ['scripts/testconsole.py'],
84 windows = [{
85 'script': 'scripts/foxassault.py',
86 # 'icon_resources': [(0, "artwork/sutekh-icon-inkscape.ico")],
87 }],
88 cmdclass = {
89 'py2exe': PkgResourceBuilder,
90 },
91 options = { 'py2exe': {
92 'skip_archive': 1,
93 'dist_dir': 'dist/foxassault-%s' % version.VERSION_STR,
94 'packages': [
95 'logging', 'encodings',
96 ],
97 'includes': [
98 # pygame
99 'pygame', 'pgu',
100 ],
101 'excludes': [
102 ],
103 'ignores': [
104 # all database modules except sqlite3
105 'pgdb', 'Sybase', 'adodbapi',
106 'kinterbasdb', 'psycopg', 'psycopg2', 'pymssql',
107 'sapdb', 'pysqlite2', 'sqlite',
108 'MySQLdb', 'MySQLdb.connections',
109 'MySQLdb.constants.CR', 'MySQLdb.constants.ER',
110 # old datetime equivalents
111 'DateTime', 'DateTime.ISO',
112 'mx', 'mx.DateTime', 'mx.DateTime.ISO',
113 # email modules
114 'email.Generator', 'email.Iterators', 'email.Utils',
115 # GDK related imports we can ignore
116 'gdk', 'ltihooks',
117 # ignore things include in Python >= 2.5
118 'elementtree.ElementTree',
119 ],
120 }},
121 data_files = [
122 'COPYRIGHT',
123 'COPYING',
124 ],
125 )