77
88import os .path
99import sys
10+ import glob
1011import setuptools
1112import distutils # Just for deleting the "build" directory.
1213try :
2324except Exception :
2425 pass
2526
27+ def package_to_path (package ):
28+ return package .replace ('.' , '/' )
29+
2630def get_packages ():
2731 return ['garlicsim_wx.' + p for p
2832 in setuptools .find_packages ('./garlicsim_wx' )] + \
2933 ['garlicsim_wx' ]
3034
3135packages = get_packages ()
3236
37+ def get_all_data_files ():
38+ total_data_files = []
39+ for package in packages :
40+ path = package_to_path (package )
41+ all_files_and_folders = glob .glob (path + '/*' )
42+ data_files = [f for f in all_files_and_folders if
43+ (not '.py' in f [4 :]) and (not os .path .isdir (f ))]
44+ total_data_files += data_files
45+ return total_data_files
46+
47+ g = get_all_data_files ()
48+
3349my_long_description = \
3450'''\
3551 garlicsim_wx, a wxPython GUI for garlicsim.
@@ -49,24 +65,8 @@ def get_packages():
4965]
5066
5167
52-
53- setuptools .setup (
54- name = 'garlicsim_wx' ,
55- version = '0.4' ,
56- requires = ['garlicsim (== 0.4)' ],
57- install_requires = ['garlicsim == 0.4' ],
58- description = 'Gui for garlicsim, a Pythonic framework for working with simulations' ,
59- author = 'Ram Rachum' ,
60- author_email = 'cool-rr@cool-rr.com' ,
61- url = 'http://garlicsim.org' ,
62- packages = packages ,
63- license = 'Proprietary' ,
64- long_description = my_long_description ,
65- classifiers = my_classifiers ,
66- include_package_data = True ,
67-
68- # For py2exe:
69- windows = [
68+ py2exe_kwargs = {
69+ 'windows' : [
7070 {
7171 'script' : 'py2exe_cruft/GarlicSim.py' ,
7272 'icon_resources' : [
@@ -77,10 +77,31 @@ def get_packages():
7777 ]
7878 }
7979 ],
80- options = {
80+ 'zipfile' : 'lib/library.zip' ,
81+ 'data_files' : g ,
82+ 'options' : {
8183 'py2exe' : {
8284 'dist_dir' : 'py2exe_dist' ,
8385 'packages' : packages
8486 }
8587 }
88+ }
89+
90+ more_kwargs = py2exe_kwargs if `py2exe` in sys .argv else {}
91+
92+ setuptools .setup (
93+ name = 'garlicsim_wx' ,
94+ version = '0.4' ,
95+ requires = ['garlicsim (== 0.4)' ],
96+ install_requires = ['garlicsim == 0.4' ],
97+ description = 'Gui for garlicsim, a Pythonic framework for working with simulations' ,
98+ author = 'Ram Rachum' ,
99+ author_email = 'cool-rr@cool-rr.com' ,
100+ url = 'http://garlicsim.org' ,
101+ packages = packages ,
102+ license = 'Proprietary' ,
103+ long_description = my_long_description ,
104+ classifiers = my_classifiers ,
105+ include_package_data = True ,
106+ ** more_kwargs
86107)
0 commit comments