source: sasview/prview/setup_exe.py @ 814524b

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 814524b was 697d798, checked in by Mathieu Doucet <doucetm@…>, 14 years ago

prview: fixed problem with build script

  • Property mode set to 100644
File size: 3.9 KB
RevLine 
[4a5de6f]1#!/usr/bin/env python
2
3#
[b24bf4e]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.
[4a5de6f]7#
[b24bf4e]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.
[4a5de6f]15
16import os, sys
[697d798]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
[4a5de6f]32from distutils.core import setup
33from distutils.filelist import findall
34import matplotlib
35import py2exe
36
[a4bd2ac]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>PrView</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
[4a5de6f]63   
64class Target:
65    def __init__(self, **kw):
66        self.__dict__.update(kw)
67        # for the versioninfo resources
[a8d92db]68        self.version = "0.3"
[4a5de6f]69        self.company_name = "U Tennessee"
[a8d92db]70        self.copyright = "copyright 2009"
[4a5de6f]71        self.name = "PrView"
72       
73#
74# Adapted from http://www.py2exe.org/index.cgi/MatPlotLib
75# to use the MatPlotLib.
76#
77matplotlibdatadir = matplotlib.get_data_path()
78matplotlibdata = findall(matplotlibdatadir)
[b24bf4e]79data_files = []
[4a5de6f]80
81for f in matplotlibdata:
[b24bf4e]82    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:])
83    data_files.append((os.path.split(dirname)[0], [f]))
[4a5de6f]84
[b24bf4e]85# Copying the images directory to the distribution directory.
86for f in findall('images'):
87    if os.path.split(f)[0].count('.svn')==0:
88        data_files.append((os.path.split(f)[0], [f]))
[a8d92db]89
90# Copying the sample data user data
91for f in findall('test'):
92    if os.path.split(f)[0].count('.svn')==0:
93        data_files.append((os.path.split(f)[0], [f]))
94       
95# Copying the sample data user data
96for f in findall('plugins'):
97    if os.path.split(f)[0].count('.svn')==0:
98        data_files.append((os.path.split(f)[0], [f]))
[b24bf4e]99   
[4a5de6f]100#
101# packages
102#
[b24bf4e]103packages = ['matplotlib', 'pytz']
[4a5de6f]104includes = []
[b24bf4e]105excludes = [] 
[4a5de6f]106
107dll_excludes = [
108    'libgdk_pixbuf-2.0-0.dll', 
109    'libgobject-2.0-0.dll',
110    'libgdk-win32-2.0-0.dll',
111    ]
112
113target_wx_client = Target(
114    description = 'P(r) inversion viewer',
[43db4a8]115    script = 'PrView.py',
[4a5de6f]116    icon_resources = [(1, "images/ball.ico")],
[a4bd2ac]117    other_resources = [(24,1,manifest)],
[4a5de6f]118    dest_base = "prView"
119    )
120
121
122
123setup(
124    windows=[target_wx_client],
125    console=[],
126   
127    options={
128        'py2exe': {
129            'dll_excludes': dll_excludes,
130            'packages' : packages,
131            'includes':includes,
132            'excludes':excludes,
133            "compressed": 1,
134            "optimize": 0,
135            "bundle_files":2,
136            },
137    },
[b24bf4e]138    data_files=data_files
[4a5de6f]139   
140)
141
142
Note: See TracBrowser for help on using the repository browser.