source: sasview/sansview/setup_exe.py @ 3576dd0

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 3576dd0 was 535d9f6, checked in by Jae Cho <jhjcho@…>, 13 years ago

included site module

  • Property mode set to 100644
File size: 5.2 KB
RevLine 
[fa597990]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
[535d9f6]17
[50f4401]18if len(sys.argv) == 1:
19    sys.argv.append('py2exe')
[fa597990]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
39manifest = """
40   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
41   <assembly xmlns="urn:schemas-microsoft-com:asm.v1"
42   manifestVersion="1.0">
43   <assemblyIdentity
44       version="0.64.1.0"
45       processorArchitecture="x86"
46       name="Controls"
47       type="win32"
48   />
49   <description>SansView</description>
50   <dependency>
51       <dependentAssembly>
52           <assemblyIdentity
53               type="win32"
54               name="Microsoft.Windows.Common-Controls"
55               version="6.0.0.0"
56               processorArchitecture="X86"
57               publicKeyToken="6595b64144ccf1df"
58               language="*"
59           />
60       </dependentAssembly>
61   </dependency>
62   </assembly>
63  """
64
65   
66class Target:
67    def __init__(self, **kw):
68        self.__dict__.update(kw)
69        # for the versioninfo resources
[50f4401]70        self.version = "1.9.2Dev"
[fa597990]71        self.company_name = "U Tennessee"
[50f4401]72        self.copyright = "copyright 2009 - 2011"
[fa597990]73        self.name = "SansView"
74       
75#
76# Adapted from http://www.py2exe.org/index.cgi/MatPlotLib
77# to use the MatPlotLib.
78#
[d4c19e5]79path = os.getcwd()
80
[fa597990]81plugins_dir = os.path.join(path, "plugins")
82media_dir = os.path.join(path, "media")
83images_dir = os.path.join(path, "images")
84test_dir = os.path.join(path, "test")
85
86matplotlibdatadir = matplotlib.get_data_path()
87matplotlibdata = findall(matplotlibdatadir)
88data_files = []
89# Copying SLD data
90import periodictable
91import logging
92data_files += periodictable.data_files()
93
[d4c19e5]94import sans.perspectives.fitting as fitting
95data_files += fitting.data_files()
96
[fa597990]97import sans.perspectives.calculator as calculator
98data_files += calculator.data_files()
99
100import sans.perspectives.invariant as invariant
101data_files += invariant.data_files()
[d4c19e5]102
[fa597990]103import sans.guiframe as guiframe
104data_files += guiframe.data_files()
105
106import sans.models as models
107data_files += models.data_files()
108
109for f in matplotlibdata:
110    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:])
111    data_files.append((os.path.split(dirname)[0], [f]))
112
113# Copy the settings file for the sans.dataloader file extension associations
114import sans.dataloader.readers
115f = os.path.join(sans.dataloader.readers.get_data_path(),'defaults.xml')
116if os.path.isfile(f):
117    data_files.append(('.', [f]))
118f = 'custom_config.py'
119if os.path.isfile(f):
120    data_files.append(('.', [f]))
[d4c19e5]121f = 'local_config.py'
122if os.path.isfile(f):
123    data_files.append(('.', [f]))
[fa597990]124# Copying the images directory to the distribution directory.
125for f in findall(images_dir):
126    if os.path.split(f)[0].count('.svn')==0:
[f1044e9]127        data_files.append(("images", [f]))
[fa597990]128
129# Copying the HTML help docs
130for f in findall(media_dir):
131    if os.path.split(f)[0].count('.svn')==0:
[f1044e9]132        data_files.append(("media", [f]))
[fa597990]133
134# Copying the sample data user data
135for f in findall(test_dir):
136    if os.path.split(f)[0].count('.svn')==0:
[f1044e9]137        data_files.append(("test", [f]))
[fa597990]138       
139# Copying the sample data user data
140for f in findall(plugins_dir):
141    if os.path.split(f)[0].count('.svn')==0:
[d4c19e5]142        data_files.append(('plugins', [f]))
[fa597990]143
144   
145#
146# packages
147#
148
[bb64650]149packages = ['matplotlib', 'scipy', 'pytz', 'encodings']
[535d9f6]150includes = ['site']
[fa597990]151excludes = [] 
152
153dll_excludes = [
154    'libgdk_pixbuf-2.0-0.dll', 
155    'libgobject-2.0-0.dll',
156    'libgdk-win32-2.0-0.dll',
157    ]
158
159target_wx_client = Target(
160    description = 'SansView',
161    script = 'sansview.py',
162    icon_resources = [(1, os.path.join(images_dir, "ball.ico"))],
163    other_resources = [(24,1,manifest)],
164    dest_base = "SansView"
165    )
166
167
168
169setup(
170    windows=[target_wx_client],
171    console=[],
172   
173    options={
174        'py2exe': {
175            'dll_excludes': dll_excludes,
176            'packages' : packages,
177            'includes':includes,
178            'excludes':excludes,
179            "compressed": 1,
180            "optimize": 0,
181            "bundle_files":2,
182            },
183    },
184    data_files=data_files,
185   
186)
187
188
Note: See TracBrowser for help on using the repository browser.