wok-next rev 19764

Patch python, up cookutils.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Jun 11 00:18:04 2017 +0300 (2017-06-11)
parents 8cad5edc1a45
children 2f3aba6cc31e
files cookutils/receipt python/stuff/patches/13a39142c047.diff python/stuff/patches/series python/stuff/python-2.7.3-xcompile.patch
line diff
     1.1 --- a/cookutils/receipt	Sat Jun 10 21:12:27 2017 +0300
     1.2 +++ b/cookutils/receipt	Sun Jun 11 00:18:04 2017 +0300
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt v2.
     1.5  
     1.6  PACKAGE="cookutils"
     1.7 -VERSION="922"
     1.8 +VERSION="923"
     1.9  CATEGORY="base-system"
    1.10  SHORT_DESC="SliTaz packages builder new generation"
    1.11  MAINTAINER="pankso@slitaz.org"
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/python/stuff/patches/13a39142c047.diff	Sun Jun 11 00:18:04 2017 +0300
     2.3 @@ -0,0 +1,72 @@
     2.4 +Error in the end of the `make install`:
     2.5 +
     2.6 +```
     2.7 +Traceback (most recent call last):
     2.8 +  File "${src}/Lib/runpy.py", line 163, in _run_module_as_main
     2.9 +    mod_name, _Error)
    2.10 +  File "${src}/Lib/runpy.py", line 111, in _get_module_details
    2.11 +    __import__(mod_name)  # Do not catch exceptions initializing package
    2.12 +  File "${src}/Lib/ensurepip/__init__.py", line 9, in <module>
    2.13 +    import tempfile
    2.14 +  File "${src}/Lib/tempfile.py", line 35, in <module>
    2.15 +    from random import Random as _Random
    2.16 +  File "${src}/Lib/random.py", line 885, in <module>
    2.17 +    _inst = Random()
    2.18 +  File "${src}/Lib/random.py", line 97, in __init__
    2.19 +    self.seed(x)
    2.20 +  File "${src}/Lib/random.py", line 113, in seed
    2.21 +    a = long(_hexlify(_urandom(2500)), 16)
    2.22 +OSError: [Errno 38] Function not implemented
    2.23 +make: *** [Makefile:927: install] Error 1
    2.24 +```
    2.25 +
    2.26 +While the normal installing process is following:
    2.27 +
    2.28 +```
    2.29 +Collecting setuptools
    2.30 +Collecting pip
    2.31 +Installing collected packages: setuptools, pip
    2.32 +Successfully installed pip-9.0.1 setuptools-28.8.0
    2.33 +```
    2.34 +
    2.35 +Discussion found here: http://bugs.python.org/issue29188
    2.36 +Patch found in the discussion above:
    2.37 +https://hg.python.org/cpython/rev/13a39142c047
    2.38 +
    2.39 +Chunk #1 is removed from the original patch because it rejected.
    2.40 +
    2.41 +
    2.42 +# HG changeset patch
    2.43 +# User Victor Stinner <victor.stinner@gmail.com>
    2.44 +# Date 1483956641 -3600
    2.45 +# Node ID 13a39142c0473ecb64fcd4b12a915025df6e4310
    2.46 +# Parent  cb4f73be9486d47f1dc4285998d1532d8857c59e
    2.47 +Don't use getentropy() on Linux
    2.48 +
    2.49 +Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function but
    2.50 +read from /dev/urandom to get random bytes, for example in os.urandom().  On
    2.51 +Linux, getentropy() is implemented which getrandom() is blocking mode, whereas
    2.52 +os.urandom() should not block.
    2.53 +
    2.54 +diff --git a/Python/random.c b/Python/random.c
    2.55 +--- a/Python/random.c
    2.56 ++++ b/Python/random.c
    2.57 +@@ -97,8 +97,15 @@ win32_urandom(unsigned char *buffer, Py_
    2.58 + }
    2.59 + 
    2.60 + /* Issue #25003: Don't use getentropy() on Solaris (available since
    2.61 +- * Solaris 11.3), it is blocking whereas os.urandom() should not block. */
    2.62 +-#elif defined(HAVE_GETENTROPY) && !defined(sun)
    2.63 ++   Solaris 11.3), it is blocking whereas os.urandom() should not block.
    2.64 ++
    2.65 ++   Issue #29188: Don't use getentropy() on Linux since the glibc 2.24
    2.66 ++   implements it with the getrandom() syscall which can fail with ENOSYS,
    2.67 ++   and this error is not supported in py_getentropy() and getrandom() is called
    2.68 ++   with flags=0 which blocks until system urandom is initialized, which is not
    2.69 ++   the desired behaviour to seed the Python hash secret nor for os.urandom():
    2.70 ++   see the PEP 524 which was only implemented in Python 3.6. */
    2.71 ++#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux)
    2.72 + #define PY_GETENTROPY 1
    2.73 + 
    2.74 + /* Fill buffer with size pseudo-random bytes generated by getentropy().
    2.75 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/python/stuff/patches/series	Sun Jun 11 00:18:04 2017 +0300
     3.3 @@ -0,0 +1,1 @@
     3.4 +13a39142c047.diff
     4.1 --- a/python/stuff/python-2.7.3-xcompile.patch	Sat Jun 10 21:12:27 2017 +0300
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,264 +0,0 @@
     4.4 -diff -ur Python-2.7.3.orig/configure Python-2.7.3-Source/configure
     4.5 ---- Python-2.7.3.orig/configure	2012-04-09 19:07:36.000000000 -0400
     4.6 -+++ Python-2.7.3-Source/configure	2012-10-23 14:10:45.305220393 -0400
     4.7 -@@ -13697,7 +13697,7 @@
     4.8 -   $as_echo_n "(cached) " >&6
     4.9 - else
    4.10 -   if test "$cross_compiling" = yes; then :
    4.11 --  ac_cv_have_long_long_format=no
    4.12 -+  ac_cv_have_long_long_format="cross -- assuming yes"
    4.13 - else
    4.14 -   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    4.15 - /* end confdefs.h.  */
    4.16 -@@ -13749,7 +13749,7 @@
    4.17 - $as_echo "$ac_cv_have_long_long_format" >&6; }
    4.18 - fi
    4.19 - 
    4.20 --if test "$ac_cv_have_long_long_format" = yes
    4.21 -+if test "$ac_cv_have_long_long_format" != no
    4.22 - then
    4.23 - 
    4.24 - $as_echo "#define PY_FORMAT_LONG_LONG \"ll\"" >>confdefs.h
    4.25 -diff -ur Python-2.7.3.orig/Makefile.pre.in Python-2.7.3-Source/Makefile.pre.in
    4.26 ---- Python-2.7.3.orig/Makefile.pre.in	2012-04-09 19:07:33.000000000 -0400
    4.27 -+++ Python-2.7.3-Source/Makefile.pre.in	2012-10-23 14:10:45.305220393 -0400
    4.28 -@@ -182,6 +182,7 @@
    4.29 - 
    4.30 - PYTHON=		python$(EXE)
    4.31 - BUILDPYTHON=	python$(BUILDEXE)
    4.32 -+HOSTPYTHON=     ./$(BUILDPYTHON)
    4.33 - 
    4.34 - # The task to run while instrument when building the profile-opt target
    4.35 - PROFILE_TASK=	$(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
    4.36 -@@ -215,6 +216,8 @@
    4.37 - # Parser
    4.38 - PGEN=		Parser/pgen$(EXE)
    4.39 - 
    4.40 -+HOSTPGEN=   $(PGEN)
    4.41 -+
    4.42 - POBJS=		\
    4.43 - 		Parser/acceler.o \
    4.44 - 		Parser/grammar1.o \
    4.45 -@@ -408,8 +411,8 @@
    4.46 - # Build the shared modules
    4.47 - sharedmods: $(BUILDPYTHON)
    4.48 - 	@case $$MAKEFLAGS in \
    4.49 --	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
    4.50 --	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
    4.51 -+	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
    4.52 -+	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' PYTHONXCPREFIX='$(DESTDIR)$(prefix)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
    4.53 - 	esac
    4.54 - 
    4.55 - # Build static library
    4.56 -@@ -543,7 +546,7 @@
    4.57 - $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
    4.58 - Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
    4.59 - 		-@$(INSTALL) -d Include
    4.60 --		$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
    4.61 -+		-$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
    4.62 - 		-touch Parser/pgen.stamp
    4.63 - 
    4.64 - $(PGEN):	$(PGENOBJS)
    4.65 -@@ -938,26 +941,26 @@
    4.66 - 		$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
    4.67 - 			$(DESTDIR)$(LIBDEST)/distutils/tests ; \
    4.68 - 	fi
    4.69 --	PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
    4.70 --		./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
    4.71 -+	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
    4.72 -+		./$(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
    4.73 - 		-d $(LIBDEST) -f \
    4.74 - 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
    4.75 - 		$(DESTDIR)$(LIBDEST)
    4.76 --	PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
    4.77 --		./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
    4.78 -+	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
    4.79 -+		./$(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
    4.80 - 		-d $(LIBDEST) -f \
    4.81 - 		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
    4.82 - 		$(DESTDIR)$(LIBDEST)
    4.83 - 	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
    4.84 --		./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
    4.85 -+		./$(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
    4.86 - 		-d $(LIBDEST)/site-packages -f \
    4.87 - 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
    4.88 - 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
    4.89 --		./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
    4.90 -+		./$(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
    4.91 - 		-d $(LIBDEST)/site-packages -f \
    4.92 - 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
    4.93 - 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
    4.94 --		./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
    4.95 -+		./$(HOSTPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
    4.96 - 
    4.97 - # Create the PLATDIR source directory, if one wasn't distributed..
    4.98 - $(srcdir)/Lib/$(PLATDIR):
    4.99 -@@ -1062,7 +1065,9 @@
   4.100 - # Install the dynamically loadable modules
   4.101 - # This goes into $(exec_prefix)
   4.102 - sharedinstall: sharedmods
   4.103 --	$(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
   4.104 -+	CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
   4.105 -+	$(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
   4.106 -+		--skip-build \
   4.107 - 	   	--prefix=$(prefix) \
   4.108 - 		--install-scripts=$(BINDIR) \
   4.109 - 		--install-platlib=$(DESTSHARED) \
   4.110 -diff -ur Python-2.7.3.orig/setup.py Python-2.7.3-Source/setup.py
   4.111 ---- Python-2.7.3.orig/setup.py	2012-04-09 19:07:36.000000000 -0400
   4.112 -+++ Python-2.7.3-Source/setup.py	2012-10-23 14:10:56.085220237 -0400
   4.113 -@@ -145,6 +145,7 @@
   4.114 -     def __init__(self, dist):
   4.115 -         build_ext.__init__(self, dist)
   4.116 -         self.failed = []
   4.117 -+        self.cross_compile = os.environ.get('CROSS_COMPILE_TARGET') == 'yes'
   4.118 - 
   4.119 -     def build_extensions(self):
   4.120 - 
   4.121 -@@ -278,6 +279,14 @@
   4.122 -                           (ext.name, sys.exc_info()[1]))
   4.123 -             self.failed.append(ext.name)
   4.124 -             return
   4.125 -+
   4.126 -+        # Import check will not work when cross-compiling.
   4.127 -+        if os.environ.has_key('PYTHONXCPREFIX'):
   4.128 -+            self.announce(
   4.129 -+                'WARNING: skipping import check for cross-compiled: "%s"' %
   4.130 -+                ext.name)
   4.131 -+            return
   4.132 -+
   4.133 -         # Workaround for Mac OS X: The Carbon-based modules cannot be
   4.134 -         # reliably imported into a command-line Python
   4.135 -         if 'Carbon' in ext.extra_link_args:
   4.136 -@@ -369,9 +378,10 @@
   4.137 - 
   4.138 -     def detect_modules(self):
   4.139 -         # Ensure that /usr/local is always used
   4.140 --        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
   4.141 --        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
   4.142 --        self.add_multiarch_paths()
   4.143 -+        if not self.cross_compile:
   4.144 -+            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
   4.145 -+            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
   4.146 -+            self.add_multiarch_paths()
   4.147 - 
   4.148 -         # Add paths specified in the environment variables LDFLAGS and
   4.149 -         # CPPFLAGS for header and library files.
   4.150 -@@ -408,7 +418,8 @@
   4.151 -                         add_dir_to_list(dir_list, directory)
   4.152 - 
   4.153 -         if os.path.normpath(sys.prefix) != '/usr' \
   4.154 --                and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
   4.155 -+                and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
   4.156 -+                and not self.cross_compile:
   4.157 -             # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
   4.158 -             # (PYTHONFRAMEWORK is set) to avoid # linking problems when
   4.159 -             # building a framework with different architectures than
   4.160 -@@ -426,11 +437,23 @@
   4.161 -         # lib_dirs and inc_dirs are used to search for files;
   4.162 -         # if a file is found in one of those directories, it can
   4.163 -         # be assumed that no additional -I,-L directives are needed.
   4.164 --        lib_dirs = self.compiler.library_dirs + [
   4.165 --            '/lib64', '/usr/lib64',
   4.166 --            '/lib', '/usr/lib',
   4.167 --            ]
   4.168 --        inc_dirs = self.compiler.include_dirs + ['/usr/include']
   4.169 -+        lib_dirs = self.compiler.library_dirs
   4.170 -+        inc_dirs = self.compiler.include_dirs
   4.171 -+        if not self.cross_compile:
   4.172 -+            lib_dirs += [
   4.173 -+                '/lib64', '/usr/lib64',
   4.174 -+                '/lib', '/usr/lib',
   4.175 -+                ]
   4.176 -+            inc_dirs += ['/usr/include']
   4.177 -+        else:
   4.178 -+            # The common install prefix of 3rd party libraries used during
   4.179 -+            # cross compilation
   4.180 -+            mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
   4.181 -+            if mydir:
   4.182 -+                inc_dirs += [mydir + '/include' ]
   4.183 -+                inc_dirs += [mydir + '/lib/libffi-3.0.10/include']
   4.184 -+                lib_dirs += [mydir + '/lib' ]
   4.185 -+
   4.186 -         exts = []
   4.187 -         missing = []
   4.188 - 
   4.189 -@@ -1004,13 +1027,24 @@
   4.190 -         # We hunt for #define SQLITE_VERSION "n.n.n"
   4.191 -         # We need to find >= sqlite version 3.0.8
   4.192 -         sqlite_incdir = sqlite_libdir = None
   4.193 --        sqlite_inc_paths = [ '/usr/include',
   4.194 --                             '/usr/include/sqlite',
   4.195 --                             '/usr/include/sqlite3',
   4.196 --                             '/usr/local/include',
   4.197 --                             '/usr/local/include/sqlite',
   4.198 --                             '/usr/local/include/sqlite3',
   4.199 --                           ]
   4.200 -+
   4.201 -+        if not self.cross_compile:
   4.202 -+            sqlite_inc_paths = [ '/usr/include',
   4.203 -+                                 '/usr/include/sqlite',
   4.204 -+                                 '/usr/include/sqlite3',
   4.205 -+                                 '/usr/local/include',
   4.206 -+                                 '/usr/local/include/sqlite',
   4.207 -+                                 '/usr/local/include/sqlite3',
   4.208 -+                                ]
   4.209 -+        else:
   4.210 -+            # The common install prefix of 3rd party headers used during
   4.211 -+            # cross compilation
   4.212 -+            mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
   4.213 -+            if mydir:
   4.214 -+                sqlite_inc_paths = [mydir + '/include' ]
   4.215 -+            else:
   4.216 -+                sqlite_inc_paths = []
   4.217 -+
   4.218 -         MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
   4.219 -         MIN_SQLITE_VERSION = ".".join([str(x)
   4.220 -                                     for x in MIN_SQLITE_VERSION_NUMBER])
   4.221 -@@ -1050,12 +1084,22 @@
   4.222 -                     print "sqlite: %s had no SQLITE_VERSION"%(f,)
   4.223 - 
   4.224 -         if sqlite_incdir:
   4.225 --            sqlite_dirs_to_check = [
   4.226 --                os.path.join(sqlite_incdir, '..', 'lib64'),
   4.227 --                os.path.join(sqlite_incdir, '..', 'lib'),
   4.228 --                os.path.join(sqlite_incdir, '..', '..', 'lib64'),
   4.229 --                os.path.join(sqlite_incdir, '..', '..', 'lib'),
   4.230 --            ]
   4.231 -+            if not self.cross_compile:
   4.232 -+                sqlite_dirs_to_check = [
   4.233 -+                    os.path.join(sqlite_incdir, '..', 'lib64'),
   4.234 -+                    os.path.join(sqlite_incdir, '..', 'lib'),
   4.235 -+                    os.path.join(sqlite_incdir, '..', '..', 'lib64'),
   4.236 -+                    os.path.join(sqlite_incdir, '..', '..', 'lib'),
   4.237 -+                ]
   4.238 -+            else:
   4.239 -+                # The common install prefix of 3rd party headers used during
   4.240 -+                # cross compilation
   4.241 -+                mydir = os.environ.get('PYTHON_XCOMPILE_DEPENDENCIES_PREFIX')
   4.242 -+                if mydir:
   4.243 -+                    sqlite_dirs_to_check = [mydir + '/lib' ]
   4.244 -+                else:
   4.245 -+                    sqlite_dirs_to_check = []
   4.246 -+
   4.247 -             sqlite_libfile = self.compiler.find_library_file(
   4.248 -                                 sqlite_dirs_to_check + lib_dirs, 'sqlite3')
   4.249 -             if sqlite_libfile:
   4.250 -@@ -1864,8 +1908,15 @@
   4.251 - 
   4.252 -                 # Pass empty CFLAGS because we'll just append the resulting
   4.253 -                 # CFLAGS to Python's; -g or -O2 is to be avoided.
   4.254 --                cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
   4.255 --                      % (ffi_builddir, ffi_srcdir, " ".join(config_args))
   4.256 -+                if self.cross_compile:
   4.257 -+                    cmd = "cd %s && env CFLAGS='' %s/configure --host=%s --build=%s %s" \
   4.258 -+                          % (ffi_builddir, ffi_srcdir,
   4.259 -+                             os.environ.get('HOSTARCH'),
   4.260 -+                             os.environ.get('BUILDARCH'),
   4.261 -+                             " ".join(config_args))
   4.262 -+                else:
   4.263 -+                    cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
   4.264 -+                          % (ffi_builddir, ffi_srcdir, " ".join(config_args))
   4.265 - 
   4.266 -                 res = os.system(cmd)
   4.267 -                 if res or not os.path.exists(ffi_configfile):