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
d13007fa
Kaydet (Commit)
d13007fa
authored
Haz 29, 2011
tarafından
Ned Deily
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9516: Correct and expand OS X deployment target tests in distutils
test_build_ext.
üst
58f27b20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
10 deletions
+37
-10
test_build_ext.py
Lib/distutils/tests/test_build_ext.py
+37
-10
No files found.
Lib/distutils/tests/test_build_ext.py
Dosyayı görüntüle @
d13007fa
...
...
@@ -11,7 +11,8 @@ from distutils.tests.support import TempdirManager
from
distutils.tests.support
import
LoggingSilencer
from
distutils.extension
import
Extension
from
distutils.errors
import
(
CompileError
,
DistutilsSetupError
,
UnknownFileError
)
CompileError
,
DistutilsPlatformError
,
DistutilsSetupError
,
UnknownFileError
)
import
unittest
from
test
import
support
...
...
@@ -431,18 +432,43 @@ class BuildExtTestCase(TempdirManager,
@unittest.skipUnless
(
sys
.
platform
==
'darwin'
,
'test only relevant for MacOSX'
)
def
test_deployment_target
(
self
):
self
.
_try_compile_deployment_target
()
def
test_deployment_target_default
(
self
):
# Issue 9516: Test that, in the absence of the environment variable,
# an extension module is compiled with the same deployment target as
# the interpreter.
self
.
_try_compile_deployment_target
(
'=='
,
None
)
@unittest.skipUnless
(
sys
.
platform
==
'darwin'
,
'test only relevant for MacOSX'
)
def
test_deployment_target_too_low
(
self
):
# Issue 9516: Test that an extension module is not allowed to be
# compiled with a deployment target less than that of the interpreter.
self
.
assertRaises
(
DistutilsPlatformError
,
self
.
_try_compile_deployment_target
,
'>'
,
'10.1'
)
@unittest.skipUnless
(
sys
.
platform
==
'darwin'
,
'test only relevant for MacOSX'
)
def
test_deployment_target_higher_ok
(
self
):
# Issue 9516: Test that an extension module can be compiled with a
# deployment target higher than that of the interpreter: the ext
# module may depend on some newer OS feature.
deptarget
=
sysconfig
.
get_config_var
(
'MACOSX_DEPLOYMENT_TARGET'
)
if
deptarget
:
# increment the minor version number (i.e. 10.6 -> 10.7)
deptarget
=
[
int
(
x
)
for
x
in
deptarget
.
split
(
'.'
)]
deptarget
[
-
1
]
+=
1
deptarget
=
'.'
.
join
(
str
(
i
)
for
i
in
deptarget
)
self
.
_try_compile_deployment_target
(
'<'
,
deptarget
)
def
_try_compile_deployment_target
(
self
,
operator
,
target
):
orig_environ
=
os
.
environ
os
.
environ
=
orig_environ
.
copy
()
self
.
addCleanup
(
setattr
,
os
,
'environ'
,
orig_environ
)
os
.
environ
[
'MACOSX_DEPLOYMENT_TARGET'
]
=
'10.1'
self
.
_try_compile_deployment_target
()
if
target
is
None
:
if
os
.
environ
.
get
(
'MACOSX_DEPLOYMENT_TARGET'
):
del
os
.
environ
[
'MACOSX_DEPLOYMENT_TARGET'
]
else
:
os
.
environ
[
'MACOSX_DEPLOYMENT_TARGET'
]
=
target
def
_try_compile_deployment_target
(
self
):
deptarget_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'deptargetmodule.c'
)
with
open
(
deptarget_c
,
'w'
)
as
fp
:
...
...
@@ -451,16 +477,17 @@ class BuildExtTestCase(TempdirManager,
int dummy;
#if TARGET != MAC_OS_X_VERSION_MIN_REQUIRED
#if TARGET
%
s MAC_OS_X_VERSION_MIN_REQUIRED
#else
#error "Unexpected target"
#endif
'''
))
'''
%
operator
))
# get the deployment target that the interpreter was built with
target
=
sysconfig
.
get_config_var
(
'MACOSX_DEPLOYMENT_TARGET'
)
target
=
tuple
(
map
(
int
,
target
.
split
(
'.'
)))
target
=
'
%02
d
%01
d0'
%
target
deptarget_ext
=
Extension
(
'deptarget'
,
[
deptarget_c
],
...
...
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