19339814 Python 3.4 needs tweak to find shared objects under vendor-packages s11-update
authorJohn Beck <John.Beck@Oracle.COM>
Wed, 06 Aug 2014 10:14:32 -0700
branchs11-update
changeset 3782 689605272627
parent 3781 399830c4eaf1
child 3783 9edbfb2ff34a
19339814 Python 3.4 needs tweak to find shared objects under vendor-packages
components/pylint/pylint-GENFRAG.p5m
components/pylint/pylint-PYVER.p5m
components/python/python34/patches/06-solaris-64-bit.patch
components/python/python34/patches/17-frozen-path.patch
--- a/components/python/python34/patches/06-solaris-64-bit.patch	Mon Feb 02 18:57:35 2015 -0800
+++ b/components/python/python34/patches/06-solaris-64-bit.patch	Wed Aug 06 10:14:32 2014 -0700
@@ -1,44 +1,147 @@
-This patch ensures that 64-bit shared objects are in a subdirectory named
-"64".  Note that changes to the Lib/distutils/tests/test_build.py and
-Lib/distutils/tests/test_install.py avoid running tests that fail due to
-this patch.  As this is Solaris-specific, it is not suitable for upstream.
+This patch ensures that 64-bit shared objects are put in and found in a
+subdirectory named "64".  Note that the changes to the
+Lib/distutils/tests/test_build_ext.py and .../test_sysconfig.py avoid running
+tests that fail due to this patch.  As the patch is Solaris-specific, it is
+not suitable for upstream.
 
---- Python-3.4.0/Lib/distutils/command/build_ext.py.~1~	2014-03-16 19:31:29.000000000 -0700
-+++ Python-3.4.0/Lib/distutils/command/build_ext.py	2014-03-17 13:18:10.057787061 -0700
-@@ -668,7 +668,12 @@
+--- Python-3.4.1/Lib/distutils/command/build_ext.py.~1~	2014-05-18 22:19:37.000000000 -0700
++++ Python-3.4.1/Lib/distutils/command/build_ext.py	2014-08-05 16:07:07.494400637 -0700
+@@ -668,6 +668,9 @@
          ext_suffix = get_config_var('EXT_SUFFIX')
          if os.name == 'nt' and self.debug:
              return os.path.join(*ext_path) + '_d' + ext_suffix
--        return os.path.join(*ext_path) + ext_suffix
-+        #return os.path.join(*ext_path) + ext_suffix
-+        path = os.path.join (ext_path)
-+        if sys.maxsize == 2147483647:
++        if sys.maxsize == 2 ** 31 - 1:
 +            return os.path.join(*ext_path) + ext_suffix
-+        (dirname, basename) = os.path.split(os.path.join(*ext_path));
-+        return os.path.join(dirname, "64", basename + ext_suffix)
++        ext_path[-1:-1] = ["64"]
+         return os.path.join(*ext_path) + ext_suffix
  
      def get_export_symbols(self, ext):
-         """Return the list of symbols that a shared extension has to
---- Python-3.4.0/Lib/distutils/tests/test_build_ext.py.~1~	2014-03-16 19:31:29.000000000 -0700
-+++ Python-3.4.0/Lib/distutils/tests/test_build_ext.py	2014-03-17 13:18:10.098081226 -0700
-@@ -317,7 +317,7 @@
+--- Python-3.4.1/Lib/distutils/tests/test_build_ext.py.~1~	2014-05-18 22:19:38.000000000 -0700
++++ Python-3.4.1/Lib/distutils/tests/test_build_ext.py	2014-08-05 15:28:29.067709834 -0700
+@@ -317,7 +317,8 @@
          ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
          self.assertTrue(so_file.endswith(ext_suffix))
          so_dir = os.path.dirname(so_file)
 -        self.assertEqual(so_dir, other_tmp_dir)
-+        #self.assertEqual(so_dir, other_tmp_dir)
++        if sys.platform != 'sunos5':
++            self.assertEqual(so_dir, other_tmp_dir)
  
          cmd.inplace = 0
          cmd.compiler = None
-@@ -364,7 +364,7 @@
+@@ -326,7 +327,8 @@
+         self.assertTrue(os.path.exists(so_file))
+         self.assertTrue(so_file.endswith(ext_suffix))
+         so_dir = os.path.dirname(so_file)
+-        self.assertEqual(so_dir, cmd.build_lib)
++        if sys.platform != 'sunos5':
++            self.assertEqual(so_dir, cmd.build_lib)
+ 
+         # inplace = 0, cmd.package = 'bar'
+         build_py = cmd.get_finalized_command('build_py')
+@@ -334,7 +336,8 @@
+         path = cmd.get_ext_fullpath('foo')
+         # checking that the last directory is the build_dir
+         path = os.path.split(path)[0]
+-        self.assertEqual(path, cmd.build_lib)
++        if sys.platform != 'sunos5':
++            self.assertEqual(path, cmd.build_lib)
+ 
+         # inplace = 1, cmd.package = 'bar'
+         cmd.inplace = 1
+@@ -348,7 +351,8 @@
+         # checking that the last directory is bar
+         path = os.path.split(path)[0]
+         lastdir = os.path.split(path)[-1]
+-        self.assertEqual(lastdir, 'bar')
++        if sys.platform != 'sunos5':
++            self.assertEqual(lastdir, 'bar')
+ 
+     def test_ext_fullpath(self):
+         ext = sysconfig.get_config_var('EXT_SUFFIX')
+@@ -364,14 +368,16 @@
          curdir = os.getcwd()
          wanted = os.path.join(curdir, 'src', 'lxml', 'etree' + ext)
          path = cmd.get_ext_fullpath('lxml.etree')
 -        self.assertEqual(wanted, path)
-+        #self.assertEqual(wanted, path)
++        if sys.platform != 'sunos5':
++            self.assertEqual(wanted, path)
  
          # building lxml.etree not inplace
          cmd.inplace = 0
+         cmd.build_lib = os.path.join(curdir, 'tmpdir')
+         wanted = os.path.join(curdir, 'tmpdir', 'lxml', 'etree' + ext)
+         path = cmd.get_ext_fullpath('lxml.etree')
+-        self.assertEqual(wanted, path)
++        if sys.platform != 'sunos5':
++            self.assertEqual(wanted, path)
+ 
+         # building twisted.runner.portmap not inplace
+         build_py = cmd.get_finalized_command('build_py')
+@@ -380,13 +386,15 @@
+         path = cmd.get_ext_fullpath('twisted.runner.portmap')
+         wanted = os.path.join(curdir, 'tmpdir', 'twisted', 'runner',
+                               'portmap' + ext)
+-        self.assertEqual(wanted, path)
++        if sys.platform != 'sunos5':
++            self.assertEqual(wanted, path)
+ 
+         # building twisted.runner.portmap inplace
+         cmd.inplace = 1
+         path = cmd.get_ext_fullpath('twisted.runner.portmap')
+         wanted = os.path.join(curdir, 'twisted', 'runner', 'portmap' + ext)
+-        self.assertEqual(wanted, path)
++        if sys.platform != 'sunos5':
++            self.assertEqual(wanted, path)
+ 
+ 
+     @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for MacOSX')
+--- Python-3.4.1/Lib/distutils/tests/test_sysconfig.py.~1~	2014-05-18 22:19:38.000000000 -0700
++++ Python-3.4.1/Lib/distutils/tests/test_sysconfig.py	2014-08-05 13:11:56.906745265 -0700
+@@ -1,4 +1,5 @@
+ """Tests for distutils.sysconfig."""
++import sys
+ import os
+ import shutil
+ import unittest
+@@ -124,6 +125,8 @@
+ 
+     def test_sysconfig_module(self):
+         import sysconfig as global_sysconfig
++        if sys.platform == 'sunos5':
++            return
+         self.assertEqual(global_sysconfig.get_config_var('CFLAGS'),
+                          sysconfig.get_config_var('CFLAGS'))
+         self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'),
+@@ -149,8 +152,9 @@
+         import sysconfig as global_sysconfig
+         if sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'):
+             self.skipTest('compiler flags customized')
+-        self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),
+-                         sysconfig.get_config_var('LDSHARED'))
++        if sys.platform != 'sunos5':
++            self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),
++                             sysconfig.get_config_var('LDSHARED'))
+         self.assertEqual(global_sysconfig.get_config_var('CC'),
+                          sysconfig.get_config_var('CC'))
+ 
+--- Python-3.4.1/Lib/importlib/_bootstrap.py.~1~	2014-05-18 22:19:38.000000000 -0700
++++ Python-3.4.1/Lib/importlib/_bootstrap.py	2014-08-06 08:37:18.145242823 -0700
+@@ -2046,6 +2046,15 @@
+                 is_namespace = _path_isdir(base_path)
+         # Check for a file w/ a proper suffix exists.
+         for suffix, loader_class in self._loaders:
++            message = 'checking {!r}: {!r}'.format(self.path, suffix)
++            _verbose_message(message, verbosity=2)
++            # If in 64-bit mode, append /64 to the path.
++            if suffix == '.so' and sys.maxsize != 2 ** 31 - 1:
++                full_path = _path_join(self.path, '64', tail_module + suffix)
++                _verbose_message('trying {}'.format(full_path), verbosity=2)
++                if _path_isfile(full_path):
++                    self.path += '/64'
++                    return self._get_spec(loader_class, fullname, full_path, None, target)
+             full_path = _path_join(self.path, tail_module + suffix)
+             _verbose_message('trying {}'.format(full_path), verbosity=2)
+             if cache_module + suffix in cache:
 --- Python-3.4.0/Lib/sysconfig.py.~1~	2014-03-16 19:31:30.000000000 -0700
 +++ Python-3.4.0/Lib/sysconfig.py	2014-03-17 13:18:10.099539252 -0700
 @@ -392,7 +392,11 @@
@@ -54,8 +157,8 @@
  
      with open(destfile, 'w', encoding='utf8') as f:
          f.write('# system configuration generated and used by'
---- Python-3.4.0/Modules/getpath.c.~1~	2014-03-16 19:31:31.000000000 -0700
-+++ Python-3.4.0/Modules/getpath.c	2014-04-25 15:02:02.837613851 -0700
+--- Python-3.4.0/Modules/getpath.c.~1~ 2014-03-16 19:31:31.000000000 -0700
++++ Python-3.4.0/Modules/getpath.c     2014-04-25 15:02:02.837613851 -0700
 @@ -697,6 +697,10 @@
          wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
          joinpath(exec_prefix, L"lib/lib-dynload");
@@ -67,144 +170,3 @@
      /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */
  
      if ((!pfound || !efound) && !Py_FrozenFlag)
-@@ -710,8 +714,30 @@
-     if (_rtpypath && _rtpypath[0] != '\0') {
-         size_t rtpypath_len;
-         rtpypath = _Py_char2wchar(_rtpypath, &rtpypath_len);
--        if (rtpypath != NULL)
--            bufsz += rtpypath_len + 1;
-+        if (rtpypath != NULL) {
-+            wchar_t *orig_rtpypath = rtpypath;
-+
-+            /*
-+             * Split the path; for each component, add that component + "/64"
-+             * (if in 64-bit mode) and the component unadorned (regardless).
-+             */
-+            while (1) {
-+                wchar_t *delim = wcschr(rtpypath, DELIM);
-+                if (delim) {
-+                    /* once for usual, another for usual + "/64" */
-+                    bufsz += delim - rtpypath + 1;
-+                    if (sizeof(void *) == 8)
-+                        bufsz += delim - rtpypath + 1 + 3;
-+                } else {
-+                    bufsz += wcslen(rtpypath) + 1;
-+                    if (sizeof(void *) == 8)
-+                        bufsz += wcslen(rtpypath) + 1 + 3;
-+                    break;
-+                }
-+                rtpypath = delim + 1;
-+            }
-+            rtpypath = orig_rtpypath;
-+        }
-     }
- 
-     defpath = _pythonpath;
-@@ -723,9 +749,19 @@
-             /* Paths are relative to prefix */
-             bufsz += prefixsz;
- 
--        if (delim)
-+        if (delim) {
-+            if (sizeof(void *) == 8) {
-+                bufsz += delim - defpath + 1 + 3;
-+                if (defpath[0] != SEP)
-+                    bufsz += prefixsz;
-+            }
-             bufsz += delim - defpath + 1;
--        else {
-+        } else {
-+            if (sizeof(void *) == 8) {
-+                bufsz += wcslen(defpath) + 1 + 3;
-+                if (defpath[0] != SEP)
-+                    bufsz += prefixsz;
-+            }
-             bufsz += wcslen(defpath) + 1;
-             break;
-         }
-@@ -741,13 +777,38 @@
-             "Not enough memory for dynamic PYTHONPATH");
-     }
- 
-+    buf[0] = '\0';
-     /* Run-time value of $PYTHONPATH goes first */
-     if (rtpypath) {
--        wcscpy(buf, rtpypath);
--        wcscat(buf, delimiter);
-+        wchar_t *orig_rtpypath = rtpypath;
-+
-+        while (1) {
-+            wchar_t *delim = wcschr(rtpypath, DELIM);
-+
-+            if (delim) {
-+                *delim = '\0';
-+                if (sizeof(void *) == 8) {
-+                    wcscat(buf, rtpypath);
-+                    wcscat(buf, L"/64");
-+                    wcscat(buf, delimiter);
-+                }
-+                wcscat(buf, rtpypath);
-+                wcscat(buf, delimiter);
-+                *delim = DELIM;
-+            } else {
-+                if (sizeof(void *) == 8) {
-+                    wcscat(buf, rtpypath);
-+                    wcscat(buf, L"/64");
-+                    wcscat(buf, delimiter);
-+                }
-+                wcscat(buf, rtpypath);
-+                wcscat(buf, delimiter);
-+                break;
-+            }
-+            rtpypath = delim + 1;
-+        }
-+        rtpypath = orig_rtpypath;
-     }
--    else
--        buf[0] = '\0';
- 
-     /* Next is the default zip path */
-     wcscat(buf, zip_path);
-@@ -766,18 +827,35 @@
-         }
- 
-         if (delim) {
--            size_t len = delim - defpath + 1;
--            size_t end = wcslen(buf) + len;
--            wcsncat(buf, defpath, len);
--            *(buf + end) = '\0';
--        }
--        else {
-+            *delim = '\0';
-+            if (sizeof(void *) == 8) {
-+                wcscat(buf, defpath);
-+                wcscat(buf, L"/64");
-+                wcscat(buf, delimiter);
-+                if (defpath[0] != SEP) {
-+                    wcscat(buf, prefix);
-+                    wcscat(buf, separator);
-+                }
-+            }
-             wcscat(buf, defpath);
-+            wcscat(buf, delimiter);
-+            *delim = DELIM;
-+        } else {
-+            if (sizeof(void *) == 8) {
-+                wcscat(buf, defpath);
-+                wcscat(buf, L"/64");
-+                wcscat(buf, delimiter);
-+                if (defpath[0] != SEP) {
-+                    wcscat(buf, prefix);
-+                    wcscat(buf, separator);
-+                }
-+            }
-+            wcscat(buf, defpath);
-+            wcscat(buf, delimiter);
-             break;
-         }
-         defpath = delim + 1;
-     }
--    wcscat(buf, delimiter);
- 
-     /* Finally, on goes the directory for dynamic-load modules */
-     wcscat(buf, exec_prefix);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python34/patches/17-frozen-path.patch	Wed Aug 06 10:14:32 2014 -0700
@@ -0,0 +1,14 @@
+This patch has been submitted upstream, but has not yet been accepted.
+http://bugs.python.org/issue22148
+
+--- Python-3.4.1/Python/frozen.c.~1~	2014-03-16 19:31:31.000000000 -0700
++++ Python-3.4.1/Python/frozen.c	2014-08-04 15:06:16.419797757 -0700
+@@ -2,7 +2,7 @@
+ /* Dummy frozen modules initializer */
+ 
+ #include "Python.h"
+-#include "importlib.h"
++#include <importlib.h>
+ 
+ /* In order to test the support for frozen modules, by default we
+    define a single frozen module, __hello__.  Loading it will print