| 1 | #!/usr/bin/env python |
|---|
| 2 | # |
|---|
| 3 | # Puzzlebox - Brainstorms - Distutils |
|---|
| 4 | # |
|---|
| 5 | # Copyright Puzzlebox Productions, LLC (2010) |
|---|
| 6 | # |
|---|
| 7 | # This code is released under the GNU Pulic License (GPL) version 2 |
|---|
| 8 | # For more information please refer to http://www.gnu.org/copyleft/gpl.html |
|---|
| 9 | # |
|---|
| 10 | # Last Update: 2011.04.14 |
|---|
| 11 | # |
|---|
| 12 | ##################################################################### |
|---|
| 13 | |
|---|
| 14 | from distutils.core import setup |
|---|
| 15 | import os, sys |
|---|
| 16 | import glob |
|---|
| 17 | |
|---|
| 18 | if (sys.platform == 'win32'): |
|---|
| 19 | import py2exe |
|---|
| 20 | import shutil |
|---|
| 21 | # import matplotlib |
|---|
| 22 | |
|---|
| 23 | ##################################################################### |
|---|
| 24 | # Main |
|---|
| 25 | ##################################################################### |
|---|
| 26 | |
|---|
| 27 | if __name__ != '__main__': |
|---|
| 28 | |
|---|
| 29 | sys.exit() |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | ##dllList = ( \ |
|---|
| 33 | ### 'mfc90.dll', \ |
|---|
| 34 | ### 'msvcp90.dll', \ |
|---|
| 35 | ### 'qtnetwork.pyd', \ |
|---|
| 36 | ### 'qtxmlpatterns4.dll', \ |
|---|
| 37 | ## 'qsvg4.dll', \ |
|---|
| 38 | ### 'qsvgd4.dll', \ |
|---|
| 39 | ## 'qsvgicon4.dll', \ |
|---|
| 40 | ## 'QtSvg4.dll') |
|---|
| 41 | #origIsSystemDLL = py2exe.build_exe.isSystemDLL |
|---|
| 42 | #def isSystemDLL(pathname): |
|---|
| 43 | # #print os.path.basename(pathname).lower() |
|---|
| 44 | # if os.path.basename(pathname).lower() in dllList: |
|---|
| 45 | # return 0 |
|---|
| 46 | # return origIsSystemDLL(pathname) |
|---|
| 47 | #py2exe.build_exe.isSystemDLL = isSystemDLL |
|---|
| 48 | |
|---|
| 49 | if (sys.platform == 'win32'): |
|---|
| 50 | |
|---|
| 51 | # Remove the build folder, a bit slower but ensures that build contains the latest |
|---|
| 52 | shutil.rmtree("build", ignore_errors=True) |
|---|
| 53 | |
|---|
| 54 | options={"py2exe": { \ |
|---|
| 55 | "includes": [ \ |
|---|
| 56 | "sip", \ |
|---|
| 57 | #"PyQt4._qt", \ |
|---|
| 58 | # "numpy", "pylab", \ |
|---|
| 59 | # "matplotlib", \ |
|---|
| 60 | # "matplotlib.backends", \ |
|---|
| 61 | # "matplotlib.backends.backend_qt4agg", \ |
|---|
| 62 | # "matplotlib.figure", \ |
|---|
| 63 | # "matplotlib.numerix.fft", \ |
|---|
| 64 | # "matplotlib.numerix.linear_algebra", \ |
|---|
| 65 | # "matplotlib.numerix.random_array", \ |
|---|
| 66 | # "matplotlib.backends.backend_tkagg", \ |
|---|
| 67 | "PyQt4.QtSvg", \ |
|---|
| 68 | ], \ |
|---|
| 69 | # "dllList": [ \ |
|---|
| 70 | # "qsvgicon4.dll"], \ |
|---|
| 71 | "excludes": [ \ |
|---|
| 72 | "bluetooth", "tcl", \ |
|---|
| 73 | '_gtkagg', '_tkagg', '_agg2', \ |
|---|
| 74 | '_cairo', '_cocoaagg', \ |
|---|
| 75 | '_fltkagg', '_gtk', '_gtkcairo'], \ |
|---|
| 76 | "dll_excludes": [ \ |
|---|
| 77 | 'tcl84.dll', 'tk84.dll' \ |
|---|
| 78 | 'libgdk-win32-2.0-0.dll', |
|---|
| 79 | 'libgobject-2.0-0.dll'], \ |
|---|
| 80 | #"packages": ["pytz"], \ |
|---|
| 81 | "compressed": 2, \ |
|---|
| 82 | "optimize": 2, \ |
|---|
| 83 | "bundle_files": 2, \ |
|---|
| 84 | "dist_dir": "dist", \ |
|---|
| 85 | "xref": False, \ |
|---|
| 86 | "skip_archive": False, \ |
|---|
| 87 | } |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | data_files=[(".", \ |
|---|
| 91 | ["puzzlebox_brainstorms_configuration.ini"]), |
|---|
| 92 | ("images", \ |
|---|
| 93 | ["images/puzzlebox.ico", \ |
|---|
| 94 | "images/1-upper_left-orange.png", \ |
|---|
| 95 | "images/1-upper_left-white.png", \ |
|---|
| 96 | "images/2-up-orange.png", \ |
|---|
| 97 | "images/2-up-white.png", \ |
|---|
| 98 | "images/3-upper_right-orange.png", \ |
|---|
| 99 | "images/3-upper_right-white.png", \ |
|---|
| 100 | "images/7-lower_left-orange.png", \ |
|---|
| 101 | "images/7-lower_left-white.png", \ |
|---|
| 102 | "images/8-down-orange.png", \ |
|---|
| 103 | "images/8-down-white.png", \ |
|---|
| 104 | "images/9-lower_right-orange.png", \ |
|---|
| 105 | "images/9-lower_right-white.png", \ |
|---|
| 106 | "images/puzzlebox_logo.png", \ |
|---|
| 107 | "images/brainstorms-aileron_left.svg", \ |
|---|
| 108 | "images/brainstorms-aileron_right.svg", \ |
|---|
| 109 | "images/brainstorms-elevator_forward.svg", \ |
|---|
| 110 | "images/brainstorms-elevator_reverse.svg", \ |
|---|
| 111 | "images/brainstorms-fly_forward.svg", \ |
|---|
| 112 | "images/brainstorms-hover.svg", \ |
|---|
| 113 | "images/brainstorms-land_arrow.svg", \ |
|---|
| 114 | "images/brainstorms-rudder-left.svg", \ |
|---|
| 115 | "images/brainstorms-rudder-right.svg", \ |
|---|
| 116 | "images/brainstorms_stop.svg", \ |
|---|
| 117 | "images/brainstorms_wheelchair_forward.svg", \ |
|---|
| 118 | "images/brainstorms_wheelchair_left.svg", \ |
|---|
| 119 | "images/brainstorms_wheelchair_reverse.svg", \ |
|---|
| 120 | "images/brainstorms_wheelchair_right.svg", \ |
|---|
| 121 | "images/braintorms-throttle_up.svg", \ |
|---|
| 122 | "images/puzzlebox_helicopter.svg", \ |
|---|
| 123 | ]), |
|---|
| 124 | ] |
|---|
| 125 | |
|---|
| 126 | # Add the mpl mpl-data folder and rc file |
|---|
| 127 | # data_files += matplotlib.get_py2exe_datafiles() |
|---|
| 128 | |
|---|
| 129 | # matplotlib.use('Qt4Agg') # overrule configuration |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | else: |
|---|
| 133 | options={} |
|---|
| 134 | |
|---|
| 135 | data_files=[("/etc/puzzlebox_brainstorms", \ |
|---|
| 136 | ["puzzlebox_brainstorms_configuration.ini"]), |
|---|
| 137 | ("/usr/share/puzzlebox_brainstorms/images", \ |
|---|
| 138 | ["images/puzzlebox.ico", \ |
|---|
| 139 | "images/1-upper_left-orange.png", \ |
|---|
| 140 | "images/1-upper_left-white.png", \ |
|---|
| 141 | "images/2-up-orange.png", \ |
|---|
| 142 | "images/2-up-white.png", \ |
|---|
| 143 | "images/3-upper_right-orange.png", \ |
|---|
| 144 | "images/3-upper_right-white.png", \ |
|---|
| 145 | "images/7-lower_left-orange.png", \ |
|---|
| 146 | "images/7-lower_left-white.png", \ |
|---|
| 147 | "images/8-down-orange.png", \ |
|---|
| 148 | "images/8-down-white.png", \ |
|---|
| 149 | "images/9-lower_right-orange.png", \ |
|---|
| 150 | "images/9-lower_right-white.png", \ |
|---|
| 151 | "images/puzzlebox_logo.png", \ |
|---|
| 152 | "images/brainstorms-aileron_left.svg", \ |
|---|
| 153 | "images/brainstorms-aileron_right.svg", \ |
|---|
| 154 | "images/brainstorms-elevator_forward.svg", \ |
|---|
| 155 | "images/brainstorms-elevator_reverse.svg", \ |
|---|
| 156 | "images/brainstorms-fly_forward.svg", \ |
|---|
| 157 | "images/brainstorms-hover.svg", \ |
|---|
| 158 | "images/brainstorms-land_arrow.svg", \ |
|---|
| 159 | "images/brainstorms-rudder-left.svg", \ |
|---|
| 160 | "images/brainstorms-rudder-right.svg", \ |
|---|
| 161 | "images/brainstorms_stop.svg", \ |
|---|
| 162 | "images/brainstorms_wheelchair_forward.svg", \ |
|---|
| 163 | "images/brainstorms_wheelchair_left.svg", \ |
|---|
| 164 | "images/brainstorms_wheelchair_reverse.svg", \ |
|---|
| 165 | "images/brainstorms_wheelchair_right.svg", \ |
|---|
| 166 | "images/braintorms-throttle_up.svg", \ |
|---|
| 167 | "images/puzzlebox_helicopter.svg", \ |
|---|
| 168 | ]), |
|---|
| 169 | ("/usr/share/applications", \ |
|---|
| 170 | ["puzzlebox_brainstorms.desktop"]), |
|---|
| 171 | ] |
|---|
| 172 | |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | setup( |
|---|
| 176 | name='puzzlebox_brainstorms', |
|---|
| 177 | version='0.6.0', |
|---|
| 178 | description='Puzzlebox Brainstorms provides Brain-Computer Interface (BCI) controls for robots and devices', |
|---|
| 179 | author='Steve Castellotti', |
|---|
| 180 | author_email='sc@puzzlebox.info', |
|---|
| 181 | url='http://brainstorms.puzzlebox.info', |
|---|
| 182 | py_modules=['Puzzlebox', \ |
|---|
| 183 | 'Puzzlebox.Brainstorms', \ |
|---|
| 184 | 'Puzzlebox.Brainstorms.Server', \ |
|---|
| 185 | 'Puzzlebox.Brainstorms.Client', \ |
|---|
| 186 | 'Puzzlebox.Brainstorms.Interface', \ |
|---|
| 187 | 'Puzzlebox.Brainstorms.Interface_Design', \ |
|---|
| 188 | 'Puzzlebox.Brainstorms.Helicopter_Control', \ |
|---|
| 189 | 'Puzzlebox.Brainstorms.iRobot_Control', \ |
|---|
| 190 | 'Puzzlebox.Brainstorms.NXT_Control', \ |
|---|
| 191 | 'Puzzlebox.Brainstorms.Wheelchair_Control', \ |
|---|
| 192 | 'Puzzlebox.Brainstorms.Configuration', \ |
|---|
| 193 | 'Puzzlebox.Brainstorms.iRobot.pyrobot', \ |
|---|
| 194 | 'Puzzlebox.Brainstorms.ThinkGear.Client', \ |
|---|
| 195 | 'brainstorms-local', \ |
|---|
| 196 | 'brainstorms-network', \ |
|---|
| 197 | ], \ |
|---|
| 198 | # console=["puzzlebox_brainstorms_remote_control.py", \ |
|---|
| 199 | # "puzzlebox_brainstorms_network_server.py", \ |
|---|
| 200 | # "puzzlebox_brainstorms_network_client.py", \ |
|---|
| 201 | # "puzzlebox_brainstorms_network_client_thinkgear.py"], |
|---|
| 202 | console=["brainstorms-local.py", \ |
|---|
| 203 | "brainstorms-network.py" |
|---|
| 204 | ], |
|---|
| 205 | # options={"py2exe":{"includes":["sip"]}}, |
|---|
| 206 | options=options, \ |
|---|
| 207 | zipfile = r'lib\library.zip', |
|---|
| 208 | # data_files=[("puzzlebox_brainstorms_configuration.ini"), |
|---|
| 209 | # ("images", |
|---|
| 210 | # glob.glob(os.path.join('images', '*.*'))), |
|---|
| 211 | # #("fonts", |
|---|
| 212 | # #glob.glob(os.path.join('fonts', '*.*'))) |
|---|
| 213 | # ], |
|---|
| 214 | data_files=data_files, \ |
|---|
| 215 | windows=[ \ |
|---|
| 216 | #{ |
|---|
| 217 | #"script": "puzzlebox_brainstorms_network_server.py", |
|---|
| 218 | #"icon_resources": [(1, \ |
|---|
| 219 | #os.path.join("images", "puzzlebox.ico"))] |
|---|
| 220 | #}, |
|---|
| 221 | { |
|---|
| 222 | "script": "brainstorms-local.py", |
|---|
| 223 | "icon_resources": [(1, \ |
|---|
| 224 | os.path.join("images", "puzzlebox.ico"))] |
|---|
| 225 | }, |
|---|
| 226 | # { |
|---|
| 227 | # "script": "puzzlebox_brainstorms_client_interface_local.py", |
|---|
| 228 | # "icon_resources": [(1, \ |
|---|
| 229 | # os.path.join("images", "puzzlebox.ico"))] |
|---|
| 230 | # }, |
|---|
| 231 | ], |
|---|
| 232 | classifiers=[ \ |
|---|
| 233 | 'Development Status :: 4 - Beta', |
|---|
| 234 | 'Intended Audience :: End Users/Desktop', |
|---|
| 235 | 'Programming Language :: Python', |
|---|
| 236 | 'Operating System :: OS Independent', |
|---|
| 237 | 'License :: OSI Approved :: GNU General Public License (GPL)', |
|---|
| 238 | 'Topic :: Scientific/Engineering :: Human Machine Interfaces', |
|---|
| 239 | ], |
|---|
| 240 | ) |
|---|
| 241 | |
|---|