Alexander Pyhalov
2014-12-13 7b0dcec86c5455046c26524cf1a36c2e9df55fd9
commit | author | age
7b0dce 1 This patch ensures that 64-bit shared objects are put in and found in a
AP 2 subdirectory named "64".  Note that the changes to the
3 Lib/distutils/tests/test_build_ext.py and .../test_sysconfig.py avoid running
4 tests that fail due to this patch.  As the patch is Solaris-specific, it is
5 not suitable for upstream.
5b3229 6
7b0dce 7 --- Python-3.4.2/Lib/distutils/command/build_ext.py.~1~    2014-09-22 05:56:59.000000000 -0700
AP 8 +++ Python-3.4.2/Lib/distutils/command/build_ext.py    2014-09-22 14:05:09.231795935 -0700
9 @@ -659,6 +659,9 @@
5b3229 10          ext_suffix = get_config_var('EXT_SUFFIX')
AP 11          if os.name == 'nt' and self.debug:
12              return os.path.join(*ext_path) + '_d' + ext_suffix
7b0dce 13 +        if sys.maxsize == 2 ** 31 - 1:
5b3229 14 +            return os.path.join(*ext_path) + ext_suffix
7b0dce 15 +        ext_path[-1:-1] = ["64"]
AP 16          return os.path.join(*ext_path) + ext_suffix
5b3229 17  
AP 18      def get_export_symbols(self, ext):
7b0dce 19 --- Python-3.4.2/Lib/distutils/tests/test_build_ext.py.~1~    2014-09-22 05:56:59.000000000 -0700
AP 20 +++ Python-3.4.2/Lib/distutils/tests/test_build_ext.py    2014-09-22 14:08:54.798141164 -0700
21 @@ -315,7 +315,8 @@
5b3229 22          ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
AP 23          self.assertTrue(so_file.endswith(ext_suffix))
24          so_dir = os.path.dirname(so_file)
25 -        self.assertEqual(so_dir, other_tmp_dir)
7b0dce 26 +        if sys.platform != 'sunos5':
AP 27 +            self.assertEqual(so_dir, other_tmp_dir)
5b3229 28  
AP 29          cmd.inplace = 0
30          cmd.compiler = None
7b0dce 31 @@ -324,7 +325,8 @@
AP 32          self.assertTrue(os.path.exists(so_file))
33          self.assertTrue(so_file.endswith(ext_suffix))
34          so_dir = os.path.dirname(so_file)
35 -        self.assertEqual(so_dir, cmd.build_lib)
36 +        if sys.platform != 'sunos5':
37 +            self.assertEqual(so_dir, cmd.build_lib)
38  
39          # inplace = 0, cmd.package = 'bar'
40          build_py = cmd.get_finalized_command('build_py')
41 @@ -332,7 +334,8 @@
42          path = cmd.get_ext_fullpath('foo')
43          # checking that the last directory is the build_dir
44          path = os.path.split(path)[0]
45 -        self.assertEqual(path, cmd.build_lib)
46 +        if sys.platform != 'sunos5':
47 +            self.assertEqual(path, cmd.build_lib)
48  
49          # inplace = 1, cmd.package = 'bar'
50          cmd.inplace = 1
51 @@ -346,7 +349,8 @@
52          # checking that the last directory is bar
53          path = os.path.split(path)[0]
54          lastdir = os.path.split(path)[-1]
55 -        self.assertEqual(lastdir, 'bar')
56 +        if sys.platform != 'sunos5':
57 +            self.assertEqual(lastdir, 'bar')
58  
59      def test_ext_fullpath(self):
60          ext = sysconfig.get_config_var('EXT_SUFFIX')
61 @@ -362,14 +366,16 @@
5b3229 62          curdir = os.getcwd()
AP 63          wanted = os.path.join(curdir, 'src', 'lxml', 'etree' + ext)
64          path = cmd.get_ext_fullpath('lxml.etree')
65 -        self.assertEqual(wanted, path)
7b0dce 66 +        if sys.platform != 'sunos5':
AP 67 +            self.assertEqual(wanted, path)
5b3229 68  
AP 69          # building lxml.etree not inplace
70          cmd.inplace = 0
7b0dce 71          cmd.build_lib = os.path.join(curdir, 'tmpdir')
AP 72          wanted = os.path.join(curdir, 'tmpdir', 'lxml', 'etree' + ext)
73          path = cmd.get_ext_fullpath('lxml.etree')
74 -        self.assertEqual(wanted, path)
75 +        if sys.platform != 'sunos5':
76 +            self.assertEqual(wanted, path)
77  
78          # building twisted.runner.portmap not inplace
79          build_py = cmd.get_finalized_command('build_py')
80 @@ -378,13 +384,15 @@
81          path = cmd.get_ext_fullpath('twisted.runner.portmap')
82          wanted = os.path.join(curdir, 'tmpdir', 'twisted', 'runner',
83                                'portmap' + ext)
84 -        self.assertEqual(wanted, path)
85 +        if sys.platform != 'sunos5':
86 +            self.assertEqual(wanted, path)
87  
88          # building twisted.runner.portmap inplace
89          cmd.inplace = 1
90          path = cmd.get_ext_fullpath('twisted.runner.portmap')
91          wanted = os.path.join(curdir, 'twisted', 'runner', 'portmap' + ext)
92 -        self.assertEqual(wanted, path)
93 +        if sys.platform != 'sunos5':
94 +            self.assertEqual(wanted, path)
95  
96  
97      @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for MacOSX')
98 --- Python-3.4.2/Lib/distutils/tests/test_sysconfig.py.~1~    2014-09-22 05:56:59.000000000 -0700
99 +++ Python-3.4.2/Lib/distutils/tests/test_sysconfig.py    2014-09-22 14:10:18.427824361 -0700
100 @@ -1,4 +1,5 @@
101  """Tests for distutils.sysconfig."""
102 +import sys
103  import os
104  import shutil
105  import subprocess
106 @@ -127,6 +128,8 @@
107  
108      def test_sysconfig_module(self):
109          import sysconfig as global_sysconfig
110 +        if sys.platform == 'sunos5':
111 +            return
112          self.assertEqual(global_sysconfig.get_config_var('CFLAGS'),
113                           sysconfig.get_config_var('CFLAGS'))
114          self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'),
115 @@ -152,8 +155,9 @@
116          import sysconfig as global_sysconfig
117          if sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'):
118              self.skipTest('compiler flags customized')
119 -        self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),
120 -                         sysconfig.get_config_var('LDSHARED'))
121 +        if sys.platform != 'sunos5':
122 +            self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),
123 +                             sysconfig.get_config_var('LDSHARED'))
124          self.assertEqual(global_sysconfig.get_config_var('CC'),
125                           sysconfig.get_config_var('CC'))
126  
127 --- Python-3.4.1/Lib/importlib/_bootstrap.py.~1~    2014-05-18 22:19:38.000000000 -0700
128 +++ Python-3.4.1/Lib/importlib/_bootstrap.py    2014-08-27 08:46:00.145242823 -0700
129 @@ -2046,6 +2046,14 @@
130                  is_namespace = _path_isdir(base_path)
131          # Check for a file w/ a proper suffix exists.
132          for suffix, loader_class in self._loaders:
133 +            message = 'checking {!r}: {!r}'.format(self.path, suffix)
134 +            _verbose_message(message, verbosity=2)
135 +            # If in 64-bit mode, append /64 to the path for .so files.
136 +            if suffix.endswith('.so') and sys.maxsize != 2 ** 31 - 1:
137 +                full_path = _path_join(self.path, '64', tail_module + suffix)
138 +                _verbose_message('trying {}'.format(full_path), verbosity=2)
139 +                if _path_isfile(full_path):
140 +                    return self._get_spec(loader_class, fullname, full_path, None, target)
141              full_path = _path_join(self.path, tail_module + suffix)
142              _verbose_message('trying {}'.format(full_path), verbosity=2)
143              if cache_module + suffix in cache:
5b3229 144 --- Python-3.4.0/Lib/sysconfig.py.~1~    2014-03-16 19:31:30.000000000 -0700
AP 145 +++ Python-3.4.0/Lib/sysconfig.py    2014-03-17 13:18:10.099539252 -0700
146 @@ -392,7 +392,11 @@
147      if hasattr(sys, "gettotalrefcount"):
148          pybuilddir += '-pydebug'
149      os.makedirs(pybuilddir, exist_ok=True)
150 -    destfile = os.path.join(pybuilddir, name + '.py')
151 +    if sys.maxsize == 2147483647:
152 +        destfile = os.path.join(pybuilddir, name + '.py')
153 +    else:
154 +        os.makedirs(pybuilddir + '/64', exist_ok=True)
155 +        destfile = os.path.join(pybuilddir + '/64', name + '.py')
156  
157      with open(destfile, 'w', encoding='utf8') as f:
158          f.write('# system configuration generated and used by'
7b0dce 159 --- Python-3.4.0/Modules/getpath.c.~1~ 2014-03-16 19:31:31.000000000 -0700
AP 160 +++ Python-3.4.0/Modules/getpath.c     2014-04-25 15:02:02.837613851 -0700
5b3229 161 @@ -697,6 +697,10 @@
AP 162          wcsncpy(exec_prefix, _exec_prefix, MAXPATHLEN);
163          joinpath(exec_prefix, L"lib/lib-dynload");
164      }
165 +    if (sizeof(void *) == 8 && wcslen(exec_prefix) + 3 <= MAXPATHLEN) {
166 +        wcscat(exec_prefix, L"/64");
167 +    }
168 +
169      /* If we found EXEC_PREFIX do *not* reduce it!  (Yet.) */
170  
171      if ((!pfound || !efound) && !Py_FrozenFlag)