ALT Linux repos
Group :: Development/Python
RPM: python
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: python-2.4.4-svn-linkage.patch
Download
Download
Author: martin.v.loewis <martin.v.loewis>
Date: Mon Apr 10 12:39:36 2006 +0000
r45232: Patch #1429775: Link Python modules to libpython on linux if
--enable-shared. Fixes #832799.
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -185,7 +185,9 @@ class build_ext (Command):
# for extensions under Cygwin and AtheOS Python's library directory must be
# appended to library_dirs
- if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
+ if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos' or \
+ (sys.platform.startswith('linux') and
+ sysconfig.get_config_var('Py_ENABLE_SHARED')):
if string.find(sys.executable, sys.exec_prefix) != -1:
# building third party extensions
self.library_dirs.append(os.path.join(sys.prefix, "lib",
@@ -688,6 +690,13 @@ class build_ext (Command):
# extensions, it is a reference to the original list
return ext.libraries + [pythonlib, "m"] + extra
else:
- return ext.libraries
+ from distutils import sysconfig
+ if sysconfig.get_config_var('Py_ENABLE_SHARED'):
+ template = "python%d.%d"
+ pythonlib = (template %
+ (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
+ return ext.libraries + [pythonlib]
+ else:
+ return ext.libraries
# class build_ext
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -213,8 +213,8 @@ def parse_config_h(fp, g=None):
"""
if g is None:
g = {}
- define_rx = re.compile("#define ([A-Z][A-Z0-9_]+) (.*)\n")
- undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n")
+ define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
+ undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
#
while 1:
line = fp.readline()
@@ -351,6 +351,17 @@ def _init_posix():
raise DistutilsPlatformError(my_msg)
+ # load the installed pyconfig.h:
+ try:
+ filename = get_config_h_filename()
+ parse_config_h(file(filename), g)
+ except IOError, msg:
+ my_msg = "invalid Python installation: unable to open %s" % filename
+ if hasattr(msg, "strerror"):
+ my_msg = my_msg + " (%s)" % msg.strerror
+
+ 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.
Author: matthias.klose <matthias.klose>
Date: Sun Dec 3 17:13:54 2006 +0000
r52909: - Fix build failure on kfreebsd and on the hurd.
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -186,7 +186,7 @@ class build_ext (Command):
# for extensions under Cygwin and AtheOS Python's library directory must be
# appended to library_dirs
if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos' or \
- (sys.platform.startswith('linux') and
+ ((sys.platform.startswith('linux') or sys.platform.startswith('gnu')) and
sysconfig.get_config_var('Py_ENABLE_SHARED')):
if string.find(sys.executable, sys.exec_prefix) != -1:
# building third party extensions
Author: martin.v.loewis <martin.v.loewis>
Date: Fri Feb 9 12:37:12 2007 +0000
r53692: Bug #1600860: Search for shared python library in LIBDIR, not
lib/python/config, on "linux" and "gnu" systems.
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -185,9 +185,7 @@ class build_ext (Command):
# for extensions under Cygwin and AtheOS Python's library directory must be
# appended to library_dirs
- if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos' or \
- ((sys.platform.startswith('linux') or sys.platform.startswith('gnu')) and
- sysconfig.get_config_var('Py_ENABLE_SHARED')):
+ if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
if string.find(sys.executable, sys.exec_prefix) != -1:
# building third party extensions
self.library_dirs.append(os.path.join(sys.prefix, "lib",
@@ -197,6 +195,17 @@ class build_ext (Command):
# building python standard extensions
self.library_dirs.append('.')
+ # for extensions under Linux with a shared Python library,
+ # Python's library directory must be appended to library_dirs
+ if (sys.platform.startswith('linux') or sys.platform.startswith('gnu')) \
+ and sysconfig.get_config_var('Py_ENABLE_SHARED'):
+ if string.find(sys.executable, sys.exec_prefix) != -1:
+ # building third party extensions
+ self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
+ else:
+ # building python standard extensions
+ self.library_dirs.append('.')
+
# The argument parsing will result in self.define being a string, but
# it has to be a list of 2-tuples. All the preprocessor symbols
# specified by the 'define' option will be set to '1'. Multiple