patch-setup_py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. diff -Nur Python-2.7.orig/setup.py Python-2.7/setup.py
  2. --- Python-2.7.1.orig/setup.py 2010-10-31 17:40:21.000000000 +0100
  3. +++ Python-2.7.1/setup.py 2011-10-06 20:34:53.328787057 +0200
  4. @@ -21,7 +21,7 @@ from distutils.spawn import find_executa
  5. COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
  6. # This global variable is used to hold the list of modules to be disabled.
  7. -disabled_module_list = []
  8. +disabled_module_list = ['nis']
  9. def add_dir_to_list(dirlist, dir):
  10. """Add the directory 'dir' to the list 'dirlist' (at the front) if
  11. @@ -307,48 +307,14 @@ class PyBuildExt(build_ext):
  12. ext_filename = os.path.join(
  13. self.build_lib,
  14. self.get_ext_filename(self.get_ext_fullname(ext.name)))
  15. - try:
  16. - imp.load_dynamic(ext.name, ext_filename)
  17. - except ImportError, why:
  18. - self.failed.append(ext.name)
  19. - self.announce('*** WARNING: renaming "%s" since importing it'
  20. - ' failed: %s' % (ext.name, why), level=3)
  21. - assert not self.inplace
  22. - basename, tail = os.path.splitext(ext_filename)
  23. - newname = basename + "_failed" + tail
  24. - if os.path.exists(newname):
  25. - os.remove(newname)
  26. - os.rename(ext_filename, newname)
  27. -
  28. - # XXX -- This relies on a Vile HACK in
  29. - # distutils.command.build_ext.build_extension(). The
  30. - # _built_objects attribute is stored there strictly for
  31. - # use here.
  32. - # If there is a failure, _built_objects may not be there,
  33. - # so catch the AttributeError and move on.
  34. - try:
  35. - for filename in self._built_objects:
  36. - os.remove(filename)
  37. - except AttributeError:
  38. - self.announce('unable to remove files (ignored)')
  39. - except:
  40. - exc_type, why, tb = sys.exc_info()
  41. - self.announce('*** WARNING: importing extension "%s" '
  42. - 'failed with %s: %s' % (ext.name, exc_type, why),
  43. - level=3)
  44. - self.failed.append(ext.name)
  45. def get_platform(self):
  46. - # Get value of sys.platform
  47. - for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
  48. - if sys.platform.startswith(platform):
  49. - return platform
  50. - return sys.platform
  51. + return 'linux'
  52. def detect_modules(self):
  53. # Ensure that /usr/local is always used
  54. - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
  55. - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
  56. + #add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
  57. + #add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
  58. # Add paths specified in the environment variables LDFLAGS and
  59. # CPPFLAGS for header and library files.
  60. @@ -384,17 +350,6 @@ class PyBuildExt(build_ext):
  61. for directory in reversed(options.dirs):
  62. add_dir_to_list(dir_list, directory)
  63. - if os.path.normpath(sys.prefix) != '/usr' \
  64. - and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
  65. - # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
  66. - # (PYTHONFRAMEWORK is set) to avoid # linking problems when
  67. - # building a framework with different architectures than
  68. - # the one that is currently installed (issue #7473)
  69. - add_dir_to_list(self.compiler.library_dirs,
  70. - sysconfig.get_config_var("LIBDIR"))
  71. - add_dir_to_list(self.compiler.include_dirs,
  72. - sysconfig.get_config_var("INCLUDEDIR"))
  73. -
  74. try:
  75. have_unicode = unicode
  76. except NameError:
  77. @@ -403,11 +358,8 @@ class PyBuildExt(build_ext):
  78. # lib_dirs and inc_dirs are used to search for files;
  79. # if a file is found in one of those directories, it can
  80. # be assumed that no additional -I,-L directives are needed.
  81. - lib_dirs = self.compiler.library_dirs + [
  82. - '/lib64', '/usr/lib64',
  83. - '/lib', '/usr/lib',
  84. - ]
  85. - inc_dirs = self.compiler.include_dirs + ['/usr/include']
  86. + lib_dirs = self.compiler.library_dirs + ['@@STAGING_DIR@@/usr/lib']
  87. + inc_dirs = self.compiler.include_dirs + ['@@STAGING_DIR@@/usr/include']
  88. exts = []
  89. missing = []