python2: update to 2.7.13, simplify patches
[openadk.git] / package / python2 / patches / patch-setup_py
blobbf8e90c9d338f3e01f780e2d2c0606ecf1c3a294
1 --- Python-2.7.13.orig/setup.py 2016-12-17 21:05:07.000000000 +0100
2 +++ Python-2.7.13/setup.py      2017-03-16 19:45:12.000000000 +0100
3 @@ -74,7 +74,7 @@ def find_file(filename, std_dirs, paths)
4      'paths' is a list of additional locations to check; if the file is
5          found in one of them, the resulting list will contain the directory.
6      """
7 -    if host_platform == 'darwin':
8 +    if host_platform == 'darwin' and not cross_compiling:
9          # Honor the MacOSX SDK setting when one was specified.
10          # An SDK is a directory with the same structure as a real
11          # system, but with only header files and libraries.
12 @@ -84,7 +84,7 @@ def find_file(filename, std_dirs, paths)
13      for dir in std_dirs:
14          f = os.path.join(dir, filename)
16 -        if host_platform == 'darwin' and is_macosx_sdk_path(dir):
17 +        if host_platform == 'darwin' and is_macosx_sdk_path(dir) and not cross_compiling:
18              f = os.path.join(sysroot, dir[1:], filename)
20          if os.path.exists(f): return []
21 @@ -93,7 +93,7 @@ def find_file(filename, std_dirs, paths)
22      for dir in paths:
23          f = os.path.join(dir, filename)
25 -        if host_platform == 'darwin' and is_macosx_sdk_path(dir):
26 +        if host_platform == 'darwin' and is_macosx_sdk_path(dir) and not cross_compiling:
27              f = os.path.join(sysroot, dir[1:], filename)
29          if os.path.exists(f):
30 @@ -107,7 +107,7 @@ def find_library_file(compiler, libname,
31      if result is None:
32          return None
34 -    if host_platform == 'darwin':
35 +    if host_platform == 'darwin' and not cross_compiling:
36          sysroot = macosx_sdk_root()
38      # Check whether the found file is in one of the standard directories
39 @@ -116,7 +116,7 @@ def find_library_file(compiler, libname,
40          # Ensure path doesn't end with path separator
41          p = p.rstrip(os.sep)
43 -        if host_platform == 'darwin' and is_macosx_sdk_path(p):
44 +        if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
45              # Note that, as of Xcode 7, Apple SDKs may contain textual stub
46              # libraries with .tbd extensions rather than the normal .dylib
47              # shared libraries installed in /.  The Apple compiler tool
48 @@ -145,7 +145,7 @@ def find_library_file(compiler, libname,
49          # Ensure path doesn't end with path separator
50          p = p.rstrip(os.sep)
52 -        if host_platform == 'darwin' and is_macosx_sdk_path(p):
53 +        if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
54              if os.path.join(sysroot, p[1:]) == dirname:
55                  return [ p ]
57 @@ -178,6 +178,7 @@ class PyBuildExt(build_ext):
59      def build_extensions(self):
61 +        self.compiler.library_dirs = []
62          # Detect which modules should be compiled
63          missing = self.detect_modules()
65 @@ -299,6 +300,7 @@ class PyBuildExt(build_ext):
67      def build_extension(self, ext):
70          if ext.name == '_ctypes':
71              if not self.configure_ctypes(ext):
72                  return
73 @@ -460,7 +462,8 @@ class PyBuildExt(build_ext):
74              add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
75          if cross_compiling:
76              self.add_gcc_paths()
77 -        self.add_multiarch_paths()
78 +        if not cross_compiling:
79 +            self.add_multiarch_paths()
81          # Add paths specified in the environment variables LDFLAGS and
82          # CPPFLAGS for header and library files.
83 @@ -497,7 +500,8 @@ class PyBuildExt(build_ext):
84                          add_dir_to_list(dir_list, directory)
86          if os.path.normpath(sys.prefix) != '/usr' \
87 -                and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
88 +                and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
89 +                and not cross_compiling:
90              # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
91              # (PYTHONFRAMEWORK is set) to avoid # linking problems when
92              # building a framework with different architectures than
93 @@ -515,8 +519,13 @@ class PyBuildExt(build_ext):
94          # lib_dirs and inc_dirs are used to search for files;
95          # if a file is found in one of those directories, it can
96          # be assumed that no additional -I,-L directives are needed.
97 +        if cross_compiling:
98 +            add_dir_to_list(self.compiler.library_dirs,
99 +                            sysconfig.get_config_var('srcdir'))
101          inc_dirs = self.compiler.include_dirs[:]
102          lib_dirs = self.compiler.library_dirs[:]
104          if not cross_compiling:
105              for d in (
106                  '/usr/include',
107 @@ -550,7 +559,7 @@ class PyBuildExt(build_ext):
108          if host_platform == 'hp-ux11':
109              lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
111 -        if host_platform == 'darwin':
112 +        if host_platform == 'darwin' and not cross_compiling:
113              # This should work on any unixy platform ;-)
114              # If the user has bothered specifying additional -I and -L flags
115              # in OPT and LDFLAGS we might as well use them here.