changeset 2:c02093477e36

Make py2exe optional
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Thu, 30 May 2013 15:42:24 +0200
parents 8cf03f794933
children adf963c19638
files setup.py
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Thu May 30 15:41:30 2013 +0200
+++ b/setup.py	Thu May 30 15:42:24 2013 +0200
@@ -3,21 +3,23 @@
 
 from setuptools import setup
 import os
-import py2exe
-
-
-origIsSystemDLL = py2exe.build_exe.isSystemDLL
+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)
+    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(