]> granicus.if.org Git - python/commitdiff
Don't die if win32api doesn't exist.
authorGuido van Rossum <guido@python.org>
Tue, 26 May 1998 02:51:40 +0000 (02:51 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 26 May 1998 02:51:40 +0000 (02:51 +0000)
Tools/freeze/checkextensions_win32.py

index 10bd3ef997684dd8dd62809c63df613cb1bc8b75..69643b3fa38b5788e688e9162e8ba3082c4af60b 100644 (file)
@@ -20,7 +20,11 @@ At the moment the name and location of this INI file is hardcoded,
 but an obvious enhancement would be to provide command line options.
 """
 
-import os, win32api, string, sys
+import os, string, sys
+try:
+       import win32api
+except ImportError:
+       win32api = None # User has already been warned
 
 class CExtension:
        """An abstraction of an extension implemented in C/C++
@@ -60,6 +64,7 @@ def checkextensions(unknown, ignored):
        return ret
 
 def get_extension_defn(moduleName, mapFileName):
+       if win32api is None: return None
        dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName)
        if dsp=="":
                sys.stderr.write("No definition of module %s in map file '%s'\n" % (moduleName, mapFileName))