summaryrefslogtreecommitdiffstats
path: root/Tools/freeze/modulefinder.py
diff options
context:
space:
mode:
authorMark Hammond <mhammond@skippinet.com.au>2000-11-06 02:49:27 (GMT)
committerMark Hammond <mhammond@skippinet.com.au>2000-11-06 02:49:27 (GMT)
commitd3d7bb1c315eef797dd9ccc952cb232269cb4b49 (patch)
tree1778a864c1d64aa453d9ab99a5fe85d227063d0e /Tools/freeze/modulefinder.py
parentfad27aee11e8ece649b72c8ad9513f46882d23ba (diff)
downloadcpython-d3d7bb1c315eef797dd9ccc952cb232269cb4b49.zip
cpython-d3d7bb1c315eef797dd9ccc952cb232269cb4b49.tar.gz
cpython-d3d7bb1c315eef797dd9ccc952cb232269cb4b49.tar.bz2
Application of [ Patch #102226 ] freeze/modulefinder.py should use _winreg, not win32api
Diffstat (limited to 'Tools/freeze/modulefinder.py')
-rw-r--r--Tools/freeze/modulefinder.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/Tools/freeze/modulefinder.py b/Tools/freeze/modulefinder.py
index e84a541..8c4b74d 100644
--- a/Tools/freeze/modulefinder.py
+++ b/Tools/freeze/modulefinder.py
@@ -8,17 +8,6 @@ import re
import string
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')
STORE_NAME = dis.opname.index('STORE_NAME')
@@ -339,15 +328,17 @@ class ModuleFinder:
return (None, None, ("", "", imp.C_BUILTIN))
# Emulate the Registered Module support on Windows.
- if sys.platform=="win32" and win32api is not None:
- HKEY_LOCAL_MACHINE = 0x80000002
+ if sys.platform=="win32":
+ import _winreg
+ from _winreg import HKEY_LOCAL_MACHINE
try:
- pathname = win32api.RegQueryValue(HKEY_LOCAL_MACHINE, "Software\\Python\\PythonCore\\%s\\Modules\\%s" % (sys.winver, name))
+ 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 win32api.error:
+ except _winreg.error:
pass
path = self.path