help removing pyQt dll from dist created with py2exe

C

Carlos Grohmann

Hello all,

i've been trying to build an .exe with py2exe. After many tentatives,
it worked, but the total space used by the app goes to 30Mb. It is a
simple app, that uses wxpython, matplotlib and numpy. I checked the
library.zip file and notived that there is a pyQt-related file there:

Pyqt - QtGui.pyo - 8 Mb

I'm not using Qt at all, so I assume it would be safe to not have this
file, but I don't see how to do it.

my setup.py file follows.

many thanks

Carlos


#----------------------------------------------------------------------
from distutils.core import setup
import py2exe
from glob import glob

# Remove the build folder, a bit slower but ensures that build
contains the latest
import shutil
shutil.rmtree("build", ignore_errors=True)

# my setup.py is based on one generated with gui2exe, so data_files is
done a bit differently
data_files = [("Microsoft.VC90.CRT", glob(r'c:\dev\*.*'))]

includes = ['wx', 'os', 'sys', 'csv', 're', 'floatspin',
'scrolledpanel', 'customtreectrl',
'wx.lib.expando', 'wx.lib.pubsub', 'wx.lib.embeddedimage',
'wx.lib.wordwrap', 'types',
'matplotlib', 'matplotlib.pyplot', 'matplotlib.axes',
'matplotlib.figure',
'matplotlib.backends.backend_wxagg',
'mpl_toolkits.axes_grid.axislines', 'mpl_toolkits.axes_grid',
'matplotlib.patches', 'matplotlib.lines',
'matplotlib.text', 'matplotlib.mlab', 'matplotlib.nxutils',
'matplotlib.collections', 'matplotlib.font_manager',
'numpy', 'numpy.ma', 'numpy.linalg', 'math', 'scipy.interpolate'
]

excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter', 'pydoc', 'doctest', 'test',
'sqlite3',
'bsddb', 'curses', 'email','_fltkagg', '_gtk',
'_gtkcairo',
'_agg2', '_cairo', '_cocoaagg',
'matplotlib.backends.backend_qt4agg','matplotlib.backends.backend_qt4'
]

packages = ['encodings','pytz','scipy']

dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll',
'tcl84.dll', 'tk84.dll',
'libgdk_pixbuf-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', 'QtGui4.dll', 'QtCore.dll',
'QtCore4.dll'
]

icon_resources = []
bitmap_resources = []
other_resources = []

# add the mpl mpl-data folder and rc file
import matplotlib as mpl
data_files += mpl.get_py2exe_datafiles()

setup(
windows=['OpenStereo.py'],
# compressed and optimize reduce the size
options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
# using 2 to reduce number of files in dist
folder
# using 1 is not recommended as it often
does not work
"bundle_files": 2,
"dist_dir": 'dist',
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},

# using zipfile to reduce number of files in dist
zipfile = r'lib\library.zip',

data_files=data_files
)
 
C

Carlos Grohmann

many thanks Almar.

No more pyqt stuff in my dist.

cheers

carlos

Hi,

Have you tried adding "PyQt4", "PyQt4.QtGui" and "PyQt4.QtCore" to your list
of excludes?
(Maybe only "PyQt4.QtGui" is sufficient.)

  Almar


Hello all,

i've been trying to build an .exe with py2exe. After many tentatives,
it worked, but the total space used by the app goes to 30Mb. It is a
simple app, that uses wxpython, matplotlib and numpy. I checked the
library.zip file and notived that there is a pyQt-related file there:

Pyqt - QtGui.pyo - 8 Mb

I'm not using Qt at all, so I assume it would be safe to not have this
file, but I don't see how to do it.

my setup.py file follows.

many thanks

Carlos


#----------------------------------------------------------------------
from distutils.core import setup
import py2exe
from glob import glob

# Remove the build folder, a bit slower but ensures that build
contains the latest
import shutil
shutil.rmtree("build", ignore_errors=True)

# my setup.py is based on one generated with gui2exe, so data_files is
done a bit differently
data_files = [("Microsoft.VC90.CRT", glob(r'c:\dev\*.*'))]

includes = ['wx', 'os', 'sys', 'csv', 're', 'floatspin',
'scrolledpanel', 'customtreectrl',
           'wx.lib.expando', 'wx.lib.pubsub', 'wx.lib.embeddedimage',
'wx.lib.wordwrap', 'types',
           'matplotlib', 'matplotlib.pyplot', 'matplotlib.axes',
'matplotlib.figure',
           'matplotlib.backends.backend_wxagg',
'mpl_toolkits.axes_grid.axislines', 'mpl_toolkits.axes_grid',
           'matplotlib.patches', 'matplotlib.lines',
'matplotlib.text', 'matplotlib.mlab', 'matplotlib.nxutils',
           'matplotlib.collections', 'matplotlib.font_manager',
'numpy', 'numpy.ma', 'numpy.linalg', 'math', 'scipy.interpolate'
           ]

excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'pywin.debugger',
           'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
           'Tkconstants', 'Tkinter', 'pydoc', 'doctest', 'test',
'sqlite3',
           'bsddb', 'curses', 'email','_fltkagg', '_gtk',
'_gtkcairo',
           '_agg2', '_cairo', '_cocoaagg',
'matplotlib.backends.backend_qt4agg','matplotlib.backends.backend_qt4'
           ]

packages = ['encodings','pytz','scipy']

dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll',
'tcl84.dll', 'tk84.dll',
               'libgdk_pixbuf-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', 'QtGui4.dll', 'QtCore.dll',
               'QtCore4.dll'
               ]

icon_resources = []
bitmap_resources = []
other_resources = []

# add the mpl mpl-data folder and rc file
import matplotlib as mpl
data_files += mpl.get_py2exe_datafiles()

setup(
   windows=['OpenStereo.py'],
                         # compressed and optimize reduce the size
   options = {"py2exe": {"compressed": 2,
                         "optimize": 2,
                         "includes": includes,
                         "excludes": excludes,
                         "packages": packages,
                         "dll_excludes": dll_excludes,
                         # using 2 to reduce number of files in dist
folder
                         # using 1 is not recommended as it often
does not work
                         "bundle_files": 2,
                         "dist_dir": 'dist',
                         "xref": False,
                         "skip_archive": False,
                         "ascii": False,
                         "custom_boot_script": '',
                        }
             },

   # using zipfile to reduce number of files in dist
   zipfile = r'lib\library.zip',

   data_files=data_files
)



--
Prof. Carlos Henrique Grohmann - Geologist D.Sc.
Institute of Geosciences - Univ. of São Paulo, Brazil
http://www.igc.usp.br/pessoais/guano
http://lattes.cnpq.br/5846052449613692
Linux User #89721
________________
Can’t stop the signal.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top