commit:     7edcfc0b16982e57f799eebe550eb6a6d75ffa7a
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 19 18:37:01 2017 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 18:37:01 2017 +0000
URL:        
https://gitweb.gentoo.org/proj/python-gentoo-patches.git/commit/?id=7edcfc0b

Updates for 3.5 from Arfrever

 patches/01_all_static_library_location.patch       |   4 +-
 patches/03_all_libdir.patch                        |   8 +-
 ..._all_regenerate_platform-specific_modules.patch |  12 +-
 patches/21_all_distutils_c++.patch                 |   8 +-
 patches/22_all_tests_environment.patch             | 131 +++++++++++----------
 5 files changed, 84 insertions(+), 79 deletions(-)

diff --git a/patches/01_all_static_library_location.patch 
b/patches/01_all_static_library_location.patch
index 56c6ff0..cc25234 100644
--- a/patches/01_all_static_library_location.patch
+++ b/patches/01_all_static_library_location.patch
@@ -4,7 +4,7 @@ https://bugs.python.org/issue6103
 
 --- Makefile.pre.in
 +++ Makefile.pre.in
-@@ -1047,6 +1047,19 @@
+@@ -1049,6 +1049,19 @@
                $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
                        $$ensurepip --root=$(DESTDIR)/ ; \
        fi
@@ -24,7 +24,7 @@ https://bugs.python.org/issue6103
  
  commoninstall:  @FRAMEWORKALTINSTALLFIRST@ \
                altbininstall libinstall inclinstall libainstall \
-@@ -1385,18 +1398,6 @@
+@@ -1387,18 +1400,6 @@
                else    true; \
                fi; \
        done

diff --git a/patches/03_all_libdir.patch b/patches/03_all_libdir.patch
index 3fa0528..41d10f9 100644
--- a/patches/03_all_libdir.patch
+++ b/patches/03_all_libdir.patch
@@ -13,7 +13,7 @@
          'data'   : '$base',
 --- Lib/distutils/sysconfig.py
 +++ Lib/distutils/sysconfig.py
-@@ -133,7 +133,7 @@
+@@ -130,7 +130,7 @@
  
      if os.name == "posix":
          libpython = os.path.join(prefix,
@@ -67,7 +67,7 @@
          'data': '{userbase}',
 --- Lib/test/test_site.py
 +++ Lib/test/test_site.py
-@@ -249,7 +249,7 @@
+@@ -262,7 +262,7 @@
          elif os.sep == '/':
              # OS X non-framwework builds, Linux, FreeBSD, etc
              self.assertEqual(len(dirs), 1)
@@ -78,7 +78,7 @@
          else:
 --- Makefile.pre.in
 +++ Makefile.pre.in
-@@ -126,7 +126,7 @@
+@@ -128,7 +128,7 @@
  MANDIR=               @mandir@
  INCLUDEDIR=   @includedir@
  CONFINCLUDEDIR=       $(exec_prefix)/include
@@ -129,7 +129,7 @@
  
 --- configure.ac
 +++ configure.ac
-@@ -4524,7 +4524,7 @@
+@@ -4535,7 +4535,7 @@
  
  dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
  AC_SUBST(PY_ENABLE_SHARED)

diff --git a/patches/05_all_regenerate_platform-specific_modules.patch 
b/patches/05_all_regenerate_platform-specific_modules.patch
index b8d412c..c57f257 100644
--- a/patches/05_all_regenerate_platform-specific_modules.patch
+++ b/patches/05_all_regenerate_platform-specific_modules.patch
@@ -37,7 +37,7 @@ https://bugs.python.org/issue12619
 +python$EXE ../../Tools/scripts/h2py.py /usr/include/sys/stropts.h
 --- Makefile.pre.in
 +++ Makefile.pre.in
-@@ -483,7 +483,7 @@
+@@ -451,7 +451,7 @@
  
  # Default target
  all:          @DEF_MAKE_ALL_RULE@
@@ -46,7 +46,7 @@ https://bugs.python.org/issue12619
  
  # Compile a binary with profile guided optimization.
  profile-opt:
-@@ -607,6 +607,32 @@
+@@ -576,6 +576,32 @@
                _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' 
\
                $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
  
@@ -79,16 +79,16 @@ https://bugs.python.org/issue12619
  # Build static library
  # avoid long command lines, same as LIBRARY_OBJS
  $(LIBRARY): $(LIBRARY_OBJS)
-@@ -1241,7 +1267,7 @@
+@@ -1243,7 +1269,7 @@
                unittest unittest/test unittest/test/testmock \
-               venv venv/scripts venv/scripts/posix \
+               venv venv/scripts venv/scripts/common venv/scripts/posix \
                curses pydoc_data $(MACHDEPS)
 -libinstall:   build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
 +libinstall:   build_all $(srcdir)/Modules/xxmodule.c
        @for i in $(SCRIPTDIR) $(LIBDEST); \
        do \
                if test ! -d $(DESTDIR)$$i; then \
-@@ -1333,23 +1359,6 @@
+@@ -1335,23 +1361,6 @@
        -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
                $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver 
$(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
  
@@ -112,7 +112,7 @@ https://bugs.python.org/issue12619
  python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
        # Substitution happens here, as the completely-expanded BINDIR
        # is not available in configure
-@@ -1682,7 +1691,7 @@
+@@ -1686,7 +1695,7 @@
  Python/thread.o: @THREADHEADERS@
  
  # Declare targets that aren't real files

diff --git a/patches/21_all_distutils_c++.patch 
b/patches/21_all_distutils_c++.patch
index 9b2ed60..7e898c2 100644
--- a/patches/21_all_distutils_c++.patch
+++ b/patches/21_all_distutils_c++.patch
@@ -81,7 +81,7 @@ https://bugs.python.org/issue1222585
          # dlls need another dll (mingwm10.dll see Mingw32 docs)
 --- Lib/distutils/sysconfig.py
 +++ Lib/distutils/sysconfig.py
-@@ -173,9 +173,12 @@
+@@ -170,9 +170,12 @@
                  _osx_support.customize_compiler(_config_vars)
                  _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
  
@@ -97,7 +97,7 @@ https://bugs.python.org/issue1222585
  
          if 'CC' in os.environ:
              newcc = os.environ['CC']
-@@ -190,19 +193,27 @@
+@@ -187,19 +190,27 @@
              cxx = os.environ['CXX']
          if 'LDSHARED' in os.environ:
              ldshared = os.environ['LDSHARED']
@@ -126,7 +126,7 @@ https://bugs.python.org/issue1222585
          if 'AR' in os.environ:
              ar = os.environ['AR']
          if 'ARFLAGS' in os.environ:
-@@ -211,13 +222,17 @@
+@@ -208,13 +219,17 @@
              archiver = ar + ' ' + ar_flags
  
          cc_cmd = cc + ' ' + cflags
@@ -229,7 +229,7 @@ https://bugs.python.org/issue1222585
                      linker = _osx_support.compiler_fixup(linker, ld_args)
 --- Makefile.pre.in
 +++ Makefile.pre.in
-@@ -603,7 +603,7 @@
+@@ -572,7 +572,7 @@
            *\ -s*|s*) quiet="-q";; \
            *) quiet="";; \
        esac; \

diff --git a/patches/22_all_tests_environment.patch 
b/patches/22_all_tests_environment.patch
index 4bd2589..3cd7c7c 100644
--- a/patches/22_all_tests_environment.patch
+++ b/patches/22_all_tests_environment.patch
@@ -19,7 +19,7 @@ https://bugs.python.org/issue1674555
      sethelper()
 --- Lib/test/regrtest.py
 +++ Lib/test/regrtest.py
-@@ -143,6 +143,7 @@
+@@ -152,6 +152,7 @@
  import unittest
  import warnings
  from inspect import isabstract
@@ -27,7 +27,7 @@ https://bugs.python.org/issue1674555
  
  try:
      import threading
-@@ -437,7 +438,6 @@
+@@ -478,7 +479,6 @@
      subprocess exits, its return code, stdout and stderr are returned as a
      3-tuple.
      """
@@ -35,11 +35,11 @@ https://bugs.python.org/issue1674555
      base_cmd = ([sys.executable] + support.args_from_interpreter_flags() +
                  ['-X', 'faulthandler', '-m', 'test.regrtest'])
      # required to spawn a new process with PGO flag on/off
-@@ -660,9 +660,62 @@
+@@ -711,9 +711,57 @@
      support.use_resources = ns.use_resources
      save_modules = sys.modules.keys()
  
-+    def _runtest(test, verbose, quiet, huntrleaks=False, use_resources=None,
++    def _runtest(ns, test, verbose, quiet, huntrleaks=False, 
use_resources=None,
 +                 output_on_failure=False, failfast=False, match_tests=None,
 +                 timeout=None, *, pgo=False):
 +        if test == "test_site":
@@ -48,18 +48,15 @@ https://bugs.python.org/issue1674555
 +            # required to spawn a new process with PGO flag on/off
 +            if pgo:
 +                base_cmd = base_cmd + ['--pgo']
-+            slaveargs = ((test, verbose, quiet),
-+                         dict(huntrleaks=huntrleaks,
-+                              use_resources=use_resources,
-+                              output_on_failure=output_on_failure,
-+                              timeout=timeout, failfast=failfast,
-+                              match_tests=match_tests, pgo=pgo))
++            ns_dict = vars(ns)
++            slaveargs = (ns_dict, test)
++            slaveargs = json.dumps(slaveargs)
 +            env = os.environ.copy()
 +            try:
 +                del env["_PYTHONNOSITEPACKAGES"]
 +            except KeyError:
 +                pass
-+            popen = Popen(base_cmd + ['--slaveargs', json.dumps(slaveargs)],
++            popen = Popen(base_cmd + ['--slaveargs', slaveargs],
 +                          stdout=PIPE, stderr=PIPE,
 +                          universal_newlines=True,
 +                          close_fds=(os.name != 'nt'),
@@ -67,26 +64,24 @@ https://bugs.python.org/issue1674555
 +                          env=env)
 +            stdout, stderr = popen.communicate()
 +            retcode = popen.wait()
-+            stdout, _, result = stdout.strip().rpartition("\n")
 +            if retcode != 0:
 +                result = (CHILD_ERROR, None)
 +            else:
++                stdout, _, result = stdout.strip().rpartition("\n")
 +                if not result:
 +                    return (None, None)
 +                result = json.loads(result)
 +            stdout = stdout.rstrip()
 +            stderr = stderr.rstrip()
 +            if stdout:
-+                print(stdout)
++                print(stdout, flush=True)
 +            if stderr and not pgo:
-+                print(stderr, file=sys.stderr)
-+            sys.stdout.flush()
-+            sys.stderr.flush()
++                print(stderr, file=sys.stderr, flush=True)
 +            if result[0] == INTERRUPTED:
 +                raise KeyboardInterrupt
 +            return result
 +        else:
-+            return runtest(test, verbose, quiet, huntrleaks=huntrleaks,
++            return runtest(ns, test, verbose, quiet, huntrleaks=huntrleaks,
 +                           use_resources=use_resources,
 +                           output_on_failure=output_on_failure,
 +                           failfast=failfast, match_tests=match_tests,
@@ -99,51 +94,43 @@ https://bugs.python.org/issue1674555
              test_times.append((test_time, test))
          if ok == PASSED:
              good.append(test)
-@@ -776,15 +829,15 @@
+@@ -726,7 +774,7 @@
+         elif ok == RESOURCE_DENIED:
+             skipped.append(test)
+             resource_denieds.append(test)
+-        elif ok != INTERRUPTED:
++        elif ok not in (None, INTERRUPTED):
+             raise ValueError("invalid test result: %r" % ok)
+ 
+     if ns.list_tests:
+@@ -856,11 +904,11 @@
+             display_progress(test_index, test)
+ 
+             def runtest_accumulate():
+-                result = runtest(ns, test, ns.verbose, ns.quiet,
+-                                 ns.huntrleaks,
+-                                 output_on_failure=ns.verbose3,
+-                                 timeout=ns.timeout, failfast=ns.failfast,
+-                                 match_tests=ns.match_tests, pgo=ns.pgo)
++                result = _runtest(ns, test, ns.verbose, ns.quiet,
++                                  ns.huntrleaks,
++                                  output_on_failure=ns.verbose3,
++                                  timeout=ns.timeout, failfast=ns.failfast,
++                                  match_tests=ns.match_tests, pgo=ns.pgo)
+                 accumulate_result(test, result)
+ 
              if ns.trace:
-                 # If we're tracing code coverage, then we don't exit with 
status
-                 # if on a false return value from main.
--                tracer.runctx('runtest(test, ns.verbose, ns.quiet, 
timeout=ns.timeout)',
-+                tracer.runctx('_runtest(test, ns.verbose, ns.quiet, 
timeout=ns.timeout)',
-                               globals=globals(), locals=vars())
-             else:
-                 try:
--                    result = runtest(test, ns.verbose, ns.quiet,
--                                     ns.huntrleaks,
--                                     output_on_failure=ns.verbose3,
--                                     timeout=ns.timeout, failfast=ns.failfast,
--                                     match_tests=ns.match_tests, pgo=ns.pgo)
-+                    result = _runtest(test, ns.verbose, ns.quiet,
-+                                      ns.huntrleaks,
-+                                      output_on_failure=ns.verbose3,
-+                                      timeout=ns.timeout, 
failfast=ns.failfast,
-+                                      match_tests=ns.match_tests, pgo=ns.pgo)
-                     accumulate_result(test, result)
-                 except KeyboardInterrupt:
-                     interrupted = True
-@@ -838,8 +891,8 @@
+@@ -923,8 +971,8 @@
              sys.stdout.flush()
              try:
                  ns.verbose = True
--                ok = runtest(test, True, ns.quiet, ns.huntrleaks,
+-                ok = runtest(ns, test, True, ns.quiet, ns.huntrleaks,
 -                             timeout=ns.timeout, pgo=ns.pgo)
-+                ok = _runtest(test, True, ns.quiet, ns.huntrleaks,
++                ok = _runtest(ns, test, True, ns.quiet, ns.huntrleaks,
 +                              timeout=ns.timeout, pgo=ns.pgo)
              except KeyboardInterrupt:
                  # print a newline separate from the ^C
                  print()
-@@ -1259,8 +1312,9 @@
-         for name, get, restore in self.resource_info():
-             current = get()
-             original = saved_values.pop(name)
--            # Check for changes to the resource's value
--            if current != original:
-+            # Check for changes to the resource's value. test_site is always 
run
-+            # in a subprocess and is allowed to change os.environ and 
sys.path.
-+            if current != original and self.testname != "test_site":
-                 self.changed = True
-                 restore(original)
-                 if not self.quiet and not self.pgo:
 --- Lib/test/test_site.py
 +++ Lib/test/test_site.py
 @@ -8,6 +8,7 @@
@@ -154,18 +141,36 @@ https://bugs.python.org/issue1674555
  import os
  import sys
  import re
-@@ -26,6 +27,10 @@
+@@ -28,12 +29,19 @@
+ 
+ 
+ OLD_SYS_PATH = None
++OLD__PYTHONNOSITEPACKAGES = None
  
- import site
  
-+if "_PYTHONNOSITEPACKAGES" in os.environ:
-+    del os.environ["_PYTHONNOSITEPACKAGES"]
-+    importlib.reload(site)
+ def setUpModule():
+     global OLD_SYS_PATH
+     OLD_SYS_PATH = sys.path[:]
+ 
++    if "_PYTHONNOSITEPACKAGES" in os.environ:
++        global OLD__PYTHONNOSITEPACKAGES
++        OLD__PYTHONNOSITEPACKAGES = os.environ.get("_PYTHONNOSITEPACKAGES")
++        del os.environ["_PYTHONNOSITEPACKAGES"]
++        importlib.reload(site)
 +
- if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE):
-     # need to add user site directory for tests
-     try:
-@@ -443,8 +448,11 @@
+     if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE):
+         # need to add user site directory for tests
+         try:
+@@ -47,6 +55,8 @@
+ 
+ def tearDownModule():
+     sys.path[:] = OLD_SYS_PATH
++    if OLD__PYTHONNOSITEPACKAGES is not None:
++        os.environ["_PYTHONNOSITEPACKAGES"] = OLD__PYTHONNOSITEPACKAGES
+ 
+ 
+ class HelperFunctionsTests(unittest.TestCase):
+@@ -456,8 +466,11 @@
      def test_startup_imports(self):
          # This tests checks which modules are loaded by Python when it
          # initially starts upon startup.
@@ -179,7 +184,7 @@ https://bugs.python.org/issue1674555
          stdout, stderr = popen.communicate()
 --- Makefile.pre.in
 +++ Makefile.pre.in
-@@ -1002,7 +1002,7 @@
+@@ -1004,7 +1004,7 @@
  ######################################################################
  
  TESTOPTS=     $(EXTRATESTOPTS)

Reply via email to