Commits

Steve Borho committed ad7d3f5

setup: help py2exe find win32com.shell

Borrow some modulefinder magic from Mercurial's setup.py script

Fixes #514

  • Participants
  • Parent commits 7cda7b7
  • Branches stable

Comments (0)

Files changed (1)

     extra = {}
     hgextmods = []
 
-    try: import py2exe
+    # 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
+
     except ImportError:
         if '--version' not in sys.argv:
             raise