Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d085a7e2
Commit
d085a7e2
authored
May 25, 2008
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2879: rename _winreg to winreg.
parent
344fa51a
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
72 additions
and
71 deletions
+72
-71
Doc/library/windows.rst
Doc/library/windows.rst
+1
-1
Doc/library/winreg.rst
Doc/library/winreg.rst
+2
-3
Lib/distutils/msvc9compiler.py
Lib/distutils/msvc9compiler.py
+9
-9
Lib/distutils/msvccompiler.py
Lib/distutils/msvccompiler.py
+7
-7
Lib/platform.py
Lib/platform.py
+9
-9
Lib/test/test_winreg.py
Lib/test/test_winreg.py
+1
-1
Lib/urllib.py
Lib/urllib.py
+12
-12
Misc/NEWS
Misc/NEWS
+3
-1
Modules/posixmodule.c
Modules/posixmodule.c
+1
-1
PC/VC6/pythoncore.dsp
PC/VC6/pythoncore.dsp
+1
-1
PC/VS7.1/python.iss
PC/VS7.1/python.iss
+2
-2
PC/VS7.1/python20.wse
PC/VS7.1/python20.wse
+4
-4
PC/VS7.1/pythoncore.vcproj
PC/VS7.1/pythoncore.vcproj
+1
-1
PC/VS8.0/pythoncore.vcproj
PC/VS8.0/pythoncore.vcproj
+1
-1
PC/config.c
PC/config.c
+2
-2
PC/winreg.c
PC/winreg.c
+4
-4
PCbuild/pythoncore.vcproj
PCbuild/pythoncore.vcproj
+1
-1
Tools/freeze/extensions_win32.ini
Tools/freeze/extensions_win32.ini
+1
-1
Tools/msi/msilib.py
Tools/msi/msilib.py
+4
-4
Tools/scripts/win_add2path.py
Tools/scripts/win_add2path.py
+6
-6
No files found.
Doc/library/windows.rst
View file @
d085a7e2
...
...
@@ -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
Doc/library/
_
winreg.rst
→
Doc/library/winreg.rst
View file @
d085a7e2
: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>
...
...
Lib/distutils/msvc9compiler.py
View file @
d085a7e2
...
...
@@ -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\
Mic
rosoft\
Visu
alStudio\
%
0.1f"
WINSDK_BASE
=
r"Software\
Mic
rosoft\
Mic
rosoft SDKs\
Wi
ndows"
...
...
Lib/distutils/msvccompiler.py
View file @
d085a7e2
...
...
@@ -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
...
...
Lib/platform.py
View file @
d085a7e2
...
...
@@ -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
...
...
Lib/test/test_winreg.py
View file @
d085a7e2
...
...
@@ -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
...
...
Lib/urllib.py
View file @
d085a7e2
...
...
@@ -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\
Mic
rosoft\
Wi
ndows\
Cu
rrentVersion\
I
nternet 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\
Mic
rosoft\
Wi
ndows\
Cu
rrentVersion\
I
nternet 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
...
...
Misc/NEWS
View file @
d085a7e2
...
...
@@ -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
-------
...
...
Modules/posixmodule.c
View file @
d085a7e2
...
...
@@ -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.
*/
...
...
PC/VC6/pythoncore.dsp
View file @
d085a7e2
...
...
@@ -177,7 +177,7 @@ SOURCE=..\..\Modules\_weakref.c
# End Source File
# Begin Source File
SOURCE=..\
_
winreg.c
SOURCE=..\winreg.c
# End Source File
# Begin Source File
...
...
PC/VS7.1/python.iss
View file @
d085a7e2
...
...
@@ -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
...
...
PC/VS7.1/python20.wse
View file @
d085a7e2
...
...
@@ -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
...
...
PC/VS7.1/pythoncore.vcproj
View file @
d085a7e2
...
...
@@ -401,7 +401,7 @@
RelativePath=
"..\..\Modules\_weakref.c"
>
</File>
<File
RelativePath=
"..\..\Pc\
_
winreg.c"
>
RelativePath=
"..\..\Pc\winreg.c"
>
</File>
<File
RelativePath=
"..\..\Objects\abstract.c"
>
...
...
PC/VS8.0/pythoncore.vcproj
View file @
d085a7e2
...
...
@@ -1559,7 +1559,7 @@
>
</File>
<File
RelativePath=
"..\..\PC\
_
winreg.c"
RelativePath=
"..\..\PC\winreg.c"
>
</File>
<File
...
...
PC/config.c
View file @
d085a7e2
...
...
@@ -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"
,
init
winreg
},
{
"_struct"
,
init_struct
},
{
"datetime"
,
initdatetime
},
{
"_functools"
,
init_functools
},
...
...
PC/
_
winreg.c
→
PC/winreg.c
View file @
d085a7e2
/*
_
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
);
...
...
PCbuild/pythoncore.vcproj
View file @
d085a7e2
...
...
@@ -1563,7 +1563,7 @@
>
</File>
<File
RelativePath=
"..\PC\
_
winreg.c"
RelativePath=
"..\PC\winreg.c"
>
</File>
<File
...
...
Tools/freeze/extensions_win32.ini
View file @
d085a7e2
...
...
@@ -52,7 +52,7 @@ dsp=%PYTHONPREFIX%\PCBuild\zlib.dsp
cl
=
/I %PYTHONPREFIX%
\.
.
\z
lib-1.1.4 /D _WINDOWS /D WIN32
libs
=
%PYTHONPREFIX%
\.
.
\z
lib-1.1.4
\z
lib.lib /nodefaultlib:libc
[
_
winreg]
[winreg]
dsp
=
%PYTHONPREFIX%
\P
CBuild
\w
inreg.dsp
libs
=
advapi32.lib
...
...
Tools/msi/msilib.py
View file @
d085a7e2
...
...
@@ -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
")
...
...
Tools/scripts/win_add2path.py
View file @
d085a7e2
...
...
@@ -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
"
\
n
PATH is now:
\
n
%s
\
n
"
%
envpath
print
"Expanded:"
print
_
winreg
.
ExpandEnvironmentStrings
(
envpath
)
print
winreg
.
ExpandEnvironmentStrings
(
envpath
)
if
__name__
==
'__main__'
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment