components/python/python34/patches/03-setup.patch
author John Beck <John.Beck@Oracle.COM>
Tue, 10 Feb 2015 09:31:36 -0800
changeset 3759 6f5b34e14c5c
parent 2183 5d00686e81da
child 4964 30f7741bb742
permissions -rw-r--r--
20367692 python /usr/gnu/lib runpath considered unnecessary
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1907
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     1
This patch modifies the setup script to support Solaris.
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     2
As it is Solaris-specific, it is not suitable for upstream.
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     3
3759
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
     4
--- Python-3.4.2/setup.py.~2~	2015-02-09 18:43:32.656965175 -0800
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
     5
+++ Python-3.4.2/setup.py	2015-02-09 19:28:55.015474602 -0800
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
     6
@@ -447,12 +447,15 @@
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
     7
             os.unlink(tmpfile)
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
     8
 
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
     9
     def detect_modules(self):
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    10
-        # Ensure that /usr/local is always used, but the local build
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    11
-        # directories (i.e. '.' and 'Include') must be first.  See issue
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    12
-        # 10520.
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    13
         if not cross_compiling:
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    14
-            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    15
-            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    16
+            if host_platform != 'sunos5':
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    17
+                # Upstream notes the following for source builds:
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    18
+                #    Ensure that /usr/local is always used, but the local build
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    19
+                #    directories (i.e. '.' and 'Include') must be first.  See
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    20
+                #    issue 10520.
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    21
+                # But we skip that for Solaris system builds.
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    22
+                add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    23
+                add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    24
         # only change this for cross builds for 3.3, issues on Mageia
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    25
         if cross_compiling:
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    26
             self.add_gcc_paths()
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    27
@@ -736,6 +739,13 @@
1907
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    28
                                                      ['/usr/lib/termcap'],
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    29
                                                      'termcap'):
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    30
                 readline_libs.append('termcap')
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    31
+
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    32
+            if host_platform == 'sunos5':
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    33
+                # insert '-zrecord' before the readline libraries that we
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    34
+                # want to link with to avoid rl_insert() elimination
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    35
+                readline_extra_link_args = ('-Wl,-zrecord','-lreadline','-lncurses')
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    36
+                readline_libs = ()
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    37
+
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    38
             exts.append( Extension('readline', ['readline.c'],
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    39
                                    library_dirs=['/usr/lib/termcap'],
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    40
                                    extra_link_args=readline_extra_link_args,
3759
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    41
@@ -1295,6 +1305,8 @@
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    42
             curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1'))
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    43
 
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    44
         if curses_library.startswith('ncurses'):
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    45
+            if host_platform == 'sunos5':
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    46
+                curses_includes.append('/usr/include/ncurses')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    47
             curses_libs = [curses_library]
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    48
             exts.append( Extension('_curses', ['_cursesmodule.c'],
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    49
                                    include_dirs=curses_includes,
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    50
@@ -1319,10 +1331,32 @@
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    51
         # If the curses module is enabled, check for the panel module
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    52
         if (module_enabled(exts, '_curses') and
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    53
             self.compiler.find_library_file(lib_dirs, panel_library)):
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    54
+            panel_lib_dirs = []
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    55
+            if host_platform == 'sunos5':
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    56
+                # Look for libpanel under /usr/gnu/lib on Solaris.
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    57
+                # os.uname() does not include the processor. platform.uname()
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    58
+                # does, but the platform module is not available in setup.
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    59
+                # Work around this by parsing os.system('uname -p') output.
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    60
+                tmpfile = os.path.join(self.build_temp, 'processor')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    61
+                if not os.path.exists(self.build_temp):
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    62
+                    os.makedirs(self.build_temp)
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    63
+                os.system('/usr/bin/uname -p > %s 2> /dev/null' %tmpfile)
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    64
+                processor = ''
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    65
+                try:
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    66
+                    with open(tmpfile) as fp:
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    67
+                        processor = fp.readline().strip()
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    68
+                finally:
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    69
+                    os.unlink(tmpfile)
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    70
+                if processor == 'sparc':
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    71
+                    panel_lib_dirs.append('/usr/gnu/lib/sparcv9')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    72
+                else:
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    73
+                    panel_lib_dirs.append('/usr/gnu/lib/amd64')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    74
             exts.append( Extension('_curses_panel', ['_curses_panel.c'],
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    75
                                    include_dirs=curses_includes,
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    76
                                    define_macros=curses_defines,
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    77
-                                   libraries = [panel_library] + curses_libs) )
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    78
+                                   libraries = [panel_library] + curses_libs,
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    79
+                                   library_dirs = panel_lib_dirs,
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    80
+                                   runtime_library_dirs = panel_lib_dirs) )
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    81
         else:
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    82
             missing.append('_curses_panel')
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    83
 
6f5b34e14c5c 20367692 python /usr/gnu/lib runpath considered unnecessary
John Beck <John.Beck@Oracle.COM>
parents: 2183
diff changeset
    84
@@ -1918,7 +1952,7 @@
1907
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    85
             # this option. If you want to compile ctypes with the Sun
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    86
             # compiler, please research a proper solution, instead of
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    87
             # finding some -z option for the Sun compiler.
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    88
-            extra_link_args.append('-mimpure-text')
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    89
+            pass
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    90
 
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    91
         elif host_platform.startswith('hp-ux'):
446472de62e9 PSARC 2014/151 Python 3.4
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    92
             extra_link_args.append('-fPIC')