[PATCH 4 of 4] py2exe is not able to handle win32com.shell

VolkerKleinfeld Volker.Kleinfeld at gmx.de
Thu Sep 29 14:25:36 CDT 2005


# HG changeset patch
# User Volker Kleinfeld <Volker.Kleinfeld at gmx.de>
# Node ID 3f4a9484feb23b76fd9c20c181695cc289de5b47
# Parent  7e2a0c42670001d88532c14784f62cf8334b81b1
py2exe is not able to handle win32com.shell

Changes:
- setup.py: help py2exe finding the shell module in win32com.shell

diff -r 7e2a0c426700 -r 3f4a9484feb2 setup.py
--- a/setup.py	09/27/05 08:20:00 +0200
+++ b/setup.py	09/27/05 08:20:11 +0200
@@ -6,6 +6,7 @@
 # './setup.py --help' for more options
 
 import glob
+import sys
 from distutils.core import setup, Extension
 from distutils.command.install_data import install_data
 
@@ -14,6 +15,20 @@
 # py2exe needs to be installed to work
 try:
     import py2exe
+
+    # Help py2exe to find win32com.shell
+    try:
+        import modulefinder
+        import win32com
+        for p in win32com.__path__[1:]: # Take the path to win32comext
+            modulefinder.AddPackagePath("win32com", p)
+        pn = "win32com.shell"
+        __import__(pn)
+        m = sys.modules[pn]
+        for p in m.__path__[1:]:
+            modulefinder.AddPackagePath(pn, p)
+    except ImportError:
+        pass
 
     # Due to the use of demandload py2exe is not finding the modules.
     # packagescan.getmodules creates a list of modules included in


More information about the Mercurial mailing list