]> granicus.if.org Git - python/commitdiff
#2879: rename _winreg to winreg.
authorGeorg Brandl <georg@python.org>
Sun, 25 May 2008 07:45:51 +0000 (07:45 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 25 May 2008 07:45:51 +0000 (07:45 +0000)
20 files changed:
Doc/library/windows.rst
Doc/library/winreg.rst [moved from Doc/library/_winreg.rst with 99% similarity]
Lib/distutils/msvc9compiler.py
Lib/distutils/msvccompiler.py
Lib/platform.py
Lib/test/test_winreg.py
Lib/urllib.py
Misc/NEWS
Modules/posixmodule.c
PC/VC6/pythoncore.dsp
PC/VS7.1/python.iss
PC/VS7.1/python20.wse
PC/VS7.1/pythoncore.vcproj
PC/VS8.0/pythoncore.vcproj
PC/config.c
PC/winreg.c [moved from PC/_winreg.c with 99% similarity]
PCbuild/pythoncore.vcproj
Tools/freeze/extensions_win32.ini
Tools/msi/msilib.py
Tools/scripts/win_add2path.py

index b09dd8b3f2e1e08f3b8eccb003126c3371f957e0..b60d4e4ccf51d9c2a8a192ebb061842ce1bc6883 100644 (file)
@@ -11,5 +11,5 @@ This chapter describes modules that are only available on MS Windows platforms.
 
    msilib.rst
    msvcrt.rst
-   _winreg.rst
+   winreg.rst
    winsound.rst
similarity index 99%
rename from Doc/library/_winreg.rst
rename to Doc/library/winreg.rst
index ba2994df87a589286a5e2c5aa9e1ba12f4e61cd4..f349fdf18146c5378e1d32a7bf639a8d8cf57a95 100644 (file)
@@ -1,8 +1,7 @@
-
-:mod:`_winreg` -- Windows registry access
+:mod:`winreg` -- Windows registry access
 =========================================
 
-.. module:: _winreg
+.. module:: winreg
    :platform: Windows
    :synopsis: Routines and objects for manipulating the Windows registry.
 .. sectionauthor:: Mark Hammond <MarkH@ActiveState.com>
index c8d52c423754d7ef6316085c49b310e54923e4f6..fdb74aeabfae69d2f890e16fe58bd5710a154ad1 100644 (file)
@@ -24,17 +24,17 @@ from distutils.ccompiler import (CCompiler, gen_preprocess_options,
 from distutils import log
 from distutils.util import get_platform
 
-import _winreg
+import winreg
 
-RegOpenKeyEx = _winreg.OpenKeyEx
-RegEnumKey = _winreg.EnumKey
-RegEnumValue = _winreg.EnumValue
-RegError = _winreg.error
+RegOpenKeyEx = winreg.OpenKeyEx
+RegEnumKey = winreg.EnumKey
+RegEnumValue = winreg.EnumValue
+RegError = winreg.error
 
-HKEYS = (_winreg.HKEY_USERS,
-         _winreg.HKEY_CURRENT_USER,
-         _winreg.HKEY_LOCAL_MACHINE,
-         _winreg.HKEY_CLASSES_ROOT)
+HKEYS = (winreg.HKEY_USERS,
+         winreg.HKEY_CURRENT_USER,
+         winreg.HKEY_LOCAL_MACHINE,
+         winreg.HKEY_CLASSES_ROOT)
 
 VS_BASE = r"Software\Microsoft\VisualStudio\%0.1f"
 WINSDK_BASE = r"Software\Microsoft\Microsoft SDKs\Windows"
index 71146dcfe39354c80bb5d233e3646fa403f4b8ba..1cd0f91d5f970feab24ebcc06c144ac9f129cbf1 100644 (file)
@@ -20,15 +20,15 @@ from distutils import log
 
 _can_read_reg = False
 try:
-    import _winreg
+    import winreg
 
     _can_read_reg = True
-    hkey_mod = _winreg
+    hkey_mod = winreg
 
-    RegOpenKeyEx = _winreg.OpenKeyEx
-    RegEnumKey = _winreg.EnumKey
-    RegEnumValue = _winreg.EnumValue
-    RegError = _winreg.error
+    RegOpenKeyEx = winreg.OpenKeyEx
+    RegEnumKey = winreg.EnumKey
+    RegEnumValue = winreg.EnumValue
+    RegError = winreg.error
 
 except ImportError:
     try:
@@ -44,7 +44,7 @@ except ImportError:
     except ImportError:
         log.info("Warning: Can't read registry to find the "
                  "necessary compiler setting\n"
-                 "Make sure that Python modules _winreg, "
+                 "Make sure that Python modules winreg, "
                  "win32api or win32con are installed.")
         pass
 
index d5cf62305bb81db589c4d086212ebc85c682dfa3..415d83f8dde66b1e47c6c8cb9559c86607b2946e 100755 (executable)
@@ -529,9 +529,9 @@ def _win32_getvalue(key,name,default=''):
         # Use win32api if available
         from win32api import RegQueryValueEx
     except ImportError:
-        # On Python 2.0 and later, emulate using _winreg
-        import _winreg
-        RegQueryValueEx = _winreg.QueryValueEx
+        # On Python 2.0 and later, emulate using winreg
+        import winreg
+        RegQueryValueEx = winreg.QueryValueEx
     try:
         return RegQueryValueEx(key,name)
     except:
@@ -579,14 +579,14 @@ def win32_ver(release='',version='',csd='',ptype=''):
             # No emulation possible, so return the defaults...
             return release,version,csd,ptype
         else:
-            # Emulation using _winreg (added in Python 2.0) and
+            # Emulation using winreg (added in Python 2.0) and
             # sys.getwindowsversion() (added in Python 2.3)
-            import _winreg
+            import winreg
             GetVersionEx = sys.getwindowsversion
-            RegQueryValueEx = _winreg.QueryValueEx
-            RegOpenKeyEx = _winreg.OpenKeyEx
-            RegCloseKey = _winreg.CloseKey
-            HKEY_LOCAL_MACHINE = _winreg.HKEY_LOCAL_MACHINE
+            RegQueryValueEx = winreg.QueryValueEx
+            RegOpenKeyEx = winreg.OpenKeyEx
+            RegCloseKey = winreg.CloseKey
+            HKEY_LOCAL_MACHINE = winreg.HKEY_LOCAL_MACHINE
             VER_PLATFORM_WIN32_WINDOWS = 1
             VER_PLATFORM_WIN32_NT = 2
             VER_NT_WORKSTATION = 1
index e852c69684ce4aa77ea4967a1a909025a2219762..3dbabc591f4efb0d9884a58010b97620618d541e 100644 (file)
@@ -2,7 +2,7 @@
 # Test the windows specific win32reg module.
 # Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey
 
-from _winreg import *
+from winreg import *
 import os, sys
 import unittest
 
index 5cdfb46c475d2cead1563dbf2c0e449ba006a10f..a5171ef47820431991be6cc2048748248a756ec9 100644 (file)
@@ -1489,19 +1489,19 @@ elif os.name == 'nt':
         """
         proxies = {}
         try:
-            import _winreg
+            import winreg
         except ImportError:
             # Std module, so should be around - but you never know!
             return proxies
         try:
-            internetSettings = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
+            internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
                 r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
-            proxyEnable = _winreg.QueryValueEx(internetSettings,
-                                               'ProxyEnable')[0]
+            proxyEnable = winreg.QueryValueEx(internetSettings,
+                                              'ProxyEnable')[0]
             if proxyEnable:
                 # Returned as Unicode but problems if not converted to ASCII
-                proxyServer = str(_winreg.QueryValueEx(internetSettings,
-                                                       'ProxyServer')[0])
+                proxyServer = str(winreg.QueryValueEx(internetSettings,
+                                                      'ProxyServer')[0])
                 if '=' in proxyServer:
                     # Per-protocol settings
                     for p in proxyServer.split(';'):
@@ -1537,18 +1537,18 @@ elif os.name == 'nt':
 
     def proxy_bypass_registry(host):
         try:
-            import _winreg
+            import winreg
             import re
         except ImportError:
             # Std modules, so should be around - but you never know!
             return 0
         try:
-            internetSettings = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
+            internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
                 r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
-            proxyEnable = _winreg.QueryValueEx(internetSettings,
-                                               'ProxyEnable')[0]
-            proxyOverride = str(_winreg.QueryValueEx(internetSettings,
-                                                     'ProxyOverride')[0])
+            proxyEnable = winreg.QueryValueEx(internetSettings,
+                                              'ProxyEnable')[0]
+            proxyOverride = str(winreg.QueryValueEx(internetSettings,
+                                                    'ProxyOverride')[0])
             # ^^^^ Returned as Unicode but problems if not converted to ASCII
         except WindowsError:
             return 0
index 161485fda99abbcad7311b2a92296dbfced2c050..f385560202c3d062b12d016075f8631f56d3f3f8 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -39,11 +39,13 @@ Core and Builtins
 Extension Modules
 -----------------
 
+- Renamed ``_winreg`` module to ``winreg``.
+
 - Support os.O_ASYNC and fcntl.FASYNC if the constants exist on the platform.
 
 - Support for Windows 9x has been removed from the winsound module.
 
-- Fixed #2870: cmathmodule.c compile error
+- Fixed #2870: cmathmodule.c compile error.
 
 Library
 -------
index 33bcbd5e7b771edbf93847b7f3bd12252d3c15c9..7020d8eb8b70b681f1956f2f8f6e05a0723ac860 100644 (file)
@@ -476,7 +476,7 @@ static PyObject *
 win32_error(char* function, char* filename)
 {
        /* XXX We should pass the function name along in the future.
-          (_winreg.c also wants to pass the function name.)
+          (winreg.c also wants to pass the function name.)
           This would however require an additional param to the
           Windows error object, which is non-trivial.
        */
index 9a369f2c58e8f67cacfa0f146858eba614e7ae54..84a5bb5586f4f617e6cda04b3b853c52e23ca8ea 100644 (file)
@@ -177,7 +177,7 @@ SOURCE=..\..\Modules\_weakref.c
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=..\_winreg.c\r
+SOURCE=..\winreg.c\r
 # End Source File\r
 # Begin Source File\r
 \r
index 70c9bf3abd980ee84a47a1943438ed9c38feb712..2f6c8b72712e436f08fdc9c6a1101c02eb151f15 100644 (file)
@@ -155,8 +155,8 @@ Source: libs\select.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Compone
 Source: DLLs\unicodedata.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main
 Source: libs\unicodedata.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main
 
-Source: DLLs\_winreg.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main
-Source: libs\_winreg.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main
+Source: DLLs\winreg.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main
+Source: libs\winreg.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main
 
 Source: DLLs\winsound.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main
 Source: libs\winsound.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main
index 6c1c387c3c523755f64a8e091ef15c37508f034e..8611b8e574b957a91e95efd959538b38c7724be4 100644 (file)
@@ -1713,8 +1713,8 @@ item: Remark
   Text=Extension module DLLs (.pyd); keep in synch with libs directory next
 end
 item: Install File
-  Source=.\_winreg.pyd
-  Destination=%MAINDIR%\DLLs\_winreg.pyd
+  Source=.\winreg.pyd
+  Destination=%MAINDIR%\DLLs\winreg.pyd
   Description=Extension modules
   Flags=0000000000000010
 end
@@ -1809,8 +1809,8 @@ item: Remark
   Text=Link libraries (.lib); keep in synch with DLLs above, except that the Python lib lives here.
 end
 item: Install File
-  Source=.\_winreg.lib
-  Destination=%MAINDIR%\libs\_winreg.lib
+  Source=.\winreg.lib
+  Destination=%MAINDIR%\libs\winreg.lib
   Description=Link library files
   Flags=0000000000000010
 end
index f06d626339ff6a7dfb6f65072061c7f8695542be..38982f4ddc4577526691e3016ceccc02cadc3e0e 100644 (file)
                        RelativePath="..\..\Modules\_weakref.c">
                </File>
                <File
-                       RelativePath="..\..\Pc\_winreg.c">
+                       RelativePath="..\..\Pc\winreg.c">
                </File>
                <File
                        RelativePath="..\..\Objects\abstract.c">
index 8e59dae84e35dee0edaf73b847fe92ed98935726..75414ce5a241ef3be994530f52c8fb2b78e39002 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\..\PC\_winreg.c"\r
+                               RelativePath="..\..\PC\winreg.c"\r
                                >\r
                        </File>\r
                        <File\r
index e3bbde72579c99b29315e02b9c1a9f124854e0e8..15225335e4e997b79f80d36fe24ccfc72fed4a95 100644 (file)
@@ -42,7 +42,7 @@ extern void initmmap(void);
 extern void init_csv(void);
 extern void init_sre(void);
 extern void initparser(void);
-extern void init_winreg(void);
+extern void initwinreg(void);
 extern void init_struct(void);
 extern void initdatetime(void);
 extern void init_functools(void);
@@ -116,7 +116,7 @@ struct _inittab _PyImport_Inittab[] = {
        {"_csv", init_csv},
        {"_sre", init_sre},
        {"parser", initparser},
-       {"_winreg", init_winreg},
+       {"winreg", initwinreg},
        {"_struct", init_struct},
        {"datetime", initdatetime},
        {"_functools", init_functools},
similarity index 99%
rename from PC/_winreg.c
rename to PC/winreg.c
index 8ba4863c1f7283bc83e9e4c9d4b30c44c8f2e93a..1b141d3f473447d4e15aeeb229b82a2a292e0a83 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  _winreg.c
+  winreg.c
 
   Windows Registry access module for Python.
 
@@ -1355,7 +1355,7 @@ PySetValue(PyObject *self, PyObject *args)
                return NULL;
        if (typ != REG_SZ) {
                PyErr_SetString(PyExc_TypeError,
-                               "Type must be _winreg.REG_SZ");
+                               "Type must be winreg.REG_SZ");
                return NULL;
        }
 
@@ -1565,10 +1565,10 @@ inskey(PyObject * d, char * name, HKEY key)
 
 #define ADD_KEY(val) inskey(d, #val, val)
 
-PyMODINIT_FUNC init_winreg(void)
+PyMODINIT_FUNC initwinreg(void)
 {
        PyObject *m, *d;
-       m = Py_InitModule3("_winreg", winreg_methods, module_doc);
+       m = Py_InitModule3("winreg", winreg_methods, module_doc);
        if (m == NULL)
                return;
        d = PyModule_GetDict(m);
index c2a3b9a456c1871b100acd641807e820ed3fb935..143a17894a731f355b01a21e85b10411be7bcf4f 100644 (file)
                                >
                        </File>
                        <File
-                               RelativePath="..\PC\_winreg.c"
+                               RelativePath="..\PC\winreg.c"
                                >
                        </File>
                        <File
index efc5e35a4a62bf96e2ff11c4f660157991300185..1e36abad57c96c622f2a9db7f97cef2d2ae06d0d 100644 (file)
@@ -52,7 +52,7 @@ dsp=%PYTHONPREFIX%\PCBuild\zlib.dsp
 cl=/I %PYTHONPREFIX%\..\zlib-1.1.4 /D _WINDOWS /D WIN32 
 libs=%PYTHONPREFIX%\..\zlib-1.1.4\zlib.lib /nodefaultlib:libc
 
-[_winreg]
+[winreg]
 dsp=%PYTHONPREFIX%\PCBuild\winreg.dsp
 libs=advapi32.lib
 
index e07ef2baa3f0fa988bd9c8717a6ba25792866f08..84974000ff1d24e2fb5d6b77afd97e65b91bae4f 100644 (file)
@@ -5,7 +5,7 @@ import win32com.client.gencache
 import win32com.client
 import pythoncom, pywintypes
 from win32com.client import constants
-import re, string, os, sets, glob, subprocess, sys, _winreg, struct
+import re, string, os, sets, glob, subprocess, sys, winreg, struct
 
 # Partially taken from Wine
 datasizemask=      0x00ff
@@ -376,9 +376,9 @@ class CAB:
                      (r"Software\Microsoft\Win32SDK\Directories", "Install Dir"),
                     ]:
             try:
-                key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, k)
-                dir = _winreg.QueryValueEx(key, v)[0]
-                _winreg.CloseKey(key)
+                key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, k)
+                dir = winreg.QueryValueEx(key, v)[0]
+                winreg.CloseKey(key)
             except (WindowsError, IndexError):
                 continue
             cabarc = os.path.join(dir, r"Bin", "cabarc.exe")
index 876bfb29240f3c91377b0c26a5f23b69a349e136..c4f481f94ce9376b5d6876298eadc8a93ca89cb7 100644 (file)
@@ -10,9 +10,9 @@ Licensed to PSF under a Contributor Agreement.
 import sys
 import site
 import os
-import _winreg
+import winreg
 
-HKCU = _winreg.HKEY_CURRENT_USER
+HKCU = winreg.HKEY_CURRENT_USER
 ENV = "Environment"
 PATH = "PATH"
 DEFAULT = u"%PATH%"
@@ -27,9 +27,9 @@ def modify():
     else:
         userscripts = None
 
-    with _winreg.CreateKey(HKCU, ENV) as key:
+    with winreg.CreateKey(HKCU, ENV) as key:
         try:
-            envpath = _winreg.QueryValueEx(key, PATH)[0]
+            envpath = winreg.QueryValueEx(key, PATH)[0]
         except WindowsError:
             envpath = DEFAULT
 
@@ -39,7 +39,7 @@ def modify():
                 paths.append(path)
 
         envpath = os.pathsep.join(paths)
-        _winreg.SetValueEx(key, PATH, 0, _winreg.REG_EXPAND_SZ, envpath)
+        winreg.SetValueEx(key, PATH, 0, winreg.REG_EXPAND_SZ, envpath)
         return paths, envpath
 
 def main():
@@ -51,7 +51,7 @@ def main():
         print "No path was added"
     print "\nPATH is now:\n%s\n" % envpath
     print "Expanded:"
-    print _winreg.ExpandEnvironmentStrings(envpath)
+    print winreg.ExpandEnvironmentStrings(envpath)
 
 if __name__ == '__main__':
     main()