Mercurial > rinkhals
comparison setup.py @ 343:d7771ea76d33
Clean-up setup.py
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 23:01:11 +0000 |
parents | 2f83360e6442 |
children | 1b35fceccaaa |
comparison
equal
deleted
inserted
replaced
342:0d42622dbe12 | 343:d7771ea76d33 |
---|---|
7 from setuptools import setup, find_packages | 7 from setuptools import setup, find_packages |
8 from gamelib import version | 8 from gamelib import version |
9 | 9 |
10 try: | 10 try: |
11 import py2exe | 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: | 12 except ImportError: |
44 PkgResourceBuilder = None | 13 pass |
45 | 14 |
46 setup ( # Metadata | 15 setup ( # Metadata |
47 name = version.NAME, | 16 name = version.NAME, |
48 version = version.VERSION_STR, | 17 version = version.VERSION_STR, |
49 description = version.DESCRIPTION, | 18 description = version.DESCRIPTION, |
66 # Dependencies | 35 # Dependencies |
67 install_requires = version.INSTALL_REQUIRES, | 36 install_requires = version.INSTALL_REQUIRES, |
68 | 37 |
69 # Files | 38 # Files |
70 packages = find_packages(), | 39 packages = find_packages(), |
71 package_data = { | 40 scripts = ['scripts/foxassault.py', 'scripts/testconsole.py'], |
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 | 41 |
82 # py2exe | 42 # py2exe |
83 console = ['scripts/testconsole.py'], | 43 console = ['scripts/testconsole.py'], |
84 windows = [{ | 44 windows = [{ |
85 'script': 'scripts/foxassault.py', | 45 'script': 'scripts/foxassault.py', |
86 # 'icon_resources': [(0, "artwork/sutekh-icon-inkscape.ico")], | 46 'icon_resources': [(0, "data/icons/foxassault.ico")], |
87 }], | 47 }], |
88 app = ['scripts/foxassault.py'], | 48 app = ['scripts/foxassault.py'], |
89 cmdclass = { | |
90 'py2exe': PkgResourceBuilder, | |
91 }, | |
92 options = { 'py2exe': { | 49 options = { 'py2exe': { |
93 'skip_archive': 1, | 50 'skip_archive': 1, |
94 'dist_dir': 'dist/foxassault-%s' % version.VERSION_STR, | 51 'dist_dir': 'dist/foxassault-%s' % version.VERSION_STR, |
95 'packages': [ | 52 'packages': [ |
96 'logging', 'encodings', | 53 'logging', 'encodings', |
126 'excludes': ['numpy', 'pgu'], | 83 'excludes': ['numpy', 'pgu'], |
127 }}, | 84 }}, |
128 data_files = [ | 85 data_files = [ |
129 'COPYRIGHT', | 86 'COPYRIGHT', |
130 'COPYING', | 87 'COPYING', |
88 'README.txt', | |
131 ], | 89 ], |
132 ) | 90 ) |