Changeset 9528caa in sasview
- Timestamp:
- May 24, 2016 11:27:31 AM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 1be5202
- Parents:
- f225cc1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasview/setup_exe.py
r230178b r9528caa 16 16 import os 17 17 import sys 18 import warnings 19 from glob import glob 20 import shutil 21 22 from distutils.util import get_platform 23 from distutils.core import setup 24 from distutils.filelist import findall 25 from distutils.sysconfig import get_python_lib 26 import py2exe 27 28 #from idlelib.PyShell import warning_stream 18 29 19 30 # put the build directory at the front of the path 20 31 if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 21 32 raise RuntimeError("Must run setup_exe from the sasview directory") 22 from distutils.util import get_platform23 33 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 24 34 platform = '%s-%s'%(get_platform(), sys.version[:3]) 25 35 build_path = os.path.join(root, 'build', 'lib.'+platform) 36 #build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages') 26 37 sys.path.insert(0, build_path) 27 38 28 39 import local_config 40 from installer_generator import generate_installer 41 42 import matplotlib 43 try: 44 import tinycc 45 except ImportError: 46 warnings.warn("TinyCC package is not available and will not be included") 47 tinycc = None 29 48 30 49 if len(sys.argv) == 1: 31 50 sys.argv.append('py2exe') 51 32 52 # When using the SasView build script, we need to be able to pass 33 53 # an extra path to be added to the python path. The extra arguments … … 45 65 sys.exc_value 46 66 47 from distutils.core import setup48 from distutils.filelist import findall49 import matplotlib50 67 51 68 # Solution taken from here: http://www.py2exe.org/index.cgi/win32com.shell … … 79 96 pass 80 97 81 import py2exe82 import shutil83 98 # Remove the build folder 84 99 shutil.rmtree("build", ignore_errors=True) … … 86 101 shutil.rmtree("dist", ignore_errors=True) 87 102 88 if sys.version_info < (2, 6): 89 is_64bits = False 90 origIsSystemDLL = py2exe.build_exe.isSystemDLL 91 def isSystemDLL(pathname): 92 if os.path.basename(pathname).lower() in ("msvcp71.dll", "comctl32.dll"): 93 return 0 94 return origIsSystemDLL(pathname) 95 py2exe.build_exe.isSystemDLL = isSystemDLL 103 is_64bits = sys.maxsize > 2**32 104 arch = "amd64" if is_64bits else "x86" 105 manifest = """ 106 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 107 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 108 <assemblyIdentity 109 version="5.0.0.0" 110 processorArchitecture="%(arch)s" 111 name="SasView" 112 type="win32"> 113 </assemblyIdentity> 114 <description>SasView</description> 115 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> 116 <security> 117 <requestedPrivileges> 118 <requestedExecutionLevel 119 level="asInvoker" 120 uiAccess="false"> 121 </requestedExecutionLevel> 122 </requestedPrivileges> 123 </security> 124 </trustInfo> 125 <dependency> 126 <dependentAssembly> 127 <assemblyIdentity 128 type="win32" 129 name="Microsoft.VC90.CRT" 130 version="9.0.21022.8" 131 processorArchitecture="%(arch)s" 132 publicKeyToken="1fc8b3b9a1e18e3b"> 133 </assemblyIdentity> 134 </dependentAssembly> 135 </dependency> 136 <dependency> 137 <dependentAssembly> 138 <assemblyIdentity 139 type="win32" 140 name="Microsoft.Windows.Common-Controls" 141 version="6.0.0.0" 142 processorArchitecture="%(arch)s" 143 publicKeyToken="6595b64144ccf1df" 144 language="*"> 145 </assemblyIdentity> 146 </dependentAssembly> 147 </dependency> 148 </assembly> 149 """%{'arch': arch} 150 151 if is_64bits: 152 msvcrtdll = glob(r"C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 96 153 else: 97 is_64bits = sys.maxsize > 2**32 98 99 if is_64bits and sys.version_info >= (2, 6): 100 manifest = """ 101 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 102 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" 103 manifestVersion="1.0"> 104 <assemblyIdentity 105 version="0.64.1.0" 106 processorArchitecture="amd64" 107 name="Controls" 108 type="win32" 109 /> 110 <description>SasView</description> 111 <dependency> 112 <dependentAssembly> 113 <assemblyIdentity 114 type="win32" 115 name="Microsoft.Windows.Common-Controls" 116 version="6.0.0.0" 117 processorArchitecture="amd64" 118 publicKeyToken="6595b64144ccf1df" 119 language="*" 120 /> 121 </dependentAssembly> 122 </dependency> 123 </assembly> 124 """ 154 msvcrtdll = glob(r"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 155 if msvcrtdll: 156 msvcrtdll_data_files = ("Microsoft.VC90.CRT", msvcrtdll) 125 157 else: 126 manifest_for_python26 = """ 127 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 128 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 129 <assemblyIdentity 130 version="5.0.0.0" 131 processorArchitecture="x86" 132 name="SasView" 133 type="win32"> 134 </assemblyIdentity> 135 <description>SasView</description> 136 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> 137 <security> 138 <requestedPrivileges> 139 <requestedExecutionLevel 140 level="asInvoker" 141 uiAccess="false"> 142 </requestedExecutionLevel> 143 </requestedPrivileges> 144 </security> 145 </trustInfo> 146 <dependency> 147 <dependentAssembly> 148 <assemblyIdentity 149 type="win32" 150 name="Microsoft.VC90.CRT" 151 version="9.0.21022.8" 152 processorArchitecture="x86" 153 publicKeyToken="1fc8b3b9a1e18e3b"> 154 </assemblyIdentity> 155 </dependentAssembly> 156 </dependency> 157 <dependency> 158 <dependentAssembly> 159 <assemblyIdentity 160 type="win32" 161 name="Microsoft.Windows.Common-Controls" 162 version="6.0.0.0" 163 processorArchitecture="x86" 164 publicKeyToken="6595b64144ccf1df" 165 language="*"> 166 </assemblyIdentity> 167 </dependentAssembly> 168 </dependency> 169 </assembly> 170 """ 171 manifest_for_python25 = """ 172 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 173 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" 174 manifestVersion="1.0"> 175 <assemblyIdentity 176 version="0.64.1.0" 177 processorArchitecture="x86" 178 name="Controls" 179 type="win32" 180 /> 181 <description>SasView</description> 182 <dependency> 183 <dependentAssembly> 184 <assemblyIdentity 185 type="win32" 186 name="Microsoft.Windows.Common-Controls" 187 version="6.0.0.0" 188 processorArchitecture="X86" 189 publicKeyToken="6595b64144ccf1df" 190 language="*" 191 /> 192 </dependentAssembly> 193 </dependency> 194 </assembly> 195 """ 196 197 # Select the appropriate manifest to use. 198 py26MSdll_x86 = None 199 if sys.version_info >= (3, 0) or sys.version_info < (2, 6): 200 print "*** This script only works with Python 2.6 or 2.7." 201 sys.exit() 202 elif sys.version_info >= (2, 6): 203 manifest = manifest_for_python26 204 from glob import glob 205 py26MSdll = glob(r"C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 206 try: 207 py26MSdll_x86 = glob(r"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 208 except: 209 pass 158 msvcrtdll_data_files = None 210 159 211 160 … … 236 185 matplotlibdata = findall(matplotlibdatadir) 237 186 238 from distutils.sysconfig import get_python_lib239 187 site_loc = get_python_lib() 240 188 opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 241 189 242 190 data_files = [] 191 192 if tinycc: 193 data_files += tinycc.data_files() 194 243 195 # Copying SLD data 244 196 import periodictable 245 import logging246 197 data_files += periodictable.data_files() 247 198 … … 339 290 raise Exception("You must first build the documentation before creating an installer.") 340 291 341 if py26MSdllis not None:292 if msvcrtdll_data_files is not None: 342 293 # install the MSVC 9 runtime dll's into the application folder 343 data_files.append(("Microsoft.VC90.CRT", py26MSdll)) 344 if py26MSdll_x86 is not None: 345 # install the MSVC 9 runtime dll's into the application folder 346 data_files.append(("Microsoft.VC90.CRT", py26MSdll_x86)) 294 data_files.append(msvcrtdll_data_files) 347 295 348 296 # NOTE: … … 371 319 includes = ['site', 'lxml._elementpath', 'lxml.etree'] 372 320 321 if tinycc: 322 packages.append('tinycc') 323 373 324 # Exclude packages that are not needed but are often found on build systems 374 excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz' ]325 excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy'] 375 326 376 327 … … 402 353 if is_64bits: 403 354 bundle_option = 3 404 import installer_generator as gen 405 gen.generate_installer() 355 generate_installer() 406 356 #initialize category stuff 407 357 #from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller
Note: See TracChangeset
for help on using the changeset viewer.