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
dcfd2ced
Commit
dcfd2ced
authored
Jun 30, 2012
by
doko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Issue #3754, refactor sys.platform / get_platform bits, use a
global host_platform instead.
parent
176de764
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
64 deletions
+59
-64
setup.py
setup.py
+59
-64
No files found.
setup.py
View file @
dcfd2ced
...
@@ -15,6 +15,13 @@ from distutils.command.install_lib import install_lib
...
@@ -15,6 +15,13 @@ from distutils.command.install_lib import install_lib
from
distutils.command.build_scripts
import
build_scripts
from
distutils.command.build_scripts
import
build_scripts
from
distutils.spawn
import
find_executable
from
distutils.spawn
import
find_executable
def
get_platform
():
# Get value of sys.platform
if
sys
.
platform
.
startswith
(
'osf1'
):
return
'osf1'
return
sys
.
platform
host_platform
=
get_platform
()
# Were we compiled --with-pydebug or with #define Py_DEBUG?
# Were we compiled --with-pydebug or with #define Py_DEBUG?
COMPILED_WITH_PYDEBUG
=
hasattr
(
sys
,
'gettotalrefcount'
)
COMPILED_WITH_PYDEBUG
=
hasattr
(
sys
,
'gettotalrefcount'
)
...
@@ -70,7 +77,7 @@ def find_file(filename, std_dirs, paths):
...
@@ -70,7 +77,7 @@ def find_file(filename, std_dirs, paths):
'paths' is a list of additional locations to check; if the file is
'paths' is a list of additional locations to check; if the file is
found in one of them, the resulting list will contain the directory.
found in one of them, the resulting list will contain the directory.
"""
"""
if
sys
.
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
# Honor the MacOSX SDK setting when one was specified.
# Honor the MacOSX SDK setting when one was specified.
# An SDK is a directory with the same structure as a real
# An SDK is a directory with the same structure as a real
# system, but with only header files and libraries.
# system, but with only header files and libraries.
...
@@ -80,7 +87,7 @@ def find_file(filename, std_dirs, paths):
...
@@ -80,7 +87,7 @@ def find_file(filename, std_dirs, paths):
for
dir
in
std_dirs
:
for
dir
in
std_dirs
:
f
=
os
.
path
.
join
(
dir
,
filename
)
f
=
os
.
path
.
join
(
dir
,
filename
)
if
sys
.
platform
==
'darwin'
and
is_macosx_sdk_path
(
dir
):
if
host_
platform
==
'darwin'
and
is_macosx_sdk_path
(
dir
):
f
=
os
.
path
.
join
(
sysroot
,
dir
[
1
:],
filename
)
f
=
os
.
path
.
join
(
sysroot
,
dir
[
1
:],
filename
)
if
os
.
path
.
exists
(
f
):
return
[]
if
os
.
path
.
exists
(
f
):
return
[]
...
@@ -89,7 +96,7 @@ def find_file(filename, std_dirs, paths):
...
@@ -89,7 +96,7 @@ def find_file(filename, std_dirs, paths):
for
dir
in
paths
:
for
dir
in
paths
:
f
=
os
.
path
.
join
(
dir
,
filename
)
f
=
os
.
path
.
join
(
dir
,
filename
)
if
sys
.
platform
==
'darwin'
and
is_macosx_sdk_path
(
dir
):
if
host_
platform
==
'darwin'
and
is_macosx_sdk_path
(
dir
):
f
=
os
.
path
.
join
(
sysroot
,
dir
[
1
:],
filename
)
f
=
os
.
path
.
join
(
sysroot
,
dir
[
1
:],
filename
)
if
os
.
path
.
exists
(
f
):
if
os
.
path
.
exists
(
f
):
...
@@ -103,7 +110,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
...
@@ -103,7 +110,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
if
result
is
None
:
if
result
is
None
:
return
None
return
None
if
sys
.
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
sysroot
=
macosx_sdk_root
()
sysroot
=
macosx_sdk_root
()
# Check whether the found file is in one of the standard directories
# Check whether the found file is in one of the standard directories
...
@@ -112,7 +119,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
...
@@ -112,7 +119,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
# Ensure path doesn't end with path separator
# Ensure path doesn't end with path separator
p
=
p
.
rstrip
(
os
.
sep
)
p
=
p
.
rstrip
(
os
.
sep
)
if
sys
.
platform
==
'darwin'
and
is_macosx_sdk_path
(
p
):
if
host_
platform
==
'darwin'
and
is_macosx_sdk_path
(
p
):
if
os
.
path
.
join
(
sysroot
,
p
[
1
:])
==
dirname
:
if
os
.
path
.
join
(
sysroot
,
p
[
1
:])
==
dirname
:
return
[
]
return
[
]
...
@@ -125,7 +132,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
...
@@ -125,7 +132,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
# Ensure path doesn't end with path separator
# Ensure path doesn't end with path separator
p
=
p
.
rstrip
(
os
.
sep
)
p
=
p
.
rstrip
(
os
.
sep
)
if
sys
.
platform
==
'darwin'
and
is_macosx_sdk_path
(
p
):
if
host_
platform
==
'darwin'
and
is_macosx_sdk_path
(
p
):
if
os
.
path
.
join
(
sysroot
,
p
[
1
:])
==
dirname
:
if
os
.
path
.
join
(
sysroot
,
p
[
1
:])
==
dirname
:
return
[
p
]
return
[
p
]
...
@@ -186,9 +193,6 @@ class PyBuildExt(build_ext):
...
@@ -186,9 +193,6 @@ class PyBuildExt(build_ext):
srcdir
=
os
.
path
.
abspath
(
srcdir
)
srcdir
=
os
.
path
.
abspath
(
srcdir
)
moddirlist
=
[
os
.
path
.
join
(
srcdir
,
'Modules'
)]
moddirlist
=
[
os
.
path
.
join
(
srcdir
,
'Modules'
)]
# Platform-dependent module source and include directories
platform
=
self
.
get_platform
()
# Fix up the paths for scripts, too
# Fix up the paths for scripts, too
self
.
distribution
.
scripts
=
[
os
.
path
.
join
(
srcdir
,
filename
)
self
.
distribution
.
scripts
=
[
os
.
path
.
join
(
srcdir
,
filename
)
for
filename
in
self
.
distribution
.
scripts
]
for
filename
in
self
.
distribution
.
scripts
]
...
@@ -303,7 +307,7 @@ class PyBuildExt(build_ext):
...
@@ -303,7 +307,7 @@ class PyBuildExt(build_ext):
ext
.
name
)
ext
.
name
)
return
return
if
self
.
get_platform
()
==
'darwin'
and
(
if
host_platform
==
'darwin'
and
(
sys
.
maxsize
>
2
**
32
and
'-arch'
in
ext
.
extra_link_args
):
sys
.
maxsize
>
2
**
32
and
'-arch'
in
ext
.
extra_link_args
):
# Don't bother doing an import check when an extension was
# Don't bother doing an import check when an extension was
# build with an explicit '-arch' flag on OSX. That's currently
# build with an explicit '-arch' flag on OSX. That's currently
...
@@ -317,7 +321,7 @@ class PyBuildExt(build_ext):
...
@@ -317,7 +321,7 @@ class PyBuildExt(build_ext):
# Workaround for Cygwin: Cygwin currently has fork issues when many
# Workaround for Cygwin: Cygwin currently has fork issues when many
# modules have been imported
# modules have been imported
if
self
.
get_platform
()
==
'cygwin'
:
if
host_platform
==
'cygwin'
:
self
.
announce
(
'WARNING: skipping import check for Cygwin-based "%s"'
self
.
announce
(
'WARNING: skipping import check for Cygwin-based "%s"'
%
ext
.
name
)
%
ext
.
name
)
return
return
...
@@ -361,12 +365,6 @@ class PyBuildExt(build_ext):
...
@@ -361,12 +365,6 @@ class PyBuildExt(build_ext):
level
=
3
)
level
=
3
)
self
.
failed
.
append
(
ext
.
name
)
self
.
failed
.
append
(
ext
.
name
)
def
get_platform
(
self
):
# Get value of sys.platform
if
sys
.
platform
.
startswith
(
'osf1'
):
return
'osf1'
return
sys
.
platform
def
add_multiarch_paths
(
self
):
def
add_multiarch_paths
(
self
):
# Debian/Ubuntu multiarch support.
# Debian/Ubuntu multiarch support.
# https://wiki.ubuntu.com/MultiarchSpec
# https://wiki.ubuntu.com/MultiarchSpec
...
@@ -457,18 +455,17 @@ class PyBuildExt(build_ext):
...
@@ -457,18 +455,17 @@ class PyBuildExt(build_ext):
with
open
(
config_h
)
as
file
:
with
open
(
config_h
)
as
file
:
config_h_vars
=
sysconfig
.
parse_config_h
(
file
)
config_h_vars
=
sysconfig
.
parse_config_h
(
file
)
platform
=
self
.
get_platform
()
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
# OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
# OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
if
platform
in
[
'osf1'
,
'unixware7'
,
'openunix8'
]:
if
host_
platform
in
[
'osf1'
,
'unixware7'
,
'openunix8'
]:
lib_dirs
+=
[
'/usr/ccs/lib'
]
lib_dirs
+=
[
'/usr/ccs/lib'
]
# HP-UX11iv3 keeps files in lib/hpux folders.
# HP-UX11iv3 keeps files in lib/hpux folders.
if
platform
==
'hp-ux11'
:
if
host_
platform
==
'hp-ux11'
:
lib_dirs
+=
[
'/usr/lib/hpux64'
,
'/usr/lib/hpux32'
]
lib_dirs
+=
[
'/usr/lib/hpux64'
,
'/usr/lib/hpux32'
]
if
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
# This should work on any unixy platform ;-)
# This should work on any unixy platform ;-)
# If the user has bothered specifying additional -I and -L flags
# If the user has bothered specifying additional -I and -L flags
# in OPT and LDFLAGS we might as well use them here.
# in OPT and LDFLAGS we might as well use them here.
...
@@ -488,7 +485,7 @@ class PyBuildExt(build_ext):
...
@@ -488,7 +485,7 @@ class PyBuildExt(build_ext):
# Check for MacOS X, which doesn't need libm.a at all
# Check for MacOS X, which doesn't need libm.a at all
math_libs
=
[
'm'
]
math_libs
=
[
'm'
]
if
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
math_libs
=
[]
math_libs
=
[]
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
...
@@ -624,7 +621,7 @@ class PyBuildExt(build_ext):
...
@@ -624,7 +621,7 @@ class PyBuildExt(build_ext):
elif self.compiler.find_library_file(lib_dirs, '
curses
'):
elif self.compiler.find_library_file(lib_dirs, '
curses
'):
curses_library = '
curses
'
curses_library = '
curses
'
if platform == '
darwin
':
if
host_
platform == '
darwin
':
os_release = int(os.uname()[2].split('
.
')[0])
os_release = int(os.uname()[2].split('
.
')[0])
dep_target = sysconfig.get_config_var('
MACOSX_DEPLOYMENT_TARGET
')
dep_target = sysconfig.get_config_var('
MACOSX_DEPLOYMENT_TARGET
')
if dep_target and dep_target.split('
.
') < ['
10
', '
5
']:
if dep_target and dep_target.split('
.
') < ['
10
', '
5
']:
...
@@ -636,7 +633,7 @@ class PyBuildExt(build_ext):
...
@@ -636,7 +633,7 @@ class PyBuildExt(build_ext):
if
find_file
(
'readline/rlconf.h'
,
inc_dirs
,
[])
is
None
:
if
find_file
(
'readline/rlconf.h'
,
inc_dirs
,
[])
is
None
:
do_readline
=
False
do_readline
=
False
if
do_readline
:
if
do_readline
:
if
platform
==
'darwin'
and
os_release
<
9
:
if
host_
platform
==
'darwin'
and
os_release
<
9
:
# In every directory on the search path search for a dynamic
# In every directory on the search path search for a dynamic
# library and then a static library, instead of first looking
# library and then a static library, instead of first looking
# for dynamic libraries on the entire path.
# for dynamic libraries on the entire path.
...
@@ -717,7 +714,7 @@ class PyBuildExt(build_ext):
...
@@ -717,7 +714,7 @@ class PyBuildExt(build_ext):
inc_dirs
+
search_for_ssl_incs_in
)
inc_dirs
+
search_for_ssl_incs_in
)
if
opensslv_h
:
if
opensslv_h
:
name
=
os
.
path
.
join
(
opensslv_h
[
0
],
'openssl/opensslv.h'
)
name
=
os
.
path
.
join
(
opensslv_h
[
0
],
'openssl/opensslv.h'
)
if
sys
.
platform
==
'darwin'
and
is_macosx_sdk_path
(
name
):
if
host_
platform
==
'darwin'
and
is_macosx_sdk_path
(
name
):
name
=
os
.
path
.
join
(
macosx_sdk_root
(),
name
[
1
:])
name
=
os
.
path
.
join
(
macosx_sdk_root
(),
name
[
1
:])
try
:
try
:
with
open
(
name
,
'r'
)
as
incfile
:
with
open
(
name
,
'r'
)
as
incfile
:
...
@@ -853,7 +850,7 @@ class PyBuildExt(build_ext):
...
@@ -853,7 +850,7 @@ class PyBuildExt(build_ext):
db_ver_inc_map
=
{}
db_ver_inc_map
=
{}
if
sys
.
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
sysroot
=
macosx_sdk_root
()
sysroot
=
macosx_sdk_root
()
class
db_found
(
Exception
):
pass
class
db_found
(
Exception
):
pass
...
@@ -862,7 +859,7 @@ class PyBuildExt(build_ext):
...
@@ -862,7 +859,7 @@ class PyBuildExt(build_ext):
# search path.
# search path.
for
d
in
inc_dirs
+
db_inc_paths
:
for
d
in
inc_dirs
+
db_inc_paths
:
f
=
os
.
path
.
join
(
d
,
"db.h"
)
f
=
os
.
path
.
join
(
d
,
"db.h"
)
if
sys
.
platform
==
'darwin'
and
is_macosx_sdk_path
(
d
):
if
host_
platform
==
'darwin'
and
is_macosx_sdk_path
(
d
):
f
=
os
.
path
.
join
(
sysroot
,
d
[
1
:],
"db.h"
)
f
=
os
.
path
.
join
(
sysroot
,
d
[
1
:],
"db.h"
)
if
db_setup_debug
:
print
(
"db: looking for db.h in"
,
f
)
if
db_setup_debug
:
print
(
"db: looking for db.h in"
,
f
)
...
@@ -913,7 +910,7 @@ class PyBuildExt(build_ext):
...
@@ -913,7 +910,7 @@ class PyBuildExt(build_ext):
db_incdir.replace("
include
", 'lib'),
db_incdir.replace("
include
", 'lib'),
]
]
if
sys.
platform != 'darwin':
if
host_
platform != 'darwin':
db_dirs_to_check = list(filter(os.path.isdir, db_dirs_to_check))
db_dirs_to_check = list(filter(os.path.isdir, db_dirs_to_check))
else:
else:
...
@@ -977,13 +974,13 @@ class PyBuildExt(build_ext):
...
@@ -977,13 +974,13 @@ class PyBuildExt(build_ext):
# Scan the default include directories before the SQLite specific
# Scan the default include directories before the SQLite specific
# ones. This allows one to override the copy of sqlite on OSX,
# ones. This allows one to override the copy of sqlite on OSX,
# where /usr/include contains an old version of sqlite.
# where /usr/include contains an old version of sqlite.
if
sys.
platform == 'darwin':
if
host_
platform == 'darwin':
sysroot = macosx_sdk_root()
sysroot = macosx_sdk_root()
for d in inc_dirs + sqlite_inc_paths:
for d in inc_dirs + sqlite_inc_paths:
f = os.path.join(d, "
sqlite3
.
h
")
f = os.path.join(d, "
sqlite3
.
h
")
if
sys.
platform == 'darwin' and is_macosx_sdk_path(d):
if
host_
platform == 'darwin' and is_macosx_sdk_path(d):
f = os.path.join(sysroot, d[1:], "
sqlite3
.
h
")
f = os.path.join(sysroot, d[1:], "
sqlite3
.
h
")
if os.path.exists(f):
if os.path.exists(f):
...
@@ -1033,7 +1030,7 @@ class PyBuildExt(build_ext):
...
@@ -1033,7 +1030,7 @@ class PyBuildExt(build_ext):
'_sqlite/util.c', ]
'_sqlite/util.c', ]
sqlite_defines = []
sqlite_defines = []
if
sys.
platform != "
win32
":
if
host_
platform != "
win32
":
sqlite_defines.append(('MODULE_NAME', '"
sqlite3
"'))
sqlite_defines.append(('MODULE_NAME', '"
sqlite3
"'))
else:
else:
sqlite_defines.append(('MODULE_NAME', '
\
\
"
sqlite3
\\
"'))
sqlite_defines.append(('MODULE_NAME', '
\
\
"
sqlite3
\\
"'))
...
@@ -1043,7 +1040,7 @@ class PyBuildExt(build_ext):
...
@@ -1043,7 +1040,7 @@ class PyBuildExt(build_ext):
if '--enable-loadable-sqlite-extensions' not in sysconfig.get_config_var("
CONFIG_ARGS
"):
if '--enable-loadable-sqlite-extensions' not in sysconfig.get_config_var("
CONFIG_ARGS
"):
sqlite_defines.append(("
SQLITE_OMIT_LOAD_EXTENSION
", "
1
"))
sqlite_defines.append(("
SQLITE_OMIT_LOAD_EXTENSION
", "
1
"))
if
sys.
platform == 'darwin':
if
host_
platform == 'darwin':
# In every directory on the search path search for a dynamic
# In every directory on the search path search for a dynamic
# library and then a static library, instead of first looking
# library and then a static library, instead of first looking
# for dynamic libraries on the entire path.
# for dynamic libraries on the entire path.
...
@@ -1072,7 +1069,7 @@ class PyBuildExt(build_ext):
...
@@ -1072,7 +1069,7 @@ class PyBuildExt(build_ext):
dbm_setup_debug = False # verbose debug prints from this script?
dbm_setup_debug = False # verbose debug prints from this script?
dbm_order = ['gdbm']
dbm_order = ['gdbm']
# The standard Unix dbm module:
# The standard Unix dbm module:
if platform not in ['cygwin']:
if
host_
platform not in ['cygwin']:
config_args = [arg.strip("'")
config_args = [arg.strip("'")
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
dbm_args = [arg for arg in config_args
dbm_args = [arg for arg in config_args
...
@@ -1154,14 +1151,14 @@ class PyBuildExt(build_ext):
...
@@ -1154,14 +1151,14 @@ class PyBuildExt(build_ext):
missing
.
append
(
'_gdbm'
)
missing
.
append
(
'_gdbm'
)
# Unix-only modules
# Unix-only modules
if
platform
!=
'win32'
:
if
host_
platform
!=
'win32'
:
# Steen Lumholt's termios module
# Steen Lumholt's termios module
exts
.
append
(
Extension
(
'termios'
,
[
'termios.c'
])
)
exts
.
append
(
Extension
(
'termios'
,
[
'termios.c'
])
)
# Jeremy Hylton's rlimit interface
# Jeremy Hylton's rlimit interface
exts
.
append
(
Extension
(
'resource'
,
[
'resource.c'
])
)
exts
.
append
(
Extension
(
'resource'
,
[
'resource.c'
])
)
# Sun yellow pages. Some systems have the functions in libc.
# Sun yellow pages. Some systems have the functions in libc.
if
(
platform
not
in
[
'cygwin'
,
'qnx6'
]
and
if
(
host_
platform
not
in
[
'cygwin'
,
'qnx6'
]
and
find_file
(
'rpcsvc/yp_prot.h'
,
inc_dirs
,
[])
is
not
None
):
find_file
(
'rpcsvc/yp_prot.h'
,
inc_dirs
,
[])
is
not
None
):
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'nsl'
)):
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'nsl'
)):
libs
=
[
'nsl'
]
libs
=
[
'nsl'
]
...
@@ -1185,7 +1182,7 @@ class PyBuildExt(build_ext):
...
@@ -1185,7 +1182,7 @@ class PyBuildExt(build_ext):
# Bug 1464056: If _curses.so links with ncursesw,
# Bug 1464056: If _curses.so links with ncursesw,
# _curses_panel.so must link with panelw.
# _curses_panel.so must link with panelw.
panel_library
=
'panelw'
panel_library
=
'panelw'
if
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
# On OS X, there is no separate /usr/lib/libncursesw nor
# On OS X, there is no separate /usr/lib/libncursesw nor
# libpanelw. If we are here, we found a locally-supplied
# libpanelw. If we are here, we found a locally-supplied
# version of libncursesw. There should be also be a
# version of libncursesw. There should be also be a
...
@@ -1193,7 +1190,7 @@ class PyBuildExt(build_ext):
...
@@ -1193,7 +1190,7 @@ class PyBuildExt(build_ext):
# for OS X but we need _XOPEN_SOURCE_EXTENDED here for
# for OS X but we need _XOPEN_SOURCE_EXTENDED here for
# ncurses wide char support
# ncurses wide char support
curses_defines
.
append
((
'_XOPEN_SOURCE_EXTENDED'
,
'1'
))
curses_defines
.
append
((
'_XOPEN_SOURCE_EXTENDED'
,
'1'
))
elif
platform
==
'darwin'
and
curses_library
==
'ncurses'
:
elif
host_
platform
==
'darwin'
and
curses_library
==
'ncurses'
:
# Building with the system-suppied combined libncurses/libpanel
# Building with the system-suppied combined libncurses/libpanel
curses_defines
.
append
((
'HAVE_NCURSESW'
,
'1'
))
curses_defines
.
append
((
'HAVE_NCURSESW'
,
'1'
))
curses_defines
.
append
((
'_XOPEN_SOURCE_EXTENDED'
,
'1'
))
curses_defines
.
append
((
'_XOPEN_SOURCE_EXTENDED'
,
'1'
))
...
@@ -1204,7 +1201,7 @@ class PyBuildExt(build_ext):
...
@@ -1204,7 +1201,7 @@ class PyBuildExt(build_ext):
include_dirs
=
curses_includes
,
include_dirs
=
curses_includes
,
define_macros
=
curses_defines
,
define_macros
=
curses_defines
,
libraries
=
curses_libs
)
)
libraries
=
curses_libs
)
)
elif
curses_library
==
'curses'
and
platform
!=
'darwin'
:
elif
curses_library
==
'curses'
and
host_
platform
!=
'darwin'
:
# OSX has an old Berkeley curses, not good enough for
# OSX has an old Berkeley curses, not good enough for
# the _curses module.
# the _curses module.
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'terminfo'
)):
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'terminfo'
)):
...
@@ -1258,7 +1255,7 @@ class PyBuildExt(build_ext):
...
@@ -1258,7 +1255,7 @@ class PyBuildExt(build_ext):
break
break
if
version
>=
version_req
:
if
version
>=
version_req
:
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'z'
)):
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'z'
)):
if
sys
.
platform
==
"darwin"
:
if
host_
platform
==
"darwin"
:
zlib_extra_link_args
=
(
'-Wl,-search_paths_first'
,)
zlib_extra_link_args
=
(
'-Wl,-search_paths_first'
,)
else
:
else
:
zlib_extra_link_args
=
()
zlib_extra_link_args
=
()
...
@@ -1290,7 +1287,7 @@ class PyBuildExt(build_ext):
...
@@ -1290,7 +1287,7 @@ class PyBuildExt(build_ext):
# Gustavo Niemeyer's bz2 module.
# Gustavo Niemeyer's bz2 module.
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'bz2'
)):
if
(
self
.
compiler
.
find_library_file
(
lib_dirs
,
'bz2'
)):
if
sys
.
platform
==
"darwin"
:
if
host_
platform
==
"darwin"
:
bz2_extra_link_args
=
(
'-Wl,-search_paths_first'
,)
bz2_extra_link_args
=
(
'-Wl,-search_paths_first'
,)
else
:
else
:
bz2_extra_link_args
=
()
bz2_extra_link_args
=
()
...
@@ -1368,29 +1365,29 @@ class PyBuildExt(build_ext):
...
@@ -1368,29 +1365,29 @@ class PyBuildExt(build_ext):
self
.
detect_ctypes
(
inc_dirs
,
lib_dirs
)
self
.
detect_ctypes
(
inc_dirs
,
lib_dirs
)
# Richard Oudkerk's multiprocessing module
# Richard Oudkerk's multiprocessing module
if
platform
==
'win32'
:
# Windows
if
host_platform
==
'win32'
:
# Windows
macros
=
dict
()
macros
=
dict
()
libraries
=
[
'ws2_32'
]
libraries
=
[
'ws2_32'
]
elif
platform
==
'darwin'
:
# Mac OSX
elif
host_platform
==
'darwin'
:
# Mac OSX
macros
=
dict
()
macros
=
dict
()
libraries
=
[]
libraries
=
[]
elif
platform
==
'cygwin'
:
# Cygwin
elif
host_platform
==
'cygwin'
:
# Cygwin
macros
=
dict
()
macros
=
dict
()
libraries
=
[]
libraries
=
[]
elif
platform
in
(
'freebsd4'
,
'freebsd5'
,
'freebsd6'
,
'freebsd7'
,
'freebsd8'
):
elif
host_
platform
in
(
'freebsd4'
,
'freebsd5'
,
'freebsd6'
,
'freebsd7'
,
'freebsd8'
):
# FreeBSD's P1003.1b semaphore support is very experimental
# FreeBSD's P1003.1b semaphore support is very experimental
# and has many known problems. (as of June 2008)
# and has many known problems. (as of June 2008)
macros
=
dict
()
macros
=
dict
()
libraries
=
[]
libraries
=
[]
elif
platform
.
startswith
(
'openbsd'
):
elif
host_
platform
.
startswith
(
'openbsd'
):
macros
=
dict
()
macros
=
dict
()
libraries
=
[]
libraries
=
[]
elif
platform
.
startswith
(
'netbsd'
):
elif
host_
platform
.
startswith
(
'netbsd'
):
macros
=
dict
()
macros
=
dict
()
libraries
=
[]
libraries
=
[]
...
@@ -1398,7 +1395,7 @@ class PyBuildExt(build_ext):
...
@@ -1398,7 +1395,7 @@ class PyBuildExt(build_ext):
macros
=
dict
()
macros
=
dict
()
libraries
=
[
'rt'
]
libraries
=
[
'rt'
]
if
platform
==
'win32'
:
if
host_
platform
==
'win32'
:
multiprocessing_srcs
=
[
'_multiprocessing/multiprocessing.c'
,
multiprocessing_srcs
=
[
'_multiprocessing/multiprocessing.c'
,
'_multiprocessing/semaphore.c'
,
'_multiprocessing/semaphore.c'
,
]
]
...
@@ -1419,12 +1416,12 @@ class PyBuildExt(build_ext):
...
@@ -1419,12 +1416,12 @@ class PyBuildExt(build_ext):
# End multiprocessing
# End multiprocessing
# Platform-specific libraries
# Platform-specific libraries
if
platform
.
startswith
((
'linux'
,
'freebsd'
,
'gnukfreebsd'
)):
if
host_
platform
.
startswith
((
'linux'
,
'freebsd'
,
'gnukfreebsd'
)):
exts
.
append
(
Extension
(
'ossaudiodev'
,
[
'ossaudiodev.c'
])
)
exts
.
append
(
Extension
(
'ossaudiodev'
,
[
'ossaudiodev.c'
])
)
else
:
else
:
missing
.
append
(
'ossaudiodev'
)
missing
.
append
(
'ossaudiodev'
)
if
sys
.
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
exts
.
append
(
exts
.
append
(
Extension
(
'_gestalt'
,
[
'_gestalt.c'
],
Extension
(
'_gestalt'
,
[
'_gestalt.c'
],
extra_link_args
=
[
'-framework'
,
'Carbon'
])
extra_link_args
=
[
'-framework'
,
'Carbon'
])
...
@@ -1542,8 +1539,7 @@ class PyBuildExt(build_ext):
...
@@ -1542,8 +1539,7 @@ class PyBuildExt(build_ext):
# Rather than complicate the code below, detecting and building
# Rather than complicate the code below, detecting and building
# AquaTk is a separate method. Only one Tkinter will be built on
# AquaTk is a separate method. Only one Tkinter will be built on
# Darwin - either AquaTk, if it is found, or X11 based Tk.
# Darwin - either AquaTk, if it is found, or X11 based Tk.
platform
=
self
.
get_platform
()
if
(
host_platform
==
'darwin'
and
if
(
platform
==
'darwin'
and
self
.
detect_tkinter_darwin
(
inc_dirs
,
lib_dirs
)):
self
.
detect_tkinter_darwin
(
inc_dirs
,
lib_dirs
)):
return
return
...
@@ -1566,7 +1562,7 @@ class PyBuildExt(build_ext):
...
@@ -1566,7 +1562,7 @@ class PyBuildExt(build_ext):
# Check for the include files on Debian and {Free,Open}BSD, where
# Check for the include files on Debian and {Free,Open}BSD, where
# they're put in /usr/include/{tcl,tk}X.Y
# they're put in /usr/include/{tcl,tk}X.Y
dotversion
=
version
dotversion
=
version
if
'.'
not
in
dotversion
and
"bsd"
in
sys
.
platform
.
lower
():
if
'.'
not
in
dotversion
and
"bsd"
in
host_
platform
.
lower
():
# OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a,
# OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a,
# but the include subdirs are named like .../include/tcl8.3.
# but the include subdirs are named like .../include/tcl8.3.
dotversion
=
dotversion
[:
-
1
]
+
'.'
+
dotversion
[
-
1
]
dotversion
=
dotversion
[:
-
1
]
+
'.'
+
dotversion
[
-
1
]
...
@@ -1592,7 +1588,7 @@ class PyBuildExt(build_ext):
...
@@ -1592,7 +1588,7 @@ class PyBuildExt(build_ext):
include_dirs
.
append
(
dir
)
include_dirs
.
append
(
dir
)
# Check for various platform-specific directories
# Check for various platform-specific directories
if
platform
==
'sunos5'
:
if
host_
platform
==
'sunos5'
:
include_dirs
.
append
(
'/usr/openwin/include'
)
include_dirs
.
append
(
'/usr/openwin/include'
)
added_lib_dirs
.
append
(
'/usr/openwin/lib'
)
added_lib_dirs
.
append
(
'/usr/openwin/lib'
)
elif
os
.
path
.
exists
(
'/usr/X11R6/include'
):
elif
os
.
path
.
exists
(
'/usr/X11R6/include'
):
...
@@ -1608,7 +1604,7 @@ class PyBuildExt(build_ext):
...
@@ -1608,7 +1604,7 @@ class PyBuildExt(build_ext):
added_lib_dirs
.
append
(
'/usr/X11/lib'
)
added_lib_dirs
.
append
(
'/usr/X11/lib'
)
# If Cygwin, then verify that X is installed before proceeding
# If Cygwin, then verify that X is installed before proceeding
if
platform
==
'cygwin'
:
if
host_
platform
==
'cygwin'
:
x11_inc
=
find_file
(
'X11/Xlib.h'
,
[],
include_dirs
)
x11_inc
=
find_file
(
'X11/Xlib.h'
,
[],
include_dirs
)
if
x11_inc
is
None
:
if
x11_inc
is
None
:
return
return
...
@@ -1627,11 +1623,11 @@ class PyBuildExt(build_ext):
...
@@ -1627,11 +1623,11 @@ class PyBuildExt(build_ext):
libs
.
append
(
'tk'
+
version
)
libs
.
append
(
'tk'
+
version
)
libs
.
append
(
'tcl'
+
version
)
libs
.
append
(
'tcl'
+
version
)
if
platform
in
[
'aix3'
,
'aix4'
]:
if
host_
platform
in
[
'aix3'
,
'aix4'
]:
libs
.
append
(
'ld'
)
libs
.
append
(
'ld'
)
# Finally, link with the X11 libraries (not appropriate on cygwin)
# Finally, link with the X11 libraries (not appropriate on cygwin)
if
platform
!=
"cygwin"
:
if
host_
platform
!=
"cygwin"
:
libs
.
append
(
'X11'
)
libs
.
append
(
'X11'
)
ext
=
Extension
(
'_tkinter'
,
[
'_tkinter.c'
,
'tkappinit.c'
],
ext
=
Extension
(
'_tkinter'
,
[
'_tkinter.c'
,
'tkappinit.c'
],
...
@@ -1687,7 +1683,7 @@ class PyBuildExt(build_ext):
...
@@ -1687,7 +1683,7 @@ class PyBuildExt(build_ext):
def
configure_ctypes
(
self
,
ext
):
def
configure_ctypes
(
self
,
ext
):
if
not
self
.
use_system_libffi
:
if
not
self
.
use_system_libffi
:
if
sys
.
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
return
self
.
configure_ctypes_darwin
(
ext
)
return
self
.
configure_ctypes_darwin
(
ext
)
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
...
@@ -1747,7 +1743,7 @@ class PyBuildExt(build_ext):
...
@@ -1747,7 +1743,7 @@ class PyBuildExt(build_ext):
'_ctypes/cfield.c'
]
'_ctypes/cfield.c'
]
depends
=
[
'_ctypes/ctypes.h'
]
depends
=
[
'_ctypes/ctypes.h'
]
if
sys
.
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
sources
.
append
(
'_ctypes/malloc_closure.c'
)
sources
.
append
(
'_ctypes/malloc_closure.c'
)
sources
.
append
(
'_ctypes/darwin/dlfcn_simple.c'
)
sources
.
append
(
'_ctypes/darwin/dlfcn_simple.c'
)
extra_compile_args
.
append
(
'-DMACOSX'
)
extra_compile_args
.
append
(
'-DMACOSX'
)
...
@@ -1755,7 +1751,7 @@ class PyBuildExt(build_ext):
...
@@ -1755,7 +1751,7 @@ class PyBuildExt(build_ext):
# XXX Is this still needed?
# XXX Is this still needed?
## extra_link_args.extend(['-read_only_relocs', 'warning'])
## extra_link_args.extend(['-read_only_relocs', 'warning'])
elif
sys
.
platform
==
'sunos5'
:
elif
host_
platform
==
'sunos5'
:
# XXX This shouldn't be necessary; it appears that some
# XXX This shouldn't be necessary; it appears that some
# of the assembler code is non-PIC (i.e. it has relocations
# of the assembler code is non-PIC (i.e. it has relocations
# when it shouldn't. The proper fix would be to rewrite
# when it shouldn't. The proper fix would be to rewrite
...
@@ -1766,7 +1762,7 @@ class PyBuildExt(build_ext):
...
@@ -1766,7 +1762,7 @@ class PyBuildExt(build_ext):
# finding some -z option for the Sun compiler.
# finding some -z option for the Sun compiler.
extra_link_args
.
append
(
'-mimpure-text'
)
extra_link_args
.
append
(
'-mimpure-text'
)
elif
sys
.
platform
.
startswith
(
'hp-ux'
):
elif
host_
platform
.
startswith
(
'hp-ux'
):
extra_link_args
.
append
(
'-fPIC'
)
extra_link_args
.
append
(
'-fPIC'
)
ext
=
Extension
(
'_ctypes'
,
ext
=
Extension
(
'_ctypes'
,
...
@@ -1783,7 +1779,7 @@ class PyBuildExt(build_ext):
...
@@ -1783,7 +1779,7 @@ class PyBuildExt(build_ext):
if
not
'--with-system-ffi'
in
sysconfig
.
get_config_var
(
"CONFIG_ARGS"
):
if
not
'--with-system-ffi'
in
sysconfig
.
get_config_var
(
"CONFIG_ARGS"
):
return
return
if
sys
.
platform
==
'darwin'
:
if
host_
platform
==
'darwin'
:
# OS X 10.5 comes with libffi.dylib; the include files are
# OS X 10.5 comes with libffi.dylib; the include files are
# in /usr/include/ffi
# in /usr/include/ffi
inc_dirs
.
append
(
'/usr/include/ffi'
)
inc_dirs
.
append
(
'/usr/include/ffi'
)
...
@@ -1876,7 +1872,6 @@ class PyBuildExt(build_ext):
...
@@ -1876,7 +1872,6 @@ class PyBuildExt(build_ext):
'universal'
:
[(
'UNIVERSAL'
,
'1'
)]
'universal'
:
[(
'UNIVERSAL'
,
'1'
)]
}
}
platform
=
self
.
get_platform
()
cc
=
sysconfig
.
get_config_var
(
'CC'
)
cc
=
sysconfig
.
get_config_var
(
'CC'
)
sizeof_size_t
=
sysconfig
.
get_config_var
(
'SIZEOF_SIZE_T'
)
sizeof_size_t
=
sysconfig
.
get_config_var
(
'SIZEOF_SIZE_T'
)
machine
=
os
.
environ
.
get
(
'PYTHON_DECIMAL_WITH_MACHINE'
)
machine
=
os
.
environ
.
get
(
'PYTHON_DECIMAL_WITH_MACHINE'
)
...
@@ -1884,7 +1879,7 @@ class PyBuildExt(build_ext):
...
@@ -1884,7 +1879,7 @@ class PyBuildExt(build_ext):
if
machine
:
if
machine
:
# Override automatic configuration to facilitate testing.
# Override automatic configuration to facilitate testing.
define_macros
=
config
[
machine
]
define_macros
=
config
[
machine
]
elif
platform
==
'darwin'
:
elif
host_
platform
==
'darwin'
:
# Universal here means: build with the same options Python
# Universal here means: build with the same options Python
# was built with.
# was built with.
define_macros
=
config
[
'universal'
]
define_macros
=
config
[
'universal'
]
...
@@ -1898,7 +1893,7 @@ class PyBuildExt(build_ext):
...
@@ -1898,7 +1893,7 @@ class PyBuildExt(build_ext):
elif
sizeof_size_t
==
4
:
elif
sizeof_size_t
==
4
:
ppro
=
sysconfig
.
get_config_var
(
'HAVE_GCC_ASM_FOR_X87'
)
ppro
=
sysconfig
.
get_config_var
(
'HAVE_GCC_ASM_FOR_X87'
)
if
ppro
and
(
'gcc'
in
cc
or
'clang'
in
cc
)
and
\
if
ppro
and
(
'gcc'
in
cc
or
'clang'
in
cc
)
and
\
not
'sunos'
in
platform
:
not
'sunos'
in
host_
platform
:
# solaris: problems with register allocation.
# solaris: problems with register allocation.
# icc >= 11.0 works as well.
# icc >= 11.0 works as well.
define_macros
=
config
[
'ppro'
]
define_macros
=
config
[
'ppro'
]
...
...
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