source: sasview/sansview/setup_exe.py @ 09e89b7

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 09e89b7 was 2d74016, checked in by Jae Cho <jhjcho@…>, 13 years ago

new ver. #s

  • Property mode set to 100644
File size: 5.5 KB
Line 
1#!/usr/bin/env python
2
3#
4# The setup to create a Windows executable.
5# Inno Setup can then be used with the installer.iss file
6# in the top source directory to create an installer.
7#
8# Setuptools clashes with py2exe 0.6.8 (and probably later too).
9# For that reason, most of the code needs to have direct imports
10# that are not going through pkg_resources.
11#
12# Attention should be paid to dynamic imports. Data files can
13# be added to the distribution directory for that purpose.
14# See for example the 'images' directory below.
15
16import os, sys
17
18if len(sys.argv) == 1:
19    sys.argv.append('py2exe')
20# When using the SansView build script, we need to be able to pass
21# an extra path to be added to the python path. The extra arguments
22# should be removed from the list so that the setup processing doesn't
23# fail.
24try:
25    if sys.argv.count('--extrapath'):
26        path_flag_idx = sys.argv.index('--extrapath')
27        extra_path = sys.argv[path_flag_idx+1]
28        sys.path.insert(0, extra_path)
29        del sys.argv[path_flag_idx+1]
30        sys.argv.remove('--extrapath')
31except:
32    print "Error processing extra python path needed to build SansView\n  %s" % sys.exc_value
33
34from distutils.core import setup
35from distutils.filelist import findall
36import matplotlib
37import py2exe
38
39
40origIsSystemDLL = py2exe.build_exe.isSystemDLL
41def isSystemDLL(pathname):
42        if os.path.basename(pathname).lower() in ("msvcp71.dll", "dwmapi.dll"):
43                return 0
44        return origIsSystemDLL(pathname)
45py2exe.build_exe.isSystemDLL = isSystemDLL
46
47
48manifest = """
49   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
50   <assembly xmlns="urn:schemas-microsoft-com:asm.v1"
51   manifestVersion="1.0">
52   <assemblyIdentity
53       version="0.64.1.0"
54       processorArchitecture="x86"
55       name="Controls"
56       type="win32"
57   />
58   <description>SansView</description>
59   <dependency>
60       <dependentAssembly>
61           <assemblyIdentity
62               type="win32"
63               name="Microsoft.Windows.Common-Controls"
64               version="6.0.0.0"
65               processorArchitecture="X86"
66               publicKeyToken="6595b64144ccf1df"
67               language="*"
68           />
69       </dependentAssembly>
70   </dependency>
71   </assembly>
72  """
73
74   
75class Target:
76    def __init__(self, **kw):
77        self.__dict__.update(kw)
78        # for the versioninfo resources
79        self.version = "2.0.1"
80        self.company_name = "U Tennessee"
81        self.copyright = "copyright 2009 - 2011"
82        self.name = "SansView"
83       
84#
85# Adapted from http://www.py2exe.org/index.cgi/MatPlotLib
86# to use the MatPlotLib.
87#
88path = os.getcwd()
89
90plugins_dir = os.path.join(path, "plugins")
91media_dir = os.path.join(path, "media")
92images_dir = os.path.join(path, "images")
93test_dir = os.path.join(path, "test")
94
95matplotlibdatadir = matplotlib.get_data_path()
96matplotlibdata = findall(matplotlibdatadir)
97data_files = []
98# Copying SLD data
99import periodictable
100import logging
101data_files += periodictable.data_files()
102
103import sans.perspectives.fitting as fitting
104data_files += fitting.data_files()
105
106import sans.perspectives.calculator as calculator
107data_files += calculator.data_files()
108
109import sans.perspectives.invariant as invariant
110data_files += invariant.data_files()
111
112import sans.guiframe as guiframe
113data_files += guiframe.data_files()
114
115import sans.models as models
116data_files += models.data_files()
117
118for f in matplotlibdata:
119    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:])
120    data_files.append((os.path.split(dirname)[0], [f]))
121
122# Copy the settings file for the sans.dataloader file extension associations
123import sans.dataloader.readers
124f = os.path.join(sans.dataloader.readers.get_data_path(),'defaults.xml')
125if os.path.isfile(f):
126    data_files.append(('.', [f]))
127f = 'custom_config.py'
128if os.path.isfile(f):
129    data_files.append(('.', [f]))
130f = 'local_config.py'
131if os.path.isfile(f):
132    data_files.append(('.', [f]))
133# Copying the images directory to the distribution directory.
134for f in findall(images_dir):
135    if os.path.split(f)[0].count('.svn')==0:
136        data_files.append(("images", [f]))
137
138# Copying the HTML help docs
139for f in findall(media_dir):
140    if os.path.split(f)[0].count('.svn')==0:
141        data_files.append(("media", [f]))
142
143# Copying the sample data user data
144for f in findall(test_dir):
145    if os.path.split(f)[0].count('.svn')==0:
146        data_files.append(("test", [f]))
147       
148# Copying the sample data user data
149for f in findall(plugins_dir):
150    if os.path.split(f)[0].count('.svn')==0:
151        data_files.append(('plugins', [f]))
152
153   
154#
155# packages
156#
157
158packages = ['matplotlib', 'scipy', 'pytz', 'encodings']
159includes = ['site']
160excludes = [] 
161
162dll_excludes = [
163    'libgdk_pixbuf-2.0-0.dll', 
164    'libgobject-2.0-0.dll',
165    'libgdk-win32-2.0-0.dll',
166    ]
167
168target_wx_client = Target(
169    description = 'SansView',
170    script = 'sansview.py',
171    icon_resources = [(1, os.path.join(images_dir, "ball.ico"))],
172    other_resources = [(24,1,manifest)],
173    dest_base = "SansView"
174    )
175
176
177
178setup(
179    windows=[target_wx_client],
180    console=[],
181   
182    options={
183        'py2exe': {
184            'dll_excludes': dll_excludes,
185            'packages' : packages,
186            'includes':includes,
187            'excludes':excludes,
188            "compressed": 1,
189            "optimize": 0,
190            "bundle_files":2,
191            },
192    },
193    data_files=data_files,
194   
195)
196
197
Note: See TracBrowser for help on using the repository browser.