[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 | |
---|
| 16 | import os, sys |
---|
| 17 | from distutils.core import setup |
---|
| 18 | from distutils.filelist import findall |
---|
| 19 | import matplotlib |
---|
| 20 | import py2exe |
---|
| 21 | |
---|
[a4bd2ac] | 22 | manifest = """ |
---|
| 23 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
---|
| 24 | <assembly xmlns="urn:schemas-microsoft-com:asm.v1" |
---|
| 25 | manifestVersion="1.0"> |
---|
| 26 | <assemblyIdentity |
---|
| 27 | version="0.64.1.0" |
---|
| 28 | processorArchitecture="x86" |
---|
| 29 | name="Controls" |
---|
| 30 | type="win32" |
---|
| 31 | /> |
---|
| 32 | <description>PrView</description> |
---|
| 33 | <dependency> |
---|
| 34 | <dependentAssembly> |
---|
| 35 | <assemblyIdentity |
---|
| 36 | type="win32" |
---|
| 37 | name="Microsoft.Windows.Common-Controls" |
---|
| 38 | version="6.0.0.0" |
---|
| 39 | processorArchitecture="X86" |
---|
| 40 | publicKeyToken="6595b64144ccf1df" |
---|
| 41 | language="*" |
---|
| 42 | /> |
---|
| 43 | </dependentAssembly> |
---|
| 44 | </dependency> |
---|
| 45 | </assembly> |
---|
| 46 | """ |
---|
| 47 | |
---|
[4a5de6f] | 48 | |
---|
| 49 | class Target: |
---|
| 50 | def __init__(self, **kw): |
---|
| 51 | self.__dict__.update(kw) |
---|
| 52 | # for the versioninfo resources |
---|
[a8d92db] | 53 | self.version = "0.3" |
---|
[4a5de6f] | 54 | self.company_name = "U Tennessee" |
---|
[a8d92db] | 55 | self.copyright = "copyright 2009" |
---|
[4a5de6f] | 56 | self.name = "PrView" |
---|
| 57 | |
---|
| 58 | # |
---|
| 59 | # Adapted from http://www.py2exe.org/index.cgi/MatPlotLib |
---|
| 60 | # to use the MatPlotLib. |
---|
| 61 | # |
---|
| 62 | matplotlibdatadir = matplotlib.get_data_path() |
---|
| 63 | matplotlibdata = findall(matplotlibdatadir) |
---|
[b24bf4e] | 64 | data_files = [] |
---|
[4a5de6f] | 65 | |
---|
| 66 | for f in matplotlibdata: |
---|
[b24bf4e] | 67 | dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:]) |
---|
| 68 | data_files.append((os.path.split(dirname)[0], [f])) |
---|
[4a5de6f] | 69 | |
---|
[b24bf4e] | 70 | # Copying the images directory to the distribution directory. |
---|
| 71 | for f in findall('images'): |
---|
| 72 | if os.path.split(f)[0].count('.svn')==0: |
---|
| 73 | data_files.append((os.path.split(f)[0], [f])) |
---|
[a8d92db] | 74 | |
---|
| 75 | # Copying the sample data user data |
---|
| 76 | for f in findall('test'): |
---|
| 77 | if os.path.split(f)[0].count('.svn')==0: |
---|
| 78 | data_files.append((os.path.split(f)[0], [f])) |
---|
| 79 | |
---|
| 80 | # Copying the sample data user data |
---|
| 81 | for f in findall('plugins'): |
---|
| 82 | if os.path.split(f)[0].count('.svn')==0: |
---|
| 83 | data_files.append((os.path.split(f)[0], [f])) |
---|
[b24bf4e] | 84 | |
---|
[4a5de6f] | 85 | # |
---|
| 86 | # packages |
---|
| 87 | # |
---|
[b24bf4e] | 88 | packages = ['matplotlib', 'pytz'] |
---|
[4a5de6f] | 89 | includes = [] |
---|
[b24bf4e] | 90 | excludes = [] |
---|
[4a5de6f] | 91 | |
---|
| 92 | dll_excludes = [ |
---|
| 93 | 'libgdk_pixbuf-2.0-0.dll', |
---|
| 94 | 'libgobject-2.0-0.dll', |
---|
| 95 | 'libgdk-win32-2.0-0.dll', |
---|
| 96 | ] |
---|
| 97 | |
---|
| 98 | target_wx_client = Target( |
---|
| 99 | description = 'P(r) inversion viewer', |
---|
| 100 | script = 'sansview.py', |
---|
| 101 | icon_resources = [(1, "images/ball.ico")], |
---|
[a4bd2ac] | 102 | other_resources = [(24,1,manifest)], |
---|
[4a5de6f] | 103 | dest_base = "prView" |
---|
| 104 | ) |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | setup( |
---|
| 109 | windows=[target_wx_client], |
---|
| 110 | console=[], |
---|
| 111 | |
---|
| 112 | options={ |
---|
| 113 | 'py2exe': { |
---|
| 114 | 'dll_excludes': dll_excludes, |
---|
| 115 | 'packages' : packages, |
---|
| 116 | 'includes':includes, |
---|
| 117 | 'excludes':excludes, |
---|
| 118 | "compressed": 1, |
---|
| 119 | "optimize": 0, |
---|
| 120 | "bundle_files":2, |
---|
| 121 | }, |
---|
| 122 | }, |
---|
[b24bf4e] | 123 | data_files=data_files |
---|
[4a5de6f] | 124 | |
---|
| 125 | ) |
---|
| 126 | |
---|
| 127 | |
---|