Changeset 9528caa in sasview


Ignore:
Timestamp:
May 24, 2016 11:27:31 AM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Message:

include tinycc in build, if available; support 64-bit python

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasview/setup_exe.py

    r230178b r9528caa  
    1616import os 
    1717import sys 
     18import warnings 
     19from glob import glob 
     20import shutil 
     21 
     22from distutils.util import get_platform 
     23from distutils.core import setup 
     24from distutils.filelist import findall 
     25from distutils.sysconfig import get_python_lib 
     26import py2exe 
     27 
     28#from idlelib.PyShell import warning_stream 
    1829 
    1930# put the build directory at the front of the path 
    2031if os.path.abspath(os.path.dirname(__file__)) != os.path.abspath(os.getcwd()): 
    2132    raise RuntimeError("Must run setup_exe from the sasview directory") 
    22 from distutils.util import get_platform 
    2333root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
    2434platform = '%s-%s'%(get_platform(), sys.version[:3]) 
    2535build_path = os.path.join(root, 'build', 'lib.'+platform) 
     36#build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages') 
    2637sys.path.insert(0, build_path) 
    2738 
    2839import local_config 
     40from installer_generator import generate_installer 
     41 
     42import matplotlib 
     43try: 
     44    import tinycc 
     45except ImportError: 
     46    warnings.warn("TinyCC package is not available and will not be included") 
     47    tinycc = None 
    2948 
    3049if len(sys.argv) == 1: 
    3150    sys.argv.append('py2exe') 
     51 
    3252# When using the SasView build script, we need to be able to pass 
    3353# an extra path to be added to the python path. The extra arguments 
     
    4565                sys.exc_value 
    4666 
    47 from distutils.core import setup 
    48 from distutils.filelist import findall 
    49 import matplotlib 
    5067 
    5168# Solution taken from here: http://www.py2exe.org/index.cgi/win32com.shell 
     
    7996    pass 
    8097 
    81 import py2exe 
    82 import shutil 
    8398# Remove the build folder 
    8499shutil.rmtree("build", ignore_errors=True) 
     
    86101shutil.rmtree("dist", ignore_errors=True) 
    87102 
    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 
     103is_64bits = sys.maxsize > 2**32 
     104arch = "amd64" if is_64bits else "x86" 
     105manifest = """ 
     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 
     151if is_64bits: 
     152    msvcrtdll = glob(r"C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*") 
    96153else: 
    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\*.*") 
     155if msvcrtdll: 
     156    msvcrtdll_data_files = ("Microsoft.VC90.CRT", msvcrtdll) 
    125157else: 
    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 
    210159 
    211160 
     
    236185matplotlibdata = findall(matplotlibdatadir) 
    237186 
    238 from distutils.sysconfig import get_python_lib 
    239187site_loc = get_python_lib() 
    240188opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl") 
    241189 
    242190data_files = [] 
     191 
     192if tinycc: 
     193    data_files += tinycc.data_files() 
     194 
    243195# Copying SLD data 
    244196import periodictable 
    245 import logging 
    246197data_files += periodictable.data_files() 
    247198 
     
    339290    raise Exception("You must first build the documentation before creating an installer.") 
    340291 
    341 if py26MSdll is not None: 
     292if msvcrtdll_data_files is not None: 
    342293    # 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) 
    347295 
    348296# NOTE: 
     
    371319includes = ['site', 'lxml._elementpath', 'lxml.etree'] 
    372320 
     321if tinycc: 
     322    packages.append('tinycc') 
     323 
    373324# Exclude packages that are not needed but are often found on build systems 
    374 excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz'] 
     325excludes = ['Tkinter', 'PyQt4', '_tkagg', 'sip', 'pytz', 'sympy'] 
    375326 
    376327 
     
    402353if is_64bits: 
    403354    bundle_option = 3 
    404 import installer_generator as gen 
    405 gen.generate_installer() 
     355generate_installer() 
    406356#initialize category stuff 
    407357#from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 
Note: See TracChangeset for help on using the changeset viewer.