source: sasview/sansview/setup_exe.py @ 38cfa7a

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 38cfa7a was fa597990, checked in by Gervaise Alina <gervyh@…>, 13 years ago

add file out of scripts folder

  • Property mode set to 100644
File size: 5.3 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
17
18# When using the SansView build script, we need to be able to pass
19# an extra path to be added to the python path. The extra arguments
20# should be removed from the list so that the setup processing doesn't
21# fail.
22try:
23    if sys.argv.count('--extrapath'):
24        path_flag_idx = sys.argv.index('--extrapath')
25        extra_path = sys.argv[path_flag_idx+1]
26        sys.path.insert(0, extra_path)
27        del sys.argv[path_flag_idx+1]
28        sys.argv.remove('--extrapath')
29except:
30    print "Error processing extra python path needed to build SansView\n  %s" % sys.exc_value
31
32from distutils.core import setup
33from distutils.filelist import findall
34import matplotlib
35import py2exe
36
37manifest = """
38   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
39   <assembly xmlns="urn:schemas-microsoft-com:asm.v1"
40   manifestVersion="1.0">
41   <assemblyIdentity
42       version="0.64.1.0"
43       processorArchitecture="x86"
44       name="Controls"
45       type="win32"
46   />
47   <description>SansView</description>
48   <dependency>
49       <dependentAssembly>
50           <assemblyIdentity
51               type="win32"
52               name="Microsoft.Windows.Common-Controls"
53               version="6.0.0.0"
54               processorArchitecture="X86"
55               publicKeyToken="6595b64144ccf1df"
56               language="*"
57           />
58       </dependentAssembly>
59   </dependency>
60   </assembly>
61  """
62
63   
64class Target:
65    def __init__(self, **kw):
66        self.__dict__.update(kw)
67        # for the versioninfo resources
68        self.version = "1.9.1"
69        self.company_name = "U Tennessee"
70        self.copyright = "copyright 2009"
71        self.name = "SansView"
72       
73#
74# Adapted from http://www.py2exe.org/index.cgi/MatPlotLib
75# to use the MatPlotLib.
76#
77current_dir = os.getcwd()
78path, _ = os.path.split(current_dir)
79plugins_dir = os.path.join(path, "plugins")
80media_dir = os.path.join(path, "media")
81images_dir = os.path.join(path, "images")
82test_dir = os.path.join(path, "test")
83
84matplotlibdatadir = matplotlib.get_data_path()
85matplotlibdata = findall(matplotlibdatadir)
86data_files = []
87from glob import glob
88data_files = [("Microsoft.VC90.CRT", glob(r'C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\*.*'))]
89sys.path.append("C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\redist\\x86\\Microsoft.VC90.CRT")
90# Copying SLD data
91import periodictable
92import logging
93data_files += periodictable.data_files()
94
95import sans.perspectives.calculator as calculator
96data_files += calculator.data_files()
97
98import sans.perspectives.invariant as invariant
99data_files += invariant.data_files()
100import sans.guiframe as guiframe
101data_files += guiframe.data_files()
102
103import sans.models as models
104data_files += models.data_files()
105
106for f in matplotlibdata:
107    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:])
108    data_files.append((os.path.split(dirname)[0], [f]))
109
110# Copy the settings file for the sans.dataloader file extension associations
111import sans.dataloader.readers
112f = os.path.join(sans.dataloader.readers.get_data_path(),'defaults.xml')
113if os.path.isfile(f):
114    data_files.append(('.', [f]))
115f = 'custom_config.py'
116if os.path.isfile(f):
117    data_files.append(('.', [f]))
118# Copying the images directory to the distribution directory.
119for f in findall(images_dir):
120    if os.path.split(f)[0].count('.svn')==0:
121        data_files.append((os.path.split(f)[0], [f]))
122
123# Copying the HTML help docs
124for f in findall(media_dir):
125    if os.path.split(f)[0].count('.svn')==0:
126        data_files.append((os.path.split(f)[0], [f]))
127
128# Copying the sample data user data
129for f in findall(test_dir):
130    if os.path.split(f)[0].count('.svn')==0:
131        data_files.append((os.path.split(f)[0], [f]))
132       
133# Copying the sample data user data
134for f in findall(plugins_dir):
135    if os.path.split(f)[0].count('.svn')==0:
136        data_files.append((os.path.split(f)[0], [f]))
137
138   
139#
140# packages
141#
142
143packages = ['matplotlib', 'pytz','encodings']
144includes = []
145excludes = [] 
146
147dll_excludes = [
148    'libgdk_pixbuf-2.0-0.dll', 
149    'libgobject-2.0-0.dll',
150    'libgdk-win32-2.0-0.dll',
151    ]
152
153target_wx_client = Target(
154    description = 'SansView',
155    script = 'sansview.py',
156    icon_resources = [(1, os.path.join(images_dir, "ball.ico"))],
157    other_resources = [(24,1,manifest)],
158    dest_base = "SansView"
159    )
160
161
162
163setup(
164    windows=[target_wx_client],
165    console=[],
166   
167    options={
168        'py2exe': {
169            'dll_excludes': dll_excludes,
170            'packages' : packages,
171            'includes':includes,
172            'excludes':excludes,
173            "compressed": 1,
174            "optimize": 0,
175            "bundle_files":2,
176            },
177    },
178    data_files=data_files,
179   
180)
181
182
Note: See TracBrowser for help on using the repository browser.