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
eb5af220
Commit
eb5af220
authored
Jun 28, 2011
by
Ned Deily
Browse files
Options
Browse Files
Download
Plain Diff
Merge 3.2
parents
84d8fcfc
657b2de8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
26 deletions
+76
-26
Lib/distutils/spawn.py
Lib/distutils/spawn.py
+28
-1
Lib/distutils/sysconfig.py
Lib/distutils/sysconfig.py
+0
-15
Lib/distutils/tests/test_build_ext.py
Lib/distutils/tests/test_build_ext.py
+37
-10
Misc/NEWS
Misc/NEWS
+11
-0
No files found.
Lib/distutils/spawn.py
View file @
eb5af220
...
@@ -96,15 +96,42 @@ def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0):
...
@@ -96,15 +96,42 @@ def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0):
raise
DistutilsExecError
(
raise
DistutilsExecError
(
"command '%s' failed with exit status %d"
%
(
cmd
[
0
],
rc
))
"command '%s' failed with exit status %d"
%
(
cmd
[
0
],
rc
))
if
sys
.
platform
==
'darwin'
:
from
distutils
import
sysconfig
_cfg_target
=
None
_cfg_target_split
=
None
def
_spawn_posix
(
cmd
,
search_path
=
1
,
verbose
=
0
,
dry_run
=
0
):
def
_spawn_posix
(
cmd
,
search_path
=
1
,
verbose
=
0
,
dry_run
=
0
):
log
.
info
(
' '
.
join
(
cmd
))
log
.
info
(
' '
.
join
(
cmd
))
if
dry_run
:
if
dry_run
:
return
return
exec_fn
=
search_path
and
os
.
execvp
or
os
.
execv
exec_fn
=
search_path
and
os
.
execvp
or
os
.
execv
exec_args
=
[
cmd
[
0
],
cmd
]
if
sys
.
platform
==
'darwin'
:
global
_cfg_target
,
_cfg_target_split
if
_cfg_target
is
None
:
_cfg_target
=
sysconfig
.
get_config_var
(
'MACOSX_DEPLOYMENT_TARGET'
)
or
''
if
_cfg_target
:
_cfg_target_split
=
[
int
(
x
)
for
x
in
_cfg_target
.
split
(
'.'
)]
if
_cfg_target
:
# ensure that the deployment target of build process is not less
# than that used when the interpreter was built. This ensures
# extension modules are built with correct compatibility values
cur_target
=
os
.
environ
.
get
(
'MACOSX_DEPLOYMENT_TARGET'
,
_cfg_target
)
if
_cfg_target_split
>
[
int
(
x
)
for
x
in
cur_target
.
split
(
'.'
)]:
my_msg
=
(
'$MACOSX_DEPLOYMENT_TARGET mismatch: '
'now "%s" but "%s" during configure'
%
(
cur_target
,
_cfg_target
))
raise
DistutilsPlatformError
(
my_msg
)
env
=
dict
(
os
.
environ
,
MACOSX_DEPLOYMENT_TARGET
=
cur_target
)
exec_fn
=
search_path
and
os
.
execvpe
or
os
.
execve
exec_args
.
append
(
env
)
pid
=
os
.
fork
()
pid
=
os
.
fork
()
if
pid
==
0
:
# in the child
if
pid
==
0
:
# in the child
try
:
try
:
exec_fn
(
cmd
[
0
],
cmd
)
exec_fn
(
*
exec_args
)
except
OSError
as
e
:
except
OSError
as
e
:
sys
.
stderr
.
write
(
"unable to execute %s: %s
\
n
"
sys
.
stderr
.
write
(
"unable to execute %s: %s
\
n
"
%
(
cmd
[
0
],
e
.
strerror
))
%
(
cmd
[
0
],
e
.
strerror
))
...
...
Lib/distutils/sysconfig.py
View file @
eb5af220
...
@@ -419,21 +419,6 @@ def _init_posix():
...
@@ -419,21 +419,6 @@ def _init_posix():
raise DistutilsPlatformError(my_msg)
raise DistutilsPlatformError(my_msg)
# On MacOSX we need to check the setting of the environment variable
# MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
# it needs to be compatible.
# If it isn't set we set it to the configure-time value
if sys.platform == 'darwin' and 'MACOSX_DEPLOYMENT_TARGET' in g:
cfg_target = g['MACOSX_DEPLOYMENT_TARGET']
cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '')
if cur_target == '':
cur_target = cfg_target
os.environ['MACOSX_DEPLOYMENT_TARGET'] = cfg_target
elif [int(x) for x in cfg_target.split('.')] > [int(x) for x in cur_target.split('.')]:
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "
%
s
" but "
%
s
" during configure'
% (cur_target, cfg_target))
raise DistutilsPlatformError(my_msg)
# On AIX, there are wrong paths to the linker scripts in the Makefile
# On AIX, there are wrong paths to the linker scripts in the Makefile
# -- these paths are relative to the Python source, but when installed
# -- these paths are relative to the Python source, but when installed
# the scripts are in another directory.
# the scripts are in another directory.
...
...
Lib/distutils/tests/test_build_ext.py
View file @
eb5af220
...
@@ -11,7 +11,8 @@ from distutils.tests.support import TempdirManager
...
@@ -11,7 +11,8 @@ from distutils.tests.support import TempdirManager
from
distutils.tests.support
import
LoggingSilencer
from
distutils.tests.support
import
LoggingSilencer
from
distutils.extension
import
Extension
from
distutils.extension
import
Extension
from
distutils.errors
import
(
from
distutils.errors
import
(
CompileError
,
DistutilsSetupError
,
UnknownFileError
)
CompileError
,
DistutilsPlatformError
,
DistutilsSetupError
,
UnknownFileError
)
import
unittest
import
unittest
from
test
import
support
from
test
import
support
...
@@ -431,18 +432,43 @@ class BuildExtTestCase(TempdirManager,
...
@@ -431,18 +432,43 @@ class BuildExtTestCase(TempdirManager,
@
unittest
.
skipUnless
(
sys
.
platform
==
'darwin'
,
'test only relevant for MacOSX'
)
@
unittest
.
skipUnless
(
sys
.
platform
==
'darwin'
,
'test only relevant for MacOSX'
)
def
test_deployment_target
(
self
):
def
test_deployment_target_default
(
self
):
self
.
_try_compile_deployment_target
()
# 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
orig_environ
=
os
.
environ
os
.
environ
=
orig_environ
.
copy
()
os
.
environ
=
orig_environ
.
copy
()
self
.
addCleanup
(
setattr
,
os
,
'environ'
,
orig_environ
)
self
.
addCleanup
(
setattr
,
os
,
'environ'
,
orig_environ
)
os
.
environ
[
'MACOSX_DEPLOYMENT_TARGET'
]
=
'10.1'
if
target
is
None
:
self
.
_try_compile_deployment_target
()
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'
)
deptarget_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'deptargetmodule.c'
)
with
open
(
deptarget_c
,
'w'
)
as
fp
:
with
open
(
deptarget_c
,
'w'
)
as
fp
:
...
@@ -451,16 +477,17 @@ class BuildExtTestCase(TempdirManager,
...
@@ -451,16 +477,17 @@ class BuildExtTestCase(TempdirManager,
int dummy;
int dummy;
#if TARGET != MAC_OS_X_VERSION_MIN_REQUIRED
#if TARGET %s MAC_OS_X_VERSION_MIN_REQUIRED
#else
#error "Unexpected target"
#error "Unexpected target"
#endif
#endif
'''
))
'''
%
operator
))
# get the deployment target that the interpreter was built with
target
=
sysconfig
.
get_config_var
(
'MACOSX_DEPLOYMENT_TARGET'
)
target
=
sysconfig
.
get_config_var
(
'MACOSX_DEPLOYMENT_TARGET'
)
target
=
tuple
(
map
(
int
,
target
.
split
(
'.'
)))
target
=
tuple
(
map
(
int
,
target
.
split
(
'.'
)))
target
=
'%02d%01d0'
%
target
target
=
'%02d%01d0'
%
target
deptarget_ext
=
Extension
(
deptarget_ext
=
Extension
(
'deptarget'
,
'deptarget'
,
[
deptarget_c
],
[
deptarget_c
],
...
...
Misc/NEWS
View file @
eb5af220
...
@@ -25,6 +25,17 @@ Core and Builtins
...
@@ -25,6 +25,17 @@ Core and Builtins
Library
Library
-------
-------
- Issue #9516: On Mac OS X, change Distutils to no longer globally attempt to
check or set the MACOSX_DEPLOYMENT_TARGET environment variable for the
interpreter process. This could cause failures in non-Distutils subprocesses
and was unreliable since tests or user programs could modify the interpreter
environment after Distutils set it. Instead, have Distutils set the the
deployment target only in the environment of each build subprocess. It is
still possible to globally override the default by setting
MACOSX_DEPLOYMENT_TARGET before launching the interpreter; its value must be
greater or equal to the default value, the value with which the interpreter
was built.
- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira
- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira
Kitada.
Kitada.
...
...
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