commit:     fe1e7d0816e5d5fdf5ca5afdee30e06485e6ed48
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 19 14:33:20 2017 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 14:33:20 2017 +0000
URL:        
https://gitweb.gentoo.org/proj/python-gentoo-patches.git/commit/?id=fe1e7d08

Updates for 2.7 from Arfrever

 patches/01_all_static_library_location.patch       |   4 +-
 patches/03_all_libdir.patch                        |   6 +-
 .../04_all_non-zero_exit_status_on_failure.patch   |   2 +-
 patches/05_all_loadable_sqlite_extensions.patch    |   2 +-
 ..._all_regenerate_platform-specific_modules.patch |  10 +-
 patches/21_all_distutils_c++.patch                 |   2 +-
 patches/22_all_turkish_locale.patch                |  16 +-
 patches/24_all_tests_environment.patch             | 164 +++++++++++++--------
 8 files changed, 122 insertions(+), 84 deletions(-)

diff --git a/patches/01_all_static_library_location.patch 
b/patches/01_all_static_library_location.patch
index b375144..0038f0c 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
-@@ -1002,6 +1002,19 @@
+@@ -995,6 +995,19 @@
                fi; \
        else    true; \
        fi
@@ -24,7 +24,7 @@ https://bugs.python.org/issue6103
  
  # Install the versioned manual page
  altmaninstall:
-@@ -1199,18 +1212,6 @@
+@@ -1193,18 +1206,6 @@
                else    true; \
                fi; \
        done

diff --git a/patches/03_all_libdir.patch b/patches/03_all_libdir.patch
index c8b5ce4..45977f5 100644
--- a/patches/03_all_libdir.patch
+++ b/patches/03_all_libdir.patch
@@ -71,7 +71,7 @@
          'data'   : '{userbase}',
 --- Lib/test/test_site.py
 +++ Lib/test/test_site.py
-@@ -236,10 +236,10 @@
+@@ -253,10 +253,10 @@
          elif os.sep == '/':
              # OS X, Linux, FreeBSD, etc
              self.assertEqual(len(dirs), 2)
@@ -86,7 +86,7 @@
              # other platforms
 --- Makefile.pre.in
 +++ Makefile.pre.in
-@@ -111,7 +111,7 @@
+@@ -110,7 +110,7 @@
  MANDIR=               @mandir@
  INCLUDEDIR=   @includedir@
  CONFINCLUDEDIR=       $(exec_prefix)/include
@@ -193,7 +193,7 @@
              ]
              sqlite_libfile = self.compiler.find_library_file(
                                  sqlite_dirs_to_check + lib_dirs, 'sqlite3')
-@@ -1953,15 +1949,14 @@
+@@ -1956,15 +1952,14 @@
              added_lib_dirs.append('/usr/openwin/lib')
          elif os.path.exists('/usr/X11R6/include'):
              include_dirs.append('/usr/X11R6/include')

diff --git a/patches/04_all_non-zero_exit_status_on_failure.patch 
b/patches/04_all_non-zero_exit_status_on_failure.patch
index a8ede2f..25134f6 100644
--- a/patches/04_all_non-zero_exit_status_on_failure.patch
+++ b/patches/04_all_non-zero_exit_status_on_failure.patch
@@ -23,7 +23,7 @@ https://bugs.python.org/issue6731
              failed = self.failed[:]
              print
              print "Failed to build these modules:"
-@@ -2263,6 +2268,7 @@
+@@ -2266,6 +2271,7 @@
                       'Tools/scripts/2to3',
                       'Lib/smtpd.py']
          )

diff --git a/patches/05_all_loadable_sqlite_extensions.patch 
b/patches/05_all_loadable_sqlite_extensions.patch
index 00b16d4..be5a102 100644
--- a/patches/05_all_loadable_sqlite_extensions.patch
+++ b/patches/05_all_loadable_sqlite_extensions.patch
@@ -3,7 +3,7 @@ https://bugs.python.org/issue10268
 
 --- configure.ac
 +++ configure.ac
-@@ -2504,6 +2504,15 @@
+@@ -2500,6 +2500,15 @@
    TCLTK_LIBS="$with_tcltk_libs"
  fi
  

diff --git a/patches/06_all_regenerate_platform-specific_modules.patch 
b/patches/06_all_regenerate_platform-specific_modules.patch
index fe709fb..6770783 100644
--- a/patches/06_all_regenerate_platform-specific_modules.patch
+++ b/patches/06_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
-@@ -429,7 +429,7 @@
+@@ -401,7 +401,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:
-@@ -547,6 +547,32 @@
+@@ -518,6 +518,32 @@
                _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' 
\
                $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
  
@@ -79,7 +79,7 @@ https://bugs.python.org/issue12619
  # Build static library
  # avoid long command lines, same as LIBRARY_OBJS
  $(LIBRARY): $(LIBRARY_OBJS)
-@@ -1073,7 +1099,7 @@
+@@ -1067,7 +1093,7 @@
                unittest unittest/test \
                lib-old \
                curses pydoc_data $(MACHDEPS)
@@ -88,7 +88,7 @@ https://bugs.python.org/issue12619
        @for i in $(SCRIPTDIR) $(LIBDEST); \
        do \
                if test ! -d $(DESTDIR)$$i; then \
-@@ -1156,23 +1182,6 @@
+@@ -1150,23 +1176,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
        # Substitution happens here, as the completely-expanded BINDIR
        # is not available in configure
-@@ -1473,7 +1482,7 @@
+@@ -1465,7 +1474,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 0894c46..af30906 100644
--- a/patches/21_all_distutils_c++.patch
+++ b/patches/21_all_distutils_c++.patch
@@ -262,7 +262,7 @@ https://bugs.python.org/issue1222585
                      linker = _osx_support.compiler_fixup(linker, ld_args)
 --- Makefile.pre.in
 +++ Makefile.pre.in
-@@ -543,7 +543,7 @@
+@@ -514,7 +514,7 @@
            *\ -s*|s*) quiet="-q";; \
            *) quiet="";; \
        esac; \

diff --git a/patches/22_all_turkish_locale.patch 
b/patches/22_all_turkish_locale.patch
index b41c4c9..9100a75 100644
--- a/patches/22_all_turkish_locale.patch
+++ b/patches/22_all_turkish_locale.patch
@@ -1,6 +1,6 @@
 --- Objects/stringobject.c
 +++ Objects/stringobject.c
-@@ -1975,10 +1975,14 @@
+@@ -1981,10 +1981,14 @@
  \n\
  Return a copy of the string S converted to lowercase.");
  
@@ -19,7 +19,7 @@
  
  static PyObject *
  string_lower(PyStringObject *self)
-@@ -1998,7 +2002,7 @@
+@@ -2004,7 +2008,7 @@
      for (i = 0; i < n; i++) {
          int c = Py_CHARMASK(s[i]);
          if (isupper(c))
@@ -28,7 +28,7 @@
      }
  
      return newobj;
-@@ -2009,9 +2013,14 @@
+@@ -2015,9 +2019,14 @@
  \n\
  Return a copy of the string S converted to uppercase.");
  
@@ -46,7 +46,7 @@
  
  static PyObject *
  string_upper(PyStringObject *self)
-@@ -2031,7 +2040,7 @@
+@@ -2037,7 +2046,7 @@
      for (i = 0; i < n; i++) {
          int c = Py_CHARMASK(s[i]);
          if (islower(c))
@@ -55,7 +55,7 @@
      }
  
      return newobj;
-@@ -2059,11 +2068,11 @@
+@@ -2065,11 +2074,11 @@
          int c = Py_CHARMASK(*s++);
          if (islower(c)) {
              if (!previous_is_cased)
@@ -69,7 +69,7 @@
              previous_is_cased = 1;
          } else
              previous_is_cased = 0;
-@@ -2092,7 +2101,7 @@
+@@ -2098,7 +2107,7 @@
      if (0 < n) {
          int c = Py_CHARMASK(*s++);
          if (islower(c))
@@ -78,7 +78,7 @@
          else
              *s_new = c;
          s_new++;
-@@ -2100,7 +2109,7 @@
+@@ -2106,7 +2115,7 @@
      for (i = 1; i < n; i++) {
          int c = Py_CHARMASK(*s++);
          if (isupper(c))
@@ -87,7 +87,7 @@
          else
              *s_new = c;
          s_new++;
-@@ -2171,10 +2180,10 @@
+@@ -2177,10 +2186,10 @@
      for (i = 0; i < n; i++) {
          int c = Py_CHARMASK(*s++);
          if (islower(c)) {

diff --git a/patches/24_all_tests_environment.patch 
b/patches/24_all_tests_environment.patch
index f03859c..52ae84d 100644
--- a/patches/24_all_tests_environment.patch
+++ b/patches/24_all_tests_environment.patch
@@ -19,7 +19,7 @@ https://bugs.python.org/issue1674555
      setquit()
 --- Lib/test/regrtest.py
 +++ Lib/test/regrtest.py
-@@ -169,6 +169,7 @@
+@@ -188,6 +188,7 @@
  import imp
  import platform
  import sysconfig
@@ -27,7 +27,7 @@ https://bugs.python.org/issue1674555
  
  
  # Some times __path__ and __file__ are not absolute (e.g. while running from
-@@ -464,9 +465,62 @@
+@@ -599,9 +600,73 @@
      test_support.use_resources = use_resources
      save_modules = set(sys.modules)
  
@@ -38,63 +38,83 @@ https://bugs.python.org/issue1674555
 +        base_cmd = base_cmd + ['--pgo']
 +    debug_output_pat = re.compile(r"\[\d+ refs\]$")
 +
-+    def get_args_tuple(test, verbose, quiet, huntrleaks, use_resources, pgo):
++    def get_args_tuple(test, verbose, quiet, huntrleaks, use_resources,
++                       failfast, match_tests, pgo):
 +        return (
 +            (test, verbose, quiet),
-+            dict(huntrleaks=huntrleaks, use_resources=use_resources, pgo=pgo)
++            dict(huntrleaks=huntrleaks, use_resources=use_resources,
++                 failfast=failfast, match_tests=match_tests, pgo=pgo)
 +        )
 +
-+    def _runtest(test, verbose, quiet, huntrleaks=False,
-+                 use_resources=None, pgo=False):
++    def _runtest(test, verbose, quiet, huntrleaks=False, use_resources=None,
++                 pgo=False, failfast=False, match_tests=None, testdir=None):
 +        if test == "test_site":
 +            args_tuple = get_args_tuple(test, verbose, quiet, huntrleaks,
-+                                        use_resources, pgo)
++                                        use_resources, failfast, match_tests,
++                                        pgo)
++            args = base_cmd + ['--slaveargs', json.dumps(args_tuple)]
++            if testdir:
++                args.extend(('--testdir', testdir))
 +            env = os.environ.copy()
 +            try:
 +                del env["_PYTHONNOSITEPACKAGES"]
 +            except KeyError:
 +                pass
-+            popen = Popen(base_cmd + ['--slaveargs', json.dumps(args_tuple)],
++            popen = Popen(args,
 +                          stdout=PIPE, stderr=PIPE,
 +                          universal_newlines=True,
 +                          close_fds=(os.name != 'nt'),
 +                          cwd=test_support.SAVEDCWD,
 +                          env=env)
 +            stdout, stderr = popen.communicate()
++            retcode = popen.wait()
 +            # Strip last refcount output line if it exists, since it
 +            # comes from the shutdown of the interpreter in the subcommand.
 +            stderr = debug_output_pat.sub("", stderr)
-+            stdout, _, result = stdout.strip().rpartition("\n")
-+            if not result:
-+                return (None, None)
-+            result = json.loads(result)
++            if retcode == 0:
++                stdout, _, result = stdout.strip().rpartition("\n")
++                if not result:
++                    return (None, None)
++                result = json.loads(result)
++            else:
++                result = (CHILD_ERROR, None)
 +            stdout = stdout.rstrip()
 +            stderr = stderr.rstrip()
 +            if stdout:
 +                print stdout
++            sys.stdout.flush()
 +            if stderr and not pgo:
 +                print >>sys.stderr, stderr
-+            sys.stdout.flush()
 +            sys.stderr.flush()
 +            if result[0] == INTERRUPTED:
 +                raise KeyboardInterrupt
 +            return result
 +        else:
 +            return runtest(test, verbose, quiet, huntrleaks=huntrleaks,
-+                           use_resources=use_resources, pgo=pgo)
++                           use_resources=use_resources, pgo=pgo,
++                           failfast=failfast, match_tests=match_tests,
++                           testdir=testdir)
 +
      def accumulate_result(test, result):
          ok, test_time = result
--        test_times.append((test_time, test))
-+        if ok not in (None, INTERRUPTED):
-+            test_times.append((test_time, test))
+-        if ok not in (CHILD_ERROR, INTERRUPTED):
++        if ok not in (None, CHILD_ERROR, INTERRUPTED):
+             test_times.append((test_time, test))
          if ok == PASSED:
              good.append(test)
-         elif ok == FAILED:
-@@ -501,23 +555,13 @@
+@@ -614,7 +679,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 forever:
+@@ -681,25 +746,14 @@
              print "Multiprocess option requires thread support"
              sys.exit(2)
-         from Queue import Queue
+         from Queue import Queue, Empty
 -        from subprocess import Popen, PIPE
 -        debug_output_pat = re.compile(r"\[\d+ refs\]$")
          output = Queue()
@@ -103,10 +123,13 @@ https://bugs.python.org/issue1674555
 -                args_tuple = (
 -                    (test, verbose, quiet),
 -                    dict(huntrleaks=huntrleaks, use_resources=use_resources,
+-                         failfast=failfast,
+-                         match_tests=match_tests,
 -                         pgo=pgo)
 -                )
 +                args_tuple = get_args_tuple(test, verbose, quiet, huntrleaks,
-+                                            use_resources, pgo)
++                                            use_resources, failfast,
++                                            match_tests, pgo)
                  yield (test, args_tuple)
          pending = tests_and_args()
 -        opt_args = test_support.args_from_interpreter_flags()
@@ -114,78 +137,93 @@ https://bugs.python.org/issue1674555
 -        # required to spawn a new process with PGO flag on/off
 -        if pgo:
 -            base_cmd = base_cmd + ['--pgo']
-         def work():
-             # A worker thread.
-             try:
-@@ -587,16 +631,16 @@
-             if 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, verbose, quiet)',
-+                tracer.runctx('_runtest(test, verbose, quiet)',
-                               globals=globals(), locals=vars())
-             else:
-                 try:
--                    result = runtest(test, verbose, quiet, huntrleaks, None, 
pgo)
-+                    result = _runtest(test, verbose, quiet, huntrleaks, None, 
pgo)
-                     accumulate_result(test, result)
+ 
+         class MultiprocessThread(Thread):
+             current_test = None
+@@ -830,10 +884,10 @@
+                 display_progress(test_index, text)
+ 
+             def local_runtest():
+-                result = runtest(test, verbose, quiet, huntrleaks, None, pgo,
+-                                 failfast=failfast,
+-                                 match_tests=match_tests,
+-                                 testdir=testdir)
++                result = _runtest(test, verbose, quiet, huntrleaks, None, pgo,
++                                  failfast=failfast,
++                                  match_tests=match_tests,
++                                  testdir=testdir)
+                 accumulate_result(test, result)
+                 return result
+ 
+@@ -851,8 +905,8 @@
                      if verbose3 and result[0] == FAILED:
                          if not pgo:
                              print "Re-running test %r in verbose mode" % test
--                        runtest(test, True, quiet, huntrleaks, None, pgo)
-+                        _runtest(test, True, quiet, huntrleaks, None, pgo)
+-                        runtest(test, True, quiet, huntrleaks, None, pgo,
+-                                testdir=testdir)
++                        _runtest(test, True, quiet, huntrleaks, None, pgo,
++                                 testdir=testdir)
                  except KeyboardInterrupt:
                      interrupted = True
                      break
-@@ -664,7 +708,7 @@
+@@ -928,8 +982,8 @@
              sys.stdout.flush()
              try:
                  test_support.verbose = True
--                ok = runtest(test, True, quiet, huntrleaks, None, pgo)
-+                ok = _runtest(test, True, quiet, huntrleaks, None, pgo)
+-                ok = runtest(test, True, quiet, huntrleaks, None, pgo,
+-                             testdir=testdir)
++                ok = _runtest(test, True, quiet, huntrleaks, None, pgo,
++                              testdir=testdir)
              except KeyboardInterrupt:
                  # print a newline separate from the ^C
                  print
-@@ -893,8 +937,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 @@
- from test.test_support import run_unittest, TESTFN, EnvironmentVarGuard
+@@ -9,6 +9,7 @@
  from test.test_support import captured_output
  import __builtin__
+ import errno
 +import imp
  import os
  import sys
  import re
-@@ -21,6 +22,9 @@
- # already.
- if "site" in sys.modules:
-     import site
+@@ -27,12 +28,19 @@
+ 
+ 
+ OLD_SYS_PATH = None
++OLD__PYTHONNOSITEPACKAGES = None
+ 
+ 
+ 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"]
 +        imp.reload(site)
- else:
-     raise unittest.SkipTest("importation of site.py suppressed")
++
+     if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE):
+         # need to add user site directory for tests
+         try:
+@@ -49,6 +57,8 @@
+ 
+ def tearDownModule():
+     sys.path[:] = OLD_SYS_PATH
++    if OLD__PYTHONNOSITEPACKAGES is not None:
++        os.environ["_PYTHONNOSITEPACKAGES"] = OLD__PYTHONNOSITEPACKAGES
+ 
  
+ class HelperFunctionsTests(unittest.TestCase):
 --- Makefile.pre.in
 +++ Makefile.pre.in
-@@ -881,7 +881,7 @@
+@@ -871,7 +871,7 @@
  
  TESTOPTS=     -l $(EXTRATESTOPTS)
  TESTPROG=     $(srcdir)/Lib/test/regrtest.py
 -TESTPYTHON=   $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
 +TESTPYTHON=   _PYTHONNOSITEPACKAGES=1 $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E 
-tt $(TESTPYTHONOPTS)
- test:         all platform
+ test:         @DEF_MAKE_RULE@ platform
                -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
                -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)

Reply via email to