#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
##---------------------------------------------------------------------------------------------------
__version__ = 0.3
__author__  = "Laurent Dufrechou"
__email__   = "laurent.dufrechou@..."
__license__ = "BSD"
##---------------------------------------------------------------------------------------------------

###MODIFYING v2__setupNew.py to fit QF needs

import os
import sys
import matplotlib
sys.stdout = open('screen.txt','w',0)
sys.stderr = open('errors.txt','w',0)

# setup.py

# Used successfully in Python2.5 with matplotlib 0.91.2 and PyQt4 (and Qt 4.3.3)
from distutils.core import setup
import py2exe

# We need to exclude matplotlib backends not being used by this executable.  You may find
# that you need different excludes to create a working executable with your chosen backend.
# We also need to include include various numerix libraries that the other functions call.

opts = {
    'py2exe': { "compressed": 1,
                "optimize": 1,
                #"ascii": 1,
                "bundle_files": 1,
                'packages' : ["matplotlib.backends.backend_wxagg",
                              "matplotlib.numerix.fft",
                              "matplotlib.numerix.linear_algebra",
                              "matplotlib.numerix.random_array",
                              "matplotlib.numerix.ma"
                              ],
                'excludes': ['_tkinter'
                #             '_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg',
                #             '_fltkagg', '_gtk', '_gtkcairo','_backend_gdk',
                #             '_gobject','_gtkagg','_tkinter','glade','pango',
                #             'QtCore','QtGui'
                             ],
                'dll_excludes': ['tk84.dll',
                                 'tcl84.dll',
                #                 'libgdk_pixbuf-2.0-0.dll',
                #                 'libgdk-win32-2.0-0.dll',
                #                 'libgobject-2.0-0.dll',
                #                 'libgtk-win32-2.0-0.dll',
                #                 'libglib-2.0-0.dll',
                #                 'libcairo-2.dll',
                #                 'libpango-1.0-0.dll',
                #                 'libpangowin32-1.0-0.dll',
                #                 'libpangocairo-1.0-0.dll',
                #                 'libglade-2.0-0.dll',
                #                 'libgmodule-2.0-0.dll',
                #                 'libgthread-2.0-0.dll',
                #                 'tk84.dll',
                #                 'tcl84.dll',
                                  ]
              }
       }

# Save matplotlib-data to mpl-data ( It is located in the matplotlib\mpl-data
# folder and the compiled programs will look for it in \mpl-data

data_files = matplotlib.get_py2exe_datafiles()

# for console program use 'console = [{"script" : "scriptname.py"}]
setup(console=[{'script' : "main.py"}], options=opts, zipfile = None, data_files=data_files)
     
print "---Done---" 