Commits

Radomir Dopieralski  committed c020934

Make py2exe optional

  • Participants
  • Parent commits 8cf03f7

Comments (0)

Files changed (1)

 
 from setuptools import setup
 import os
-import py2exe
+try:
+    import py2exe
+except ImportError:
+    pass
+else:
+    origIsSystemDLL = py2exe.build_exe.isSystemDLL
 
+    def isSystemDLL(pathname):
+        if os.path.basename(pathname).lower() in {
+            "libfreetype-6.dll",
+            "sdl_ttf.dll",
+            "libogg-0.dll",
+        }:
+            return 0
+        return origIsSystemDLL(pathname)
 
-origIsSystemDLL = py2exe.build_exe.isSystemDLL
-
-def isSystemDLL(pathname):
-    if os.path.basename(pathname).lower() in {
-        "libfreetype-6.dll",
-        "sdl_ttf.dll",
-        "libogg-0.dll",
-    }:
-        return 0
-    return origIsSystemDLL(pathname)
-
-py2exe.build_exe.isSystemDLL = isSystemDLL
+    py2exe.build_exe.isSystemDLL = isSystemDLL
 
 
 setup(