Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
943b24e7
Kaydet (Commit)
943b24e7
authored
Mar 07, 2009
tarafından
Tarek Ziadé
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #5394: removed > 2.3 syntax from distutils.msvc9compiler
üst
ce15a65c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
16 deletions
+45
-16
msvc9compiler.py
Lib/distutils/msvc9compiler.py
+20
-16
test_msvc9compiler.py
Lib/distutils/tests/test_msvc9compiler.py
+22
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/distutils/msvc9compiler.py
Dosyayı görüntüle @
943b24e7
...
@@ -17,10 +17,11 @@ __revision__ = "$Id$"
...
@@ -17,10 +17,11 @@ __revision__ = "$Id$"
import
os
import
os
import
subprocess
import
subprocess
import
sys
import
sys
from
distutils.errors
import
(
DistutilsExecError
,
DistutilsPlatformError
,
CompileError
,
LibError
,
LinkError
)
from
distutils.errors
import
DistutilsExecError
,
DistutilsPlatformError
,
\
from
distutils.ccompiler
import
(
CCompiler
,
gen_preprocess_options
,
CompileError
,
LibError
,
LinkError
gen_lib_options
)
from
distutils.ccompiler
import
CCompiler
,
gen_preprocess_options
,
\
gen_lib_options
from
distutils
import
log
from
distutils
import
log
from
distutils.util
import
get_platform
from
distutils.util
import
get_platform
...
@@ -53,15 +54,14 @@ class Reg:
...
@@ -53,15 +54,14 @@ class Reg:
"""Helper class to read values from the registry
"""Helper class to read values from the registry
"""
"""
@classmethod
def
get_value
(
cls
,
path
,
key
):
def
get_value
(
cls
,
path
,
key
):
for
base
in
HKEYS
:
for
base
in
HKEYS
:
d
=
cls
.
read_values
(
base
,
path
)
d
=
cls
.
read_values
(
base
,
path
)
if
d
and
key
in
d
:
if
d
and
key
in
d
:
return
d
[
key
]
return
d
[
key
]
raise
KeyError
(
key
)
raise
KeyError
(
key
)
get_value
=
classmethod
(
get_value
)
@classmethod
def
read_keys
(
cls
,
base
,
key
):
def
read_keys
(
cls
,
base
,
key
):
"""Return list of registry keys."""
"""Return list of registry keys."""
try
:
try
:
...
@@ -78,8 +78,8 @@ class Reg:
...
@@ -78,8 +78,8 @@ class Reg:
L
.
append
(
k
)
L
.
append
(
k
)
i
+=
1
i
+=
1
return
L
return
L
read_keys
=
classmethod
(
read_keys
)
@classmethod
def
read_values
(
cls
,
base
,
key
):
def
read_values
(
cls
,
base
,
key
):
"""Return dict of registry keys and values.
"""Return dict of registry keys and values.
...
@@ -100,8 +100,8 @@ class Reg:
...
@@ -100,8 +100,8 @@ class Reg:
d
[
cls
.
convert_mbcs
(
name
)]
=
cls
.
convert_mbcs
(
value
)
d
[
cls
.
convert_mbcs
(
name
)]
=
cls
.
convert_mbcs
(
value
)
i
+=
1
i
+=
1
return
d
return
d
read_values
=
classmethod
(
read_values
)
@staticmethod
def
convert_mbcs
(
s
):
def
convert_mbcs
(
s
):
dec
=
getattr
(
s
,
"decode"
,
None
)
dec
=
getattr
(
s
,
"decode"
,
None
)
if
dec
is
not
None
:
if
dec
is
not
None
:
...
@@ -110,6 +110,7 @@ class Reg:
...
@@ -110,6 +110,7 @@ class Reg:
except
UnicodeError
:
except
UnicodeError
:
pass
pass
return
s
return
s
convert_mbcs
=
staticmethod
(
convert_mbcs
)
class
MacroExpander
:
class
MacroExpander
:
...
@@ -131,7 +132,7 @@ class MacroExpander:
...
@@ -131,7 +132,7 @@ class MacroExpander:
"sdkinstallrootv2.0"
)
"sdkinstallrootv2.0"
)
else
:
else
:
raise
KeyError
(
"sdkinstallrootv2.0"
)
raise
KeyError
(
"sdkinstallrootv2.0"
)
except
KeyError
as
exc
:
#
except
KeyError
:
raise
DistutilsPlatformError
(
raise
DistutilsPlatformError
(
"""Python was built with Visual Studio 2008;
"""Python was built with Visual Studio 2008;
extensions must be built with a compiler than can generate compatible binaries.
extensions must be built with a compiler than can generate compatible binaries.
...
@@ -479,7 +480,7 @@ class MSVCCompiler(CCompiler) :
...
@@ -479,7 +480,7 @@ class MSVCCompiler(CCompiler) :
try
:
try
:
self
.
spawn
([
self
.
rc
]
+
pp_opts
+
self
.
spawn
([
self
.
rc
]
+
pp_opts
+
[
output_opt
]
+
[
input_opt
])
[
output_opt
]
+
[
input_opt
])
except
DistutilsExecError
as
msg
:
except
DistutilsExecError
,
msg
:
raise
CompileError
(
msg
)
raise
CompileError
(
msg
)
continue
continue
elif
ext
in
self
.
_mc_extensions
:
elif
ext
in
self
.
_mc_extensions
:
...
@@ -506,7 +507,7 @@ class MSVCCompiler(CCompiler) :
...
@@ -506,7 +507,7 @@ class MSVCCompiler(CCompiler) :
self
.
spawn
([
self
.
rc
]
+
self
.
spawn
([
self
.
rc
]
+
[
"/fo"
+
obj
]
+
[
rc_file
])
[
"/fo"
+
obj
]
+
[
rc_file
])
except
DistutilsExecError
as
msg
:
except
DistutilsExecError
,
msg
:
raise
CompileError
(
msg
)
raise
CompileError
(
msg
)
continue
continue
else
:
else
:
...
@@ -519,7 +520,7 @@ class MSVCCompiler(CCompiler) :
...
@@ -519,7 +520,7 @@ class MSVCCompiler(CCompiler) :
self
.
spawn
([
self
.
cc
]
+
compile_opts
+
pp_opts
+
self
.
spawn
([
self
.
cc
]
+
compile_opts
+
pp_opts
+
[
input_opt
,
output_opt
]
+
[
input_opt
,
output_opt
]
+
extra_postargs
)
extra_postargs
)
except
DistutilsExecError
as
msg
:
except
DistutilsExecError
,
msg
:
raise
CompileError
(
msg
)
raise
CompileError
(
msg
)
return
objects
return
objects
...
@@ -544,7 +545,7 @@ class MSVCCompiler(CCompiler) :
...
@@ -544,7 +545,7 @@ class MSVCCompiler(CCompiler) :
pass
# XXX what goes here?
pass
# XXX what goes here?
try
:
try
:
self
.
spawn
([
self
.
lib
]
+
lib_args
)
self
.
spawn
([
self
.
lib
]
+
lib_args
)
except
DistutilsExecError
as
msg
:
except
DistutilsExecError
,
msg
:
raise
LibError
(
msg
)
raise
LibError
(
msg
)
else
:
else
:
log
.
debug
(
"skipping
%
s (up-to-date)"
,
output_filename
)
log
.
debug
(
"skipping
%
s (up-to-date)"
,
output_filename
)
...
@@ -633,7 +634,7 @@ class MSVCCompiler(CCompiler) :
...
@@ -633,7 +634,7 @@ class MSVCCompiler(CCompiler) :
self
.
mkpath
(
os
.
path
.
dirname
(
output_filename
))
self
.
mkpath
(
os
.
path
.
dirname
(
output_filename
))
try
:
try
:
self
.
spawn
([
self
.
linker
]
+
ld_args
)
self
.
spawn
([
self
.
linker
]
+
ld_args
)
except
DistutilsExecError
as
msg
:
except
DistutilsExecError
,
msg
:
raise
LinkError
(
msg
)
raise
LinkError
(
msg
)
# embed the manifest
# embed the manifest
...
@@ -641,12 +642,15 @@ class MSVCCompiler(CCompiler) :
...
@@ -641,12 +642,15 @@ class MSVCCompiler(CCompiler) :
# will still consider the DLL up-to-date, but it will not have a
# will still consider the DLL up-to-date, but it will not have a
# manifest. Maybe we should link to a temp file? OTOH, that
# manifest. Maybe we should link to a temp file? OTOH, that
# implies a build environment error that shouldn't go undetected.
# implies a build environment error that shouldn't go undetected.
mfid
=
1
if
target_desc
==
CCompiler
.
EXECUTABLE
else
2
if
target_desc
==
CCompiler
.
EXECUTABLE
:
mfid
=
1
else
:
mfid
=
2
out_arg
=
'-outputresource:
%
s;
%
s'
%
(
output_filename
,
mfid
)
out_arg
=
'-outputresource:
%
s;
%
s'
%
(
output_filename
,
mfid
)
try
:
try
:
self
.
spawn
([
'mt.exe'
,
'-nologo'
,
'-manifest'
,
self
.
spawn
([
'mt.exe'
,
'-nologo'
,
'-manifest'
,
temp_manifest
,
out_arg
])
temp_manifest
,
out_arg
])
except
DistutilsExecError
as
msg
:
except
DistutilsExecError
,
msg
:
raise
LinkError
(
msg
)
raise
LinkError
(
msg
)
else
:
else
:
log
.
debug
(
"skipping
%
s (up-to-date)"
,
output_filename
)
log
.
debug
(
"skipping
%
s (up-to-date)"
,
output_filename
)
...
...
Lib/distutils/tests/test_msvc9compiler.py
Dosyayı görüntüle @
943b24e7
...
@@ -30,6 +30,28 @@ class msvc9compilerTestCase(unittest.TestCase):
...
@@ -30,6 +30,28 @@ class msvc9compilerTestCase(unittest.TestCase):
finally
:
finally
:
msvc9compiler
.
find_vcvarsall
=
old_find_vcvarsall
msvc9compiler
.
find_vcvarsall
=
old_find_vcvarsall
def
test_reg_class
(
self
):
if
sys
.
platform
!=
'win32'
:
# this test is only for win32
return
from
distutils.msvc9compiler
import
Reg
self
.
assertRaises
(
KeyError
,
Reg
.
get_value
,
'xxx'
,
'xxx'
)
# looking for values that should exist on all
# windows registeries versions.
path
=
r'Software\Microsoft\Notepad'
v
=
Reg
.
get_value
(
path
,
u"lfitalic"
)
self
.
assert_
(
v
in
(
0
,
1
))
import
_winreg
HKCU
=
_winreg
.
HKEY_CURRENT_USER
keys
=
Reg
.
read_keys
(
HKCU
,
'xxxx'
)
self
.
assertEquals
(
keys
,
None
)
keys
=
Reg
.
read_keys
(
HKCU
,
r'Software\Microsoft'
)
self
.
assert_
(
'Notepad'
in
keys
)
def
test_suite
():
def
test_suite
():
return
unittest
.
makeSuite
(
msvc9compilerTestCase
)
return
unittest
.
makeSuite
(
msvc9compilerTestCase
)
...
...
Misc/NEWS
Dosyayı görüntüle @
943b24e7
...
@@ -168,6 +168,9 @@ Core and Builtins
...
@@ -168,6 +168,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #5394: removed > 2.3 syntax from distutils.msvc9compiler.
Original patch by Akira Kitada.
- Issue #5385: Fixed mmap crash after resize failure on windows.
- Issue #5385: Fixed mmap crash after resize failure on windows.
- Issue #5179: Fixed subprocess handle leak on failure on windows.
- Issue #5179: Fixed subprocess handle leak on failure on windows.
...
...
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