mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Modified version of part of patch #102409 for Cygwin:
Get platform-specific modules right on Cygwin Getting a string value for the platform has been factored out into get_platform()
This commit is contained in:
parent
1ae43c4341
commit
34febf5e92
1 changed files with 27 additions and 15 deletions
42
setup.py
42
setup.py
|
@ -99,6 +99,14 @@ class PyBuildExt(build_ext):
|
||||||
|
|
||||||
build_ext.build_extensions(self)
|
build_ext.build_extensions(self)
|
||||||
|
|
||||||
|
def get_platform (self):
|
||||||
|
# Get value of sys.platform
|
||||||
|
platform = sys.platform
|
||||||
|
if platform[:6] =='cygwin':
|
||||||
|
platform = 'cygwin'
|
||||||
|
|
||||||
|
return platform
|
||||||
|
|
||||||
def detect_modules(self):
|
def detect_modules(self):
|
||||||
# Ensure that /usr/local is always used
|
# Ensure that /usr/local is always used
|
||||||
if '/usr/local/lib' not in self.compiler.library_dirs:
|
if '/usr/local/lib' not in self.compiler.library_dirs:
|
||||||
|
@ -113,9 +121,11 @@ class PyBuildExt(build_ext):
|
||||||
inc_dirs = ['/usr/include'] + self.compiler.include_dirs
|
inc_dirs = ['/usr/include'] + self.compiler.include_dirs
|
||||||
exts = []
|
exts = []
|
||||||
|
|
||||||
|
platform = self.get_platform()
|
||||||
|
|
||||||
# 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 sys.platform == 'Darwin1.2':
|
if platform == 'Darwin1.2':
|
||||||
math_libs = []
|
math_libs = []
|
||||||
|
|
||||||
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
|
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
|
||||||
|
@ -268,11 +278,12 @@ class PyBuildExt(build_ext):
|
||||||
# similar functionality (but slower of course) implemented in Python.
|
# similar functionality (but slower of course) implemented in Python.
|
||||||
|
|
||||||
# The standard Unix dbm module:
|
# The standard Unix dbm module:
|
||||||
if (self.compiler.find_library_file(lib_dirs, 'ndbm')):
|
if platform not in ['cygwin']:
|
||||||
exts.append( Extension('dbm', ['dbmmodule.c'],
|
if (self.compiler.find_library_file(lib_dirs, 'ndbm')):
|
||||||
libraries = ['ndbm'] ) )
|
exts.append( Extension('dbm', ['dbmmodule.c'],
|
||||||
else:
|
libraries = ['ndbm'] ) )
|
||||||
exts.append( Extension('dbm', ['dbmmodule.c']) )
|
else:
|
||||||
|
exts.append( Extension('dbm', ['dbmmodule.c']) )
|
||||||
|
|
||||||
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
|
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
|
||||||
if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
|
if (self.compiler.find_library_file(lib_dirs, 'gdbm')):
|
||||||
|
@ -321,11 +332,12 @@ class PyBuildExt(build_ext):
|
||||||
|
|
||||||
|
|
||||||
# Unix-only modules
|
# Unix-only modules
|
||||||
if sys.platform not in ['mac', 'win32']:
|
if platform not in ['mac', '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']) )
|
if platform not in ['cygwin']:
|
||||||
|
exts.append( Extension('resource', ['resource.c']) )
|
||||||
|
|
||||||
if (self.compiler.find_library_file(lib_dirs, 'nsl')):
|
if (self.compiler.find_library_file(lib_dirs, 'nsl')):
|
||||||
exts.append( Extension('nis', ['nismodule.c'],
|
exts.append( Extension('nis', ['nismodule.c'],
|
||||||
|
@ -333,7 +345,7 @@ class PyBuildExt(build_ext):
|
||||||
|
|
||||||
# Curses support, requring the System V version of curses, often
|
# Curses support, requring the System V version of curses, often
|
||||||
# provided by the ncurses library.
|
# provided by the ncurses library.
|
||||||
if sys.platform == 'sunos4':
|
if platform == 'sunos4':
|
||||||
include_dirs += ['/usr/5include']
|
include_dirs += ['/usr/5include']
|
||||||
lib_dirs += ['/usr/5lib']
|
lib_dirs += ['/usr/5lib']
|
||||||
|
|
||||||
|
@ -363,7 +375,7 @@ class PyBuildExt(build_ext):
|
||||||
# The library to link fpectl with is platform specific.
|
# The library to link fpectl with is platform specific.
|
||||||
# Choose *one* of the options below for fpectl:
|
# Choose *one* of the options below for fpectl:
|
||||||
|
|
||||||
if sys.platform == 'irix5':
|
if platform == 'irix5':
|
||||||
# For SGI IRIX (tested on 5.3):
|
# For SGI IRIX (tested on 5.3):
|
||||||
exts.append( Extension('fpectl', ['fpectlmodule.c'],
|
exts.append( Extension('fpectl', ['fpectlmodule.c'],
|
||||||
libraries=['fpe']) )
|
libraries=['fpe']) )
|
||||||
|
@ -420,12 +432,11 @@ class PyBuildExt(build_ext):
|
||||||
libraries = ['expat']) )
|
libraries = ['expat']) )
|
||||||
|
|
||||||
# Platform-specific libraries
|
# Platform-specific libraries
|
||||||
plat = sys.platform
|
if platform == 'linux2':
|
||||||
if plat == 'linux2':
|
|
||||||
# Linux-specific modules
|
# Linux-specific modules
|
||||||
exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )
|
exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )
|
||||||
|
|
||||||
if plat == 'sunos5':
|
if platform == 'sunos5':
|
||||||
# SunOS specific modules
|
# SunOS specific modules
|
||||||
exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )
|
exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )
|
||||||
|
|
||||||
|
@ -484,7 +495,8 @@ 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 sys.platform == 'sunos5':
|
platform = self.get_platform()
|
||||||
|
if 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'):
|
||||||
|
@ -512,7 +524,7 @@ class PyBuildExt(build_ext):
|
||||||
libs.append('tk'+version)
|
libs.append('tk'+version)
|
||||||
libs.append('tcl'+version)
|
libs.append('tcl'+version)
|
||||||
|
|
||||||
if sys.platform in ['aix3', 'aix4']:
|
if platform in ['aix3', 'aix4']:
|
||||||
libs.append('ld')
|
libs.append('ld')
|
||||||
|
|
||||||
# Finally, link with the X11 libraries
|
# Finally, link with the X11 libraries
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue