[b30f001] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | # |
---|
| 4 | # The setup to create a single exe file. |
---|
| 5 | # |
---|
| 6 | |
---|
| 7 | import os, sys |
---|
| 8 | |
---|
| 9 | from distutils.core import setup |
---|
| 10 | |
---|
| 11 | from distutils.filelist import findall |
---|
| 12 | |
---|
| 13 | import matplotlib |
---|
| 14 | |
---|
| 15 | import py2exe |
---|
| 16 | |
---|
| 17 | manifest = """ |
---|
| 18 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
---|
| 19 | <assembly xmlns="urn:schemas-microsoft-com:asm.v1" |
---|
| 20 | manifestVersion="1.0"> |
---|
| 21 | <assemblyIdentity |
---|
| 22 | version="0.64.1.0" |
---|
| 23 | processorArchitecture="x86" |
---|
| 24 | name="Controls" |
---|
| 25 | type="win32" |
---|
| 26 | /> |
---|
| 27 | <description>PrView</description> |
---|
| 28 | <dependency> |
---|
| 29 | <dependentAssembly> |
---|
| 30 | <assemblyIdentity |
---|
| 31 | type="win32" |
---|
| 32 | name="Microsoft.Windows.Common-Controls" |
---|
| 33 | version="6.0.0.0" |
---|
| 34 | processorArchitecture="X86" |
---|
| 35 | publicKeyToken="6595b64144ccf1df" |
---|
| 36 | language="*" |
---|
| 37 | /> |
---|
| 38 | </dependentAssembly> |
---|
| 39 | </dependency> |
---|
| 40 | </assembly> |
---|
| 41 | """ |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | class Target: |
---|
| 45 | def __init__(self, **kw): |
---|
| 46 | self.__dict__.update(kw) |
---|
| 47 | # for the versioninfo resources |
---|
| 48 | self.version = "0.1" |
---|
| 49 | self.company_name = "U Tennessee" |
---|
| 50 | self.copyright = "copyright 2008" |
---|
| 51 | self.name = "PrView" |
---|
| 52 | |
---|
| 53 | # |
---|
| 54 | # Adapted from http://www.py2exe.org/index.cgi/MatPlotLib |
---|
| 55 | # to use the MatPlotLib. |
---|
| 56 | # |
---|
| 57 | matplotlibdatadir = matplotlib.get_data_path() |
---|
| 58 | matplotlibdata = findall(matplotlibdatadir) |
---|
| 59 | matplotlibdata_files = [] |
---|
| 60 | |
---|
| 61 | for f in matplotlibdata: |
---|
| 62 | dirname = os.path.join('matplotlibdata', f[len(matplotlibdatadir)+1:]) |
---|
| 63 | matplotlibdata_files.append((os.path.split(dirname)[0], [f])) |
---|
| 64 | |
---|
| 65 | # |
---|
| 66 | # packages |
---|
| 67 | # |
---|
| 68 | packages = [ |
---|
| 69 | 'matplotlib', 'pytz' |
---|
| 70 | ] |
---|
| 71 | |
---|
| 72 | includes = [] |
---|
| 73 | excludes = ['OpenGL'] |
---|
| 74 | |
---|
| 75 | dll_excludes = [ |
---|
| 76 | 'libgdk_pixbuf-2.0-0.dll', |
---|
| 77 | 'libgobject-2.0-0.dll', |
---|
| 78 | 'libgdk-win32-2.0-0.dll', |
---|
| 79 | ] |
---|
| 80 | |
---|
| 81 | ## This is the client for PARK: run on wx |
---|
| 82 | target_wx_client = Target( |
---|
| 83 | description = 'fit viewer', |
---|
| 84 | script = 'sansview.py', |
---|
| 85 | #other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="AppJob"))], |
---|
| 86 | icon_resources = [(1, "images/ball.ico")], |
---|
| 87 | other_resources = [(24,1,manifest)], |
---|
| 88 | dest_base = "sansView" |
---|
| 89 | ) |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | setup( |
---|
| 94 | windows=[target_wx_client], |
---|
| 95 | console=[], |
---|
| 96 | |
---|
| 97 | options={ |
---|
| 98 | 'py2exe': { |
---|
| 99 | 'dll_excludes': dll_excludes, |
---|
| 100 | 'packages' : packages, |
---|
| 101 | 'includes':includes, |
---|
| 102 | 'excludes':excludes, |
---|
| 103 | "compressed": 1, |
---|
| 104 | "optimize": 0, |
---|
| 105 | "bundle_files":2, |
---|
| 106 | }, |
---|
| 107 | }, |
---|
| 108 | data_files=matplotlibdata_files |
---|
| 109 | |
---|
| 110 | # Do something like this to add images to the distribution |
---|
| 111 | #data_files=[ ("prog",["kategorien.xml",])] |
---|
| 112 | ) |
---|
| 113 | |
---|
| 114 | |
---|