[Python-checkins] CVS: python/dist/src/Tools/freeze modulefinder.py,1.14,1.15

Mark Hammond python-dev@python.org
Sun, 5 Nov 2000 18:49:29 -0800


Update of /cvsroot/python/python/dist/src/Tools/freeze
In directory slayer.i.sourceforge.net:/tmp/cvs-serv15773

Modified Files:
	modulefinder.py 
Log Message:
Application of [ Patch #102226 ] freeze/modulefinder.py should use _winreg, not win32api

Index: modulefinder.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/modulefinder.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** modulefinder.py	2000/09/15 16:37:42	1.14
--- modulefinder.py	2000/11/06 02:49:27	1.15
***************
*** 9,23 ****
  import sys
  
- if sys.platform=="win32":
-     # On Windows, we can locate modules in the registry with
-     # the help of the win32api package.
-     try:
-         import win32api
-     except ImportError:
-         print "The win32api module is not available - modules listed"
-         print "in the registry will not be found."
-         win32api = None
- 
- 
  IMPORT_NAME = dis.opname.index('IMPORT_NAME')
  IMPORT_FROM = dis.opname.index('IMPORT_FROM')
--- 9,12 ----
***************
*** 340,352 ****
  
              # Emulate the Registered Module support on Windows.
!             if sys.platform=="win32" and win32api is not None:
!                 HKEY_LOCAL_MACHINE = 0x80000002
                  try:
!                     pathname = win32api.RegQueryValue(HKEY_LOCAL_MACHINE, "Software\\Python\\PythonCore\\%s\\Modules\\%s" % (sys.winver, name))
                      fp = open(pathname, "rb")
                      # XXX - To do - remove the hard code of C_EXTENSION.
                      stuff = "", "rb", imp.C_EXTENSION
                      return fp, pathname, stuff
!                 except win32api.error:
                      pass
  
--- 329,343 ----
  
              # Emulate the Registered Module support on Windows.
!             if sys.platform=="win32":
!                 import _winreg
!                 from _winreg import HKEY_LOCAL_MACHINE
                  try:
!                     pathname = _winreg.QueryValueEx(HKEY_LOCAL_MACHINE, \
!                         "Software\\Python\\PythonCore\\%s\\Modules\\%s" % (sys.winver, name))
                      fp = open(pathname, "rb")
                      # XXX - To do - remove the hard code of C_EXTENSION.
                      stuff = "", "rb", imp.C_EXTENSION
                      return fp, pathname, stuff
!                 except _winreg.error:
                      pass