Compare commits

..

15 Commits
master ... f26

Author SHA1 Message Date
Miro Hrončok 30f9dc6ace Fix broken SSL module (#1555081) 2018-03-14 14:08:55 +01:00
Charalampos Stratakis b3ef145e9d Do not send IP addresses in SNI TLS extension 2018-03-13 18:20:30 +01:00
Miro Hrončok f82502dfc9 Move test.support and test.script_helper to python2-libs
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1528899

When moving files around, explicit conflicts should be added, however
the dependency chain here (python2-test requires exact version-release of
python2, python2 requires exact version-release of python2-libs) prevents
instalation of python2-libs with greater version-release than python2-test.
2018-02-17 11:31:31 +01:00
Charalampos Stratakis 204fab2df4 Fix hanging of all threads when trying to access an inaccessible NFS server.
Also mask some macros in comments.
2017-12-11 15:25:49 +01:00
Miro Hrončok 34b7e5bfcb Make the -devel package require redhat-rpm-config
Resolves: rhbz#1496757
2017-11-10 14:09:13 +01:00
Charalampos Stratakis b9637a682d Fix nondeterministic read in test_pty 2017-11-02 16:47:18 +01:00
Charalampos Stratakis 1279ca3068 Add a new PYTHONSHOWREFCOUNT environment variable which when set
prints the number of references when using the debug build.
2017-11-02 16:47:10 +01:00
Iryna Shcherbina a8ced1c5b0 Add patches for failing tests
- Replace COUNT_ALLOCS patches with upstreamed one
  (patches added: 283; patches removed: 125, 134, 135, 141)
  https://bugs.python.org/issue31692
- Add a patch to skip a failing test on s390x: 280
  https://bugs.python.org/issue31719
2017-10-31 15:23:59 +01:00
Iryna Shcherbina f50e49e7fb Update to 2.7.14
- Refactored patches: 55, 112, 153
- Upstreamed patches: 250, 269, 270
2017-10-31 15:23:45 +01:00
Carl George 5d23a875c3 drop patch 173
This was resolved upstream in 3.3/3.4.  The fix was later backported to 2.7.7rc1.

https://bugs.python.org/issue19901
d82634d606
https://github.com/python/cpython/blob/2.7/Misc/NEWS.d/2.7.7rc1.rst
2017-10-31 15:22:07 +01:00
Michal Cyprian 15f65c3dc8 Revert "Add --executable option to install.py command"
This enhancement is currently not needed and it can possibly
collide with `pip --editable`option

Reverts commit 8043ae7719.
2017-08-11 09:45:26 +02:00
Charalampos Stratakis e000835995 Provide additional reference for patch 252 2017-06-28 15:51:02 +02:00
Charalampos Stratakis 4880661991 Fix test_alpn_protocols from test_ssl 2017-06-26 11:54:20 +02:00
Miro Hrončok 2187e4186e Change fixed Obsoletes version with a dynamic one (rhbz#1457336) 2017-05-31 19:35:22 +02:00
Karsten Hopp 0268e32375 revert logic for modularity patch and enable gdbm for modularity 2017-05-18 14:15:22 +02:00
20 changed files with 1172 additions and 608 deletions

View File

@ -20,10 +20,10 @@ index b9f1c6c..7b23714 100644
'scripts': '$base/bin',
'data' : '$base',
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 031f809..ec5d584 100644
index 068d1ba..3e7f077 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -120,8 +120,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
@@ -119,8 +119,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
@ -59,10 +59,10 @@ index c360802..868b7cb 100644
return sitepackages
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index b4384ee..349f688 100644
index d9a9324..e411e5c 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -254,17 +254,20 @@ class HelperFunctionsTests(unittest.TestCase):
@@ -235,17 +235,20 @@ class HelperFunctionsTests(unittest.TestCase):
self.assertEqual(dirs[0], wanted)
elif os.sep == '/':
# OS X, Linux, FreeBSD, etc
@ -86,12 +86,12 @@ index b4384ee..349f688 100644
+ wanted = os.path.join('xoxo', 'lib64', 'site-packages')
self.assertEqual(dirs[1], wanted)
def test_no_home_directory(self):
class PthFile(object):
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 4f59dd3..877698c 100644
index adae76b..ecb27f3 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -110,7 +110,7 @@ LIBDIR= @libdir@
@@ -111,7 +111,7 @@ LIBDIR= @libdir@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include
@ -101,18 +101,9 @@ index 4f59dd3..877698c 100644
# Detailed destination directories
BINLIBDEST= $(LIBDIR)/python$(VERSION)
diff --git a/Modules/Setup.dist b/Modules/Setup.dist
index 2cf35a9..c4c88cb 100644
index fbfa1c1..138fb33 100644
--- a/Modules/Setup.dist
+++ b/Modules/Setup.dist
@@ -231,7 +231,7 @@ crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
# Some more UNIX dependent modules -- off by default, since these
# are not supported by all UNIX systems:
-nis nismodule.c -lnsl -ltirpc -I/usr/include/tirpc -I/usr/include/nsl -L/usr/lib/nsl
+nis nismodule.c -lnsl -ltirpc -I/usr/include/tirpc -I/usr/include/nsl -L/usr/lib64/nsl
termios termios.c # Steen Lumholt's termios module
resource resource.c # Jeremy Hylton's rlimit interface
@@ -416,7 +416,7 @@ gdbm gdbmmodule.c -lgdbm
# Edit the variables DB and DBLIBVERto point to the db top directory
# and the subdirectory of PORT where you built it.
@ -130,7 +121,7 @@ index 2cf35a9..c4c88cb 100644
+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib64 -lz
# Interface to the Expat XML parser
# More information on Expat can be found at www.libexpat.org.
#
diff --git a/Modules/getpath.c b/Modules/getpath.c
index fd33a01..c5c86fd 100644
--- a/Modules/getpath.c
@ -154,7 +145,7 @@ index fd33a01..c5c86fd 100644
/* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */
diff --git a/setup.py b/setup.py
index 0288a6b..7905f6f 100644
index 99ac359..859b6c4 100644
--- a/setup.py
+++ b/setup.py
@@ -456,7 +456,7 @@ class PyBuildExt(build_ext):

View File

@ -1,7 +1,6 @@
diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst
index 91464ef..6ee64d6 100644
--- a/Doc/library/crypt.rst
+++ b/Doc/library/crypt.rst
diff -up Python-2.7.3/Doc/library/crypt.rst.crypt-module-salt-backport Python-2.7.3/Doc/library/crypt.rst
--- Python-2.7.3/Doc/library/crypt.rst.crypt-module-salt-backport 2012-04-09 19:07:28.000000000 -0400
+++ Python-2.7.3/Doc/library/crypt.rst 2013-02-19 16:44:20.465334062 -0500
@@ -16,9 +16,9 @@
This module implements an interface to the :manpage:`crypt(3)` routine, which is
@ -15,7 +14,7 @@ index 91464ef..6ee64d6 100644
.. index:: single: crypt(3)
@@ -27,15 +27,81 @@ the :manpage:`crypt(3)` routine in the running system. Therefore, any
@@ -27,15 +27,81 @@ the :manpage:`crypt(3)` routine in the r
extensions available on the current implementation will also be available on
this module.
@ -131,7 +130,7 @@ index 91464ef..6ee64d6 100644
A simple example illustrating typical use::
import crypt, getpass, pwd
@@ -59,3 +146,11 @@ A simple example illustrating typical use::
@@ -59,3 +146,11 @@ A simple example illustrating typical us
else:
return 1
@ -143,11 +142,9 @@ index 91464ef..6ee64d6 100644
+ hashed = crypt.crypt(plaintext)
+ if hashed != crypt.crypt(plaintext, hashed):
+ raise "Hashed version doesn't validate against original"
diff --git a/Lib/crypt.py b/Lib/crypt.py
new file mode 100644
index 0000000..bf0a416
--- /dev/null
+++ b/Lib/crypt.py
diff -up Python-2.7.3/Lib/crypt.py.crypt-module-salt-backport Python-2.7.3/Lib/crypt.py
--- Python-2.7.3/Lib/crypt.py.crypt-module-salt-backport 2013-02-19 16:44:20.465334062 -0500
+++ Python-2.7.3/Lib/crypt.py 2013-02-19 16:49:56.425311089 -0500
@@ -0,0 +1,71 @@
+"""Wrapper to the POSIX crypt library call and associated functionality.
+
@ -220,13 +217,12 @@ index 0000000..bf0a416
+methods.append(METHOD_CRYPT)
+del _result, _method
+
diff --git a/Lib/test/test_crypt.py b/Lib/test/test_crypt.py
index 7cd9c71..b061a55 100644
--- a/Lib/test/test_crypt.py
+++ b/Lib/test/test_crypt.py
@@ -16,6 +16,25 @@ class CryptTestCase(unittest.TestCase):
self.assertEqual(cr2, cr)
diff -up Python-2.7.3/Lib/test/test_crypt.py.crypt-module-salt-backport Python-2.7.3/Lib/test/test_crypt.py
--- Python-2.7.3/Lib/test/test_crypt.py.crypt-module-salt-backport 2012-04-09 19:07:31.000000000 -0400
+++ Python-2.7.3/Lib/test/test_crypt.py 2013-02-19 16:44:20.465334062 -0500
@@ -10,6 +10,25 @@ class CryptTestCase(unittest.TestCase):
if test_support.verbose:
print 'Test encryption: ', c
+ def test_salt(self):
+ self.assertEqual(len(crypt._saltchars), 64)
@ -250,23 +246,9 @@ index 7cd9c71..b061a55 100644
def test_main():
test_support.run_unittest(CryptTestCase)
diff --git a/Modules/Setup.dist b/Modules/Setup.dist
index 2712f06..3ea4f0c 100644
--- a/Modules/Setup.dist
+++ b/Modules/Setup.dist
@@ -225,7 +225,7 @@ _ssl _ssl.c \
#
# First, look at Setup.config; configure may have set this for you.
-crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
+_crypt _cryptmodule.c -lcrypt # crypt(3); needs -lcrypt on some systems
# Some more UNIX dependent modules -- off by default, since these
diff --git a/Modules/cryptmodule.c b/Modules/cryptmodule.c
index 76de54f..7c69ca6 100644
--- a/Modules/cryptmodule.c
+++ b/Modules/cryptmodule.c
diff -up Python-2.7.3/Modules/cryptmodule.c.crypt-module-salt-backport Python-2.7.3/Modules/cryptmodule.c
--- Python-2.7.3/Modules/cryptmodule.c.crypt-module-salt-backport 2012-04-09 19:07:34.000000000 -0400
+++ Python-2.7.3/Modules/cryptmodule.c 2013-02-19 16:44:20.466334063 -0500
@@ -43,7 +43,7 @@ static PyMethodDef crypt_methods[] = {
};
@ -277,11 +259,22 @@ index 76de54f..7c69ca6 100644
- Py_InitModule("crypt", crypt_methods);
+ Py_InitModule("_crypt", crypt_methods);
}
diff --git a/setup.py b/setup.py
index b787487..c60ac35 100644
--- a/setup.py
+++ b/setup.py
@@ -798,7 +798,7 @@ class PyBuildExt(build_ext):
diff -up Python-2.7.3/Modules/Setup.dist.crypt-module-salt-backport Python-2.7.3/Modules/Setup.dist
--- Python-2.7.3/Modules/Setup.dist.crypt-module-salt-backport 2013-02-19 16:44:20.463334063 -0500
+++ Python-2.7.3/Modules/Setup.dist 2013-02-19 16:44:20.466334063 -0500
@@ -221,7 +221,7 @@ _ssl _ssl.c \
#
# First, look at Setup.config; configure may have set this for you.
-crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems
+_crypt _cryptmodule.c -lcrypt # crypt(3); needs -lcrypt on some systems
# Some more UNIX dependent modules -- off by default, since these
diff -up Python-2.7.3/setup.py.crypt-module-salt-backport Python-2.7.3/setup.py
--- Python-2.7.3/setup.py.crypt-module-salt-backport 2013-02-19 16:44:20.425334067 -0500
+++ Python-2.7.3/setup.py 2013-02-19 16:44:20.466334063 -0500
@@ -693,7 +693,7 @@ class PyBuildExt(build_ext):
libs = ['crypt']
else:
libs = []

View File

@ -1,18 +1,16 @@
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 7e47b2d..12a210d 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -1,7 +1,8 @@
diff -up Python-2.7.3/Lib/test/test_gc.py.gc-assertions Python-2.7.3/Lib/test/test_gc.py
--- Python-2.7.3/Lib/test/test_gc.py.gc-assertions 2013-02-20 16:28:20.890536607 -0500
+++ Python-2.7.3/Lib/test/test_gc.py 2013-02-20 16:39:52.720489297 -0500
@@ -1,6 +1,7 @@
import unittest
from test.support import (verbose, run_unittest, start_threads,
- requires_type_collecting)
+ requires_type_collecting, import_module)
-from test.test_support import verbose, run_unittest, start_threads
+from test.test_support import verbose, run_unittest, start_threads, import_module
import sys
+import sysconfig
import time
import gc
import weakref
@@ -39,6 +40,8 @@ class GC_Detector(object):
@@ -32,6 +33,8 @@ class GC_Detector(object):
self.wr = weakref.ref(C1055820(666), it_happened)
@ -21,7 +19,7 @@ index 7e47b2d..12a210d 100644
### Tests
###############################################################################
@@ -537,6 +540,49 @@ class GCTests(unittest.TestCase):
@@ -476,6 +479,49 @@ class GCTests(unittest.TestCase):
# would be damaged, with an empty __dict__.
self.assertEqual(x, None)
@ -71,10 +69,9 @@ index 7e47b2d..12a210d 100644
class GCTogglingTests(unittest.TestCase):
def setUp(self):
gc.enable()
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 916e481..0233ce2 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
diff -up Python-2.7.3/Modules/gcmodule.c.gc-assertions Python-2.7.3/Modules/gcmodule.c
--- Python-2.7.3/Modules/gcmodule.c.gc-assertions 2012-04-09 19:07:34.000000000 -0400
+++ Python-2.7.3/Modules/gcmodule.c 2013-02-20 16:28:21.029536600 -0500
@@ -21,6 +21,73 @@
#include "Python.h"
#include "frameobject.h" /* for PyFrame_ClearFreeList */
@ -149,7 +146,7 @@ index 916e481..0233ce2 100644
/* Get an object's GC head */
#define AS_GC(o) ((PyGC_Head *)(o)-1)
@@ -328,7 +395,8 @@ update_refs(PyGC_Head *containers)
@@ -288,7 +355,8 @@ update_refs(PyGC_Head *containers)
{
PyGC_Head *gc = containers->gc.gc_next;
for (; gc != containers; gc = gc->gc.gc_next) {
@ -159,7 +156,7 @@ index 916e481..0233ce2 100644
gc->gc.gc_refs = Py_REFCNT(FROM_GC(gc));
/* Python's cyclic gc should never see an incoming refcount
* of 0: if something decref'ed to 0, it should have been
@@ -348,7 +416,8 @@ update_refs(PyGC_Head *containers)
@@ -308,7 +376,8 @@ update_refs(PyGC_Head *containers)
* so serious that maybe this should be a release-build
* check instead of an assert?
*/
@ -169,7 +166,7 @@ index 916e481..0233ce2 100644
}
}
@@ -363,7 +432,9 @@ visit_decref(PyObject *op, void *data)
@@ -323,7 +392,9 @@ visit_decref(PyObject *op, void *data)
* generation being collected, which can be recognized
* because only they have positive gc_refs.
*/
@ -180,7 +177,7 @@ index 916e481..0233ce2 100644
if (gc->gc.gc_refs > 0)
gc->gc.gc_refs--;
}
@@ -423,9 +494,10 @@ visit_reachable(PyObject *op, PyGC_Head *reachable)
@@ -383,9 +454,10 @@ visit_reachable(PyObject *op, PyGC_Head
* If gc_refs == GC_UNTRACKED, it must be ignored.
*/
else {
@ -194,7 +191,7 @@ index 916e481..0233ce2 100644
}
}
return 0;
@@ -467,7 +539,7 @@ move_unreachable(PyGC_Head *young, PyGC_Head *unreachable)
@@ -427,7 +499,7 @@ move_unreachable(PyGC_Head *young, PyGC_
*/
PyObject *op = FROM_GC(gc);
traverseproc traverse = Py_TYPE(op)->tp_traverse;
@ -203,7 +200,7 @@ index 916e481..0233ce2 100644
gc->gc.gc_refs = GC_REACHABLE;
(void) traverse(op,
(visitproc)visit_reachable,
@@ -545,7 +617,8 @@ move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers)
@@ -494,7 +566,8 @@ move_finalizers(PyGC_Head *unreachable,
for (gc = unreachable->gc.gc_next; gc != unreachable; gc = next) {
PyObject *op = FROM_GC(gc);
@ -213,7 +210,7 @@ index 916e481..0233ce2 100644
next = gc->gc.gc_next;
if (has_finalizer(op)) {
@@ -621,7 +694,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
@@ -570,7 +643,7 @@ handle_weakrefs(PyGC_Head *unreachable,
PyWeakReference **wrlist;
op = FROM_GC(gc);
@ -222,7 +219,7 @@ index 916e481..0233ce2 100644
next = gc->gc.gc_next;
if (! PyType_SUPPORTS_WEAKREFS(Py_TYPE(op)))
@@ -642,9 +715,9 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
@@ -591,9 +664,9 @@ handle_weakrefs(PyGC_Head *unreachable,
* the callback pointer intact. Obscure: it also
* changes *wrlist.
*/
@ -234,7 +231,7 @@ index 916e481..0233ce2 100644
if (wr->wr_callback == NULL)
continue; /* no callback */
@@ -678,7 +751,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
@@ -627,7 +700,7 @@ handle_weakrefs(PyGC_Head *unreachable,
*/
if (IS_TENTATIVELY_UNREACHABLE(wr))
continue;
@ -243,7 +240,7 @@ index 916e481..0233ce2 100644
/* Create a new reference so that wr can't go away
* before we can process it again.
@@ -687,7 +760,8 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
@@ -636,7 +709,8 @@ handle_weakrefs(PyGC_Head *unreachable,
/* Move wr to wrcb_to_call, for the next pass. */
wrasgc = AS_GC(wr);
@ -253,7 +250,7 @@ index 916e481..0233ce2 100644
next isn't, so they can't
be the same */
gc_list_move(wrasgc, &wrcb_to_call);
@@ -703,11 +777,11 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
@@ -652,11 +726,11 @@ handle_weakrefs(PyGC_Head *unreachable,
gc = wrcb_to_call.gc.gc_next;
op = FROM_GC(gc);
@ -268,7 +265,7 @@ index 916e481..0233ce2 100644
/* copy-paste of weakrefobject.c's handle_callback() */
temp = PyObject_CallFunctionObjArgs(callback, wr, NULL);
@@ -810,7 +884,7 @@ delete_garbage(PyGC_Head *collectable, PyGC_Head *old)
@@ -759,7 +833,7 @@ delete_garbage(PyGC_Head *collectable, P
PyGC_Head *gc = collectable->gc.gc_next;
PyObject *op = FROM_GC(gc);

View File

@ -0,0 +1,11 @@
--- Python-2.7.5-orig/Tools/gdb/libpython.py 2013-05-12 03:32:54.000000000 +0000
+++ Python-2.7.5-orig/Tools/gdb/libpython.py 2013-09-15 09:56:25.494000000 +0000
@@ -887,6 +887,8 @@
newline character'''
if self.is_optimized_out():
return '(frame information optimized out)'
+ if self.filename() == '<string>':
+ return '(in an eval block)'
filename = self.filename()
try:
f = open(filename, 'r')

View File

@ -1,70 +0,0 @@
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
index 5021ebf..1903cc0 100644
--- a/Lib/ensurepip/__init__.py
+++ b/Lib/ensurepip/__init__.py
@@ -1,9 +1,10 @@
#!/usr/bin/env python2
from __future__ import print_function
+import distutils.version
+import glob
import os
import os.path
-import pkgutil
import shutil
import sys
import tempfile
@@ -12,9 +13,19 @@ import tempfile
__all__ = ["version", "bootstrap"]
-_SETUPTOOLS_VERSION = "40.6.2"
+_WHEEL_DIR = "/usr/share/python-wheels/"
-_PIP_VERSION = "18.1"
+def _get_most_recent_wheel_version(pkg):
+ prefix = os.path.join(_WHEEL_DIR, "{}-".format(pkg))
+ suffix = "-py2.py3-none-any.whl"
+ pattern = "{}*{}".format(prefix, suffix)
+ versions = (p[len(prefix):-len(suffix)] for p in glob.glob(pattern))
+ return str(max(versions, key=distutils.version.LooseVersion))
+
+
+_SETUPTOOLS_VERSION = _get_most_recent_wheel_version("setuptools")
+
+_PIP_VERSION = _get_most_recent_wheel_version("pip")
_PROJECTS = [
("setuptools", _SETUPTOOLS_VERSION),
@@ -28,8 +39,13 @@ def _run_pip(args, additional_paths=None):
sys.path = additional_paths + sys.path
# Install the bundled software
- import pip._internal
- return pip._internal.main(args)
+ try:
+ # pip 10
+ from pip._internal import main
+ except ImportError:
+ # pip 9
+ from pip import main
+ return main(args)
def version():
@@ -100,12 +116,9 @@ def _bootstrap(root=None, upgrade=False, user=False,
additional_paths = []
for project, version in _PROJECTS:
wheel_name = "{}-{}-py2.py3-none-any.whl".format(project, version)
- whl = pkgutil.get_data(
- "ensurepip",
- "_bundled/{}".format(wheel_name),
- )
- with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
- fp.write(whl)
+ with open(os.path.join(_WHEEL_DIR, wheel_name), "rb") as sfp:
+ with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
+ fp.write(sfp.read())
additional_paths.append(os.path.join(tmpdir, wheel_name))

View File

@ -1,14 +0,0 @@
diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py
index 9def56e..c0df208 100755
--- a/Tools/gdb/libpython.py
+++ b/Tools/gdb/libpython.py
@@ -939,6 +939,9 @@ class PyFrameObjectPtr(PyObjectPtr):
if self.is_optimized_out():
return '(frame information optimized out)'
+ if self.filename() == '<string>':
+ return '(in an eval block)'
+
lineno = self.current_line_num()
if lineno is None:
return '(failed to get frame line number)'

View File

@ -0,0 +1,249 @@
diff --git a/Lib/ensurepip/__init__.py b/Lib/ensurepip/__init__.py
index 14c9adb..e20104e 100644
--- a/Lib/ensurepip/__init__.py
+++ b/Lib/ensurepip/__init__.py
@@ -7,6 +7,7 @@ import pkgutil
import shutil
import sys
import tempfile
+from ensurepip import rewheel
__all__ = ["version", "bootstrap"]
@@ -43,6 +44,8 @@ def _run_pip(args, additional_paths=None):
# Install the bundled software
import pip
+ if args[0] in ["install", "list", "wheel"]:
+ args.append('--pre')
pip.main(args)
@@ -93,21 +96,40 @@ def bootstrap(root=None, upgrade=False, user=False,
# omit pip and easy_install
os.environ["ENSUREPIP_OPTIONS"] = "install"
+ whls = []
+ rewheel_dir = None
+ # try to see if we have system-wide versions of _PROJECTS
+ dep_records = rewheel.find_system_records([p[0] for p in _PROJECTS])
+ # TODO: check if system-wide versions are the newest ones
+ # if --upgrade is used?
+ if all(dep_records):
+ # if we have all _PROJECTS installed system-wide, we'll recreate
+ # wheels from them and install those
+ rewheel_dir = tempfile.mkdtemp()
+ for dr in dep_records:
+ new_whl = rewheel.rewheel_from_record(dr, rewheel_dir)
+ whls.append(os.path.join(rewheel_dir, new_whl))
+ else:
+ # if we don't have all the _PROJECTS installed system-wide,
+ # let's just fall back to bundled wheels
+ for project, version in _PROJECTS:
+ whl = os.path.join(
+ os.path.dirname(__file__),
+ "_bundled",
+ "{}-{}-py2.py3-none-any.whl".format(project, version)
+ )
+ whls.append(whl)
+
tmpdir = tempfile.mkdtemp()
try:
# Put our bundled wheels into a temporary directory and construct the
# additional paths that need added to sys.path
additional_paths = []
- for project, version in _PROJECTS:
- wheel_name = "{}-{}-py2.py3-none-any.whl".format(project, version)
- whl = pkgutil.get_data(
- "ensurepip",
- "_bundled/{}".format(wheel_name),
- )
- with open(os.path.join(tmpdir, wheel_name), "wb") as fp:
- fp.write(whl)
-
- additional_paths.append(os.path.join(tmpdir, wheel_name))
+ for whl in whls:
+ shutil.copy(whl, tmpdir)
+ additional_paths.append(os.path.join(tmpdir, os.path.basename(whl)))
+ if rewheel_dir:
+ shutil.rmtree(rewheel_dir)
# Construct the arguments to be passed to the pip command
args = ["install", "--no-index", "--find-links", tmpdir]
diff --git a/Lib/ensurepip/rewheel/__init__.py b/Lib/ensurepip/rewheel/__init__.py
new file mode 100644
index 0000000..75c2094
--- /dev/null
+++ b/Lib/ensurepip/rewheel/__init__.py
@@ -0,0 +1,158 @@
+import argparse
+import codecs
+import csv
+import email.parser
+import os
+import io
+import re
+import site
+import subprocess
+import sys
+import zipfile
+
+def run():
+ parser = argparse.ArgumentParser(description='Recreate wheel of package with given RECORD.')
+ parser.add_argument('record_path',
+ help='Path to RECORD file')
+ parser.add_argument('-o', '--output-dir',
+ help='Dir where to place the wheel, defaults to current working dir.',
+ dest='outdir',
+ default=os.path.curdir)
+
+ ns = parser.parse_args()
+ retcode = 0
+ try:
+ print(rewheel_from_record(**vars(ns)))
+ except BaseException as e:
+ print('Failed: {}'.format(e))
+ retcode = 1
+ sys.exit(1)
+
+def find_system_records(projects):
+ """Return list of paths to RECORD files for system-installed projects.
+
+ If a project is not installed, the resulting list contains None instead
+ of a path to its RECORD
+ """
+ records = []
+ # get system site-packages dirs
+ if hasattr(sys, 'real_prefix'):
+ #we are in python2 virtualenv and sys.real_prefix is the original sys.prefix
+ _orig_prefixes = site.PREFIXES
+ setattr(site, 'PREFIXES', [sys.real_prefix]*2)
+ sys_sitepack = site.getsitepackages()
+ setattr(site, 'PREFIXES', _orig_prefixes)
+ elif hasattr(sys, 'base_prefix'): # python3 venv doesn't inject real_prefix to sys
+ # we are on python3 and base(_exec)_prefix is unchanged in venv
+ sys_sitepack = site.getsitepackages([sys.base_prefix, sys.base_exec_prefix])
+ else:
+ # we are in python2 without virtualenv
+ sys_sitepack = site.getsitepackages()
+
+ sys_sitepack = [sp for sp in sys_sitepack if os.path.exists(sp)]
+ # try to find all projects in all system site-packages
+ for project in projects:
+ path = None
+ for sp in sys_sitepack:
+ dist_info_re = os.path.join(sp, project) + '-[^\{0}]+\.dist-info'.format(os.sep)
+ candidates = [os.path.join(sp, p) for p in os.listdir(sp)]
+ # filter out candidate dirs based on the above regexp
+ filtered = [c for c in candidates if re.match(dist_info_re, c)]
+ # if we have 0 or 2 or more dirs, something is wrong...
+ if len(filtered) == 1:
+ path = filtered[0]
+ if path is not None:
+ records.append(os.path.join(path, 'RECORD'))
+ else:
+ records.append(None)
+ return records
+
+def rewheel_from_record(record_path, outdir):
+ """Recreates a whee of package with given record_path and returns path
+ to the newly created wheel."""
+ site_dir = os.path.dirname(os.path.dirname(record_path))
+ record_relpath = record_path[len(site_dir):].strip(os.path.sep)
+ to_write, to_omit = get_records_to_pack(site_dir, record_relpath)
+ new_wheel_name = get_wheel_name(record_path)
+ new_wheel_path = os.path.join(outdir, new_wheel_name + '.whl')
+
+ new_wheel = zipfile.ZipFile(new_wheel_path, mode='w', compression=zipfile.ZIP_DEFLATED)
+ # we need to write a new record with just the files that we will write,
+ # e.g. not binaries and *.pyc/*.pyo files
+ if sys.version_info[0] < 3:
+ new_record = io.BytesIO()
+ else:
+ new_record = io.StringIO()
+ writer = csv.writer(new_record)
+
+ # handle files that we can write straight away
+ for f, sha_hash, size in to_write:
+ new_wheel.write(os.path.join(site_dir, f), arcname=f)
+ writer.writerow([f, sha_hash,size])
+
+ # rewrite the old wheel file with a new computed one
+ writer.writerow([record_relpath, '', ''])
+ new_wheel.writestr(record_relpath, new_record.getvalue())
+
+ new_wheel.close()
+
+ return new_wheel.filename
+
+def get_wheel_name(record_path):
+ """Return proper name of the wheel, without .whl."""
+
+ wheel_info_path = os.path.join(os.path.dirname(record_path), 'WHEEL')
+ with codecs.open(wheel_info_path, encoding='utf-8') as wheel_info_file:
+ wheel_info = email.parser.Parser().parsestr(wheel_info_file.read().encode('utf-8'))
+
+ metadata_path = os.path.join(os.path.dirname(record_path), 'METADATA')
+ with codecs.open(metadata_path, encoding='utf-8') as metadata_file:
+ metadata = email.parser.Parser().parsestr(metadata_file.read().encode('utf-8'))
+
+ # construct name parts according to wheel spec
+ distribution = metadata.get('Name')
+ version = metadata.get('Version')
+ build_tag = '' # nothing for now
+ lang_tag = []
+ for t in wheel_info.get_all('Tag'):
+ lang_tag.append(t.split('-')[0])
+ lang_tag = '.'.join(lang_tag)
+ abi_tag, plat_tag = wheel_info.get('Tag').split('-')[1:3]
+ # leave out build tag, if it is empty
+ to_join = filter(None, [distribution, version, build_tag, lang_tag, abi_tag, plat_tag])
+ return '-'.join(list(to_join))
+
+def get_records_to_pack(site_dir, record_relpath):
+ """Accepts path of sitedir and path of RECORD file relative to it.
+ Returns two lists:
+ - list of files that can be written to new RECORD straight away
+ - list of files that shouldn't be written or need some processing
+ (pyc and pyo files, scripts)
+ """
+ record_file_path = os.path.join(site_dir, record_relpath)
+ with codecs.open(record_file_path, encoding='utf-8') as record_file:
+ record_contents = record_file.read()
+ # temporary fix for https://github.com/pypa/pip/issues/1376
+ # we need to ignore files under ".data" directory
+ data_dir = os.path.dirname(record_relpath).strip(os.path.sep)
+ data_dir = data_dir[:-len('dist-info')] + 'data'
+
+ to_write = []
+ to_omit = []
+ for l in record_contents.splitlines():
+ spl = l.split(',')
+ if len(spl) == 3:
+ # new record will omit (or write differently):
+ # - abs paths, paths with ".." (entry points),
+ # - pyc+pyo files
+ # - the old RECORD file
+ # TODO: is there any better way to recognize an entry point?
+ if os.path.isabs(spl[0]) or spl[0].startswith('..') or \
+ spl[0].endswith('.pyc') or spl[0].endswith('.pyo') or \
+ spl[0] == record_relpath or spl[0].startswith(data_dir):
+ to_omit.append(spl)
+ else:
+ to_write.append(spl)
+ else:
+ pass # bad RECORD or empty line
+ return to_write, to_omit
diff --git a/Makefile.pre.in b/Makefile.pre.in
index ca33158..44bdde5 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1066,7 +1066,7 @@ LIBSUBDIRS= lib-tk lib-tk/test lib-tk/test/test_tkinter \
test/tracedmodules \
encodings compiler hotshot \
email email/mime email/test email/test/data \
- ensurepip ensurepip/_bundled \
+ ensurepip ensurepip/_bundled ensurepip/rewheel\
json json/tests \
sqlite3 sqlite3/test \
logging bsddb bsddb/test csv importlib wsgiref \

View File

@ -0,0 +1,88 @@
From ab35adc682ec51800aa19a77de9947c6aaa50f41 Mon Sep 17 00:00:00 2001
From: Victor Stinner <victor.stinner@gmail.com>
Date: Fri, 6 Oct 2017 22:28:59 +0200
Subject: [PATCH] bpo-31719: Fix test_regrtest.test_crashed() on s390x
Add a new _testcapi._read_null() function to crash Python in a
reliable way on s390x.
On s390x, ctypes.string_at(0) returns an empty string rather than
crashing.
---
Lib/test/support/__init__.py | 4 ++--
Lib/test/test_regrtest.py | 2 ++
.../next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst | 3 +++
Modules/_testcapimodule.c | 17 +++++++++++++++++
4 files changed, 24 insertions(+), 2 deletions(-)
create mode 100644 Misc/NEWS.d/next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index ef474e00b68..25df3ed0c41 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1960,6 +1960,6 @@ def _crash_python():
Use SuppressCrashReport() to prevent a crash report from popping up.
"""
- import ctypes
+ import _testcapi
with SuppressCrashReport():
- ctypes.string_at(0)
+ _testcapi._read_null()
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 264c74d22ba..aae274384c7 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -543,6 +543,8 @@ def test_method2(self):
testname)
self.assertEqual(output.splitlines(), all_methods)
+ @unittest.skipIf(sys.platform.startswith('aix'),
+ "support._crash_python() doesn't work on AIX")
def test_crashed(self):
# Any code which causes a crash
code = 'import test.support; test.support._crash_python()'
diff --git a/Misc/NEWS.d/next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst b/Misc/NEWS.d/next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst
new file mode 100644
index 00000000000..a06c5267251
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst
@@ -0,0 +1,3 @@
+Fix test_regrtest.test_crashed() on s390x. Add a new _testcapi._read_null()
+function to crash Python in a reliable way on s390x. On s390x,
+ctypes.string_at(0) returns an empty string rather than crashing.
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 7691b5188ff..5902de07823 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2566,6 +2566,22 @@ py_w_stopcode(PyObject *self, PyObject *args)
#endif
+/* Read memory from NULL (address 0) to raise a SIGSEGV or SIGBUS signal
+ depending on the platform. This function is used by
+ test.support._crash_python() to "crash" Python. */
+static PyObject *
+read_null(PyObject *self, PyObject *args)
+{
+ volatile int *x;
+ volatile int y;
+
+ x = NULL;
+ y = *x;
+ return PyLong_FromLong(y);
+
+}
+
+
static PyMethodDef TestMethods[] = {
{"raise_exception", raise_exception, METH_VARARGS},
{"set_errno", set_errno, METH_VARARGS},
@@ -2685,6 +2701,7 @@ static PyMethodDef TestMethods[] = {
#ifdef W_STOPCODE
{"W_STOPCODE", py_w_stopcode, METH_VARARGS},
#endif
+ {"_read_null", (PyCFunction)read_null, METH_NOARGS},
{NULL, NULL} /* sentinel */
};

View File

@ -0,0 +1,184 @@
From 7b4ba62e388474e811268322b47f80d464933541 Mon Sep 17 00:00:00 2001
From: Victor Stinner <victor.stinner@gmail.com>
Date: Tue, 17 Oct 2017 02:25:23 -0700
Subject: [PATCH] [2.7] bpo-31692: Add PYTHONSHOWALLOCCOUNT env var (GH-3927)
bpo-31692, bpo-19527:
* Add a new PYTHONSHOWALLOCCOUNT environment variable, similar to
the Python 3 "-X showalloccount" option
* When Python is compiled with COUNT_ALLOCS, the new
PYTHONSHOWALLOCCOUNT environment variable now has to be set to dump
allocation counts into stderr on shutdown. Moreover, allocations
statistics are now dumped into stderr rather than stdout.
* Add @test.support.requires_type_collecting decorator: skip test if
COUNT_ALLOCS is defined
* Fix tests for COUNT_ALLOCS: decorate some methods with
@requires_type_collecting
* test_sys.test_objecttypes(): update object type when COUNT_ALLOCS
is defined
---
Doc/c-api/typeobj.rst | 2 +-
Doc/using/cmdline.rst | 7 +++++++
Lib/test/support/__init__.py | 3 +++
Lib/test/test_abc.py | 1 +
Lib/test/test_gc.py | 4 +++-
Lib/test/test_regrtest.py | 1 +
Lib/test/test_sys.py | 5 ++++-
Lib/test/test_weakref.py | 1 +
.../Core and Builtins/2017-10-09-11-03-13.bpo-31692.5-bpdk.rst | 4 ++++
Python/pythonrun.c | 4 +++-
10 files changed, 28 insertions(+), 4 deletions(-)
create mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-09-11-03-13.bpo-31692.5-bpdk.rst
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index 18edcdd7e5a..f0ccf2ea5fe 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -1101,7 +1101,7 @@ The next fields, up to and including :c:member:`~PyTypeObject.tp_weaklist`, only
The remaining fields are only defined if the feature test macro
:const:`COUNT_ALLOCS` is defined, and are for internal use only. They are
documented here for completeness. None of these fields are inherited by
-subtypes.
+subtypes. See the :envvar:`PYTHONSHOWALLOCCOUNT` environment variable.
.. c:member:: Py_ssize_t PyTypeObject.tp_allocs
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index f00f7f6026a..55bc12893d6 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -663,3 +663,10 @@ if Python was configured with the ``--with-pydebug`` build option.
If set, Python will print memory allocation statistics every time a new
object arena is created, and on shutdown.
+
+.. envvar:: PYTHONSHOWALLOCCOUNT
+
+ If set and Python was compiled with ``COUNT_ALLOCS`` defined, Python will
+ dump allocations counts into stderr on shutdown.
+
+ .. versionadded:: 2.7.15
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst
index 28a8d4b..f0d2428 100644
--- a/Doc/whatsnew/2.7.rst
+++ b/Doc/whatsnew/2.7.rst
@@ -2540,6 +2540,17 @@ exemption allowing new ``-3`` warnings to be added in any Python 2.7
maintenance release.
+Two new environment variables for debug mode
+--------------------------------------------
+
+When Python is compiled with ``COUNT_ALLOC`` defined, allocation counts are no
+longer dumped by default anymore: the :envvar:`PYTHONSHOWALLOCCOUNT` environment
+variable must now also be set. Moreover, allocation counts are now dumped into
+stderr, rather than stdout. (Contributed by Victor Stinner; :issue:`31692`.)
+
+.. versionadded:: 2.7.15
+
+
PEP 434: IDLE Enhancement Exception for All Branches
----------------------------------------------------
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 25df3ed0c41..d14a6620b5d 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1795,6 +1795,9 @@ def py3k_bytes(b):
except TypeError:
return bytes(b)
+requires_type_collecting = unittest.skipIf(hasattr(sys, 'getcounts'),
+ 'types are immortal if COUNT_ALLOCS is defined')
+
def args_from_interpreter_flags():
"""Return a list of command-line arguments reproducing the current
settings in sys.flags."""
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index 6a8c3a13274..dbba37cdb6f 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -208,6 +208,7 @@ class C(A, B):
C()
self.assertEqual(B.counter, 1)
+ @test_support.requires_type_collecting
def test_cache_leak(self):
# See issue #2521.
class A(object):
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index ed01c9802fc..7e47b2d3a27 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -1,5 +1,6 @@
import unittest
-from test.test_support import verbose, run_unittest, start_threads, import_module
+from test.support import (verbose, run_unittest, start_threads, import_module,
+ requires_type_collecting)
import sys
import sysconfig
import time
@@ -90,6 +91,7 @@ class A:
del a
self.assertNotEqual(gc.collect(), 0)
+ @requires_type_collecting
def test_newinstance(self):
class A(object):
pass
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index aae274384c7..988a72c1099 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -493,6 +493,7 @@ def check_leak(self, code, what):
self.assertIn(line2, reflog)
@unittest.skipUnless(Py_DEBUG, 'need a debug build')
+ @support.requires_type_collecting
def test_huntrleaks(self):
# test --huntrleaks
code = textwrap.dedent("""
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 5baaa352c0b..9342716272a 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -748,7 +748,10 @@ def delx(self): del self.__x
# tupleiterator
check(iter(()), size('lP'))
# type
- s = vsize('P2P15Pl4PP9PP11PI' # PyTypeObject
+ fmt = 'P2P15Pl4PP9PP11PI'
+ if hasattr(sys, 'getcounts'):
+ fmt += '3P2P'
+ s = vsize(fmt + # PyTypeObject
'39P' # PyNumberMethods
'3P' # PyMappingMethods
'10P' # PySequenceMethods
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 415d5ebbd72..418481dadd8 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -601,6 +601,7 @@ class D:
del c1, c2, C, D
gc.collect()
+ @test_support.requires_type_collecting
def test_callback_in_cycle_resurrection(self):
import gc
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 677f6e48111..44fe13d2f7d 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -488,7 +488,9 @@ Py_Finalize(void)
/* Debugging stuff */
#ifdef COUNT_ALLOCS
- dump_counts(stdout);
+ if (Py_GETENV("PYTHONSHOWALLOCCOUNT")) {
+ dump_counts(stderr);
+ }
#endif
PRINT_TOTAL_REFS();

View File

@ -0,0 +1,92 @@
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index 55bc128..15d5830 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -664,6 +664,13 @@ if Python was configured with the ``--with-pydebug`` build option.
If set, Python will print memory allocation statistics every time a new
object arena is created, and on shutdown.
+.. envvar:: PYTHONSHOWREFCOUNT
+
+ If set, Python will print the total reference count when the program
+ finishes or after each statement in the interactive interpreter.
+
+ .. versionadded:: 2.7.15
+
.. envvar:: PYTHONSHOWALLOCCOUNT
If set and Python was compiled with ``COUNT_ALLOCS`` defined, Python will
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst
index f0d2428..b29593a 100644
--- a/Doc/whatsnew/2.7.rst
+++ b/Doc/whatsnew/2.7.rst
@@ -2548,6 +2548,10 @@ longer dumped by default anymore: the :envvar:`PYTHONSHOWALLOCCOUNT` environment
variable must now also be set. Moreover, allocation counts are now dumped into
stderr, rather than stdout. (Contributed by Victor Stinner; :issue:`31692`.)
+In debug mode, the ``[xxx refs]`` statistic is not written by default, the
+:envvar:`PYTHONSHOWREFCOUNT` environment variable now must also be set.
+(Contributed by Victor Stinner; :issue:`31733`.)
+
.. versionadded:: 2.7.15
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index d17f7f3..eb31e34 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -37,14 +37,6 @@
#include "windows.h"
#endif
-#ifndef Py_REF_DEBUG
-#define PRINT_TOTAL_REFS()
-#else /* Py_REF_DEBUG */
-#define PRINT_TOTAL_REFS() fprintf(stderr, \
- "[%" PY_FORMAT_SIZE_T "d refs]\n", \
- _Py_GetRefTotal())
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -104,6 +96,21 @@ PyModule_GetWarningsModule(void)
return PyImport_ImportModule("warnings");
}
+static void
+_PyDebug_PrintTotalRefs(void)
+{
+#ifdef Py_REF_DEBUG
+ Py_ssize_t total;
+
+ if (!Py_GETENV("PYTHONSHOWREFCOUNT")) {
+ return;
+ }
+
+ total = _Py_GetRefTotal();
+ fprintf(stderr, "[%" PY_FORMAT_SIZE_T "d refs]\n", total);
+#endif
+}
+
static int initialized = 0;
/* API to access the initialized flag -- useful for esoteric use */
@@ -486,7 +493,7 @@ Py_Finalize(void)
}
#endif
- PRINT_TOTAL_REFS();
+ _PyDebug_PrintTotalRefs();
#ifdef Py_TRACE_REFS
/* Display all objects still alive -- this can invoke arbitrary
@@ -777,7 +784,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flag
}
for (;;) {
ret = PyRun_InteractiveOneFlags(fp, filename, flags);
- PRINT_TOTAL_REFS();
+ _PyDebug_PrintTotalRefs();
if (ret == E_EOF)
return 0;
/*

View File

@ -0,0 +1,59 @@
diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py
index bec38c45456..f623aa09620 100644
--- a/Lib/test/test_pty.py
+++ b/Lib/test/test_pty.py
@@ -11,6 +11,7 @@
import select
import signal
import socket
+import io # readline
import unittest
TEST_STRING_1 = "I wish to buy a fish license.\n"
@@ -24,6 +25,16 @@ def debug(msg):
pass
+# Note that os.read() is nondeterministic so we need to be very careful
+# to make the test suite deterministic. A normal call to os.read() may
+# give us less than expected.
+#
+# Beware, on my Linux system, if I put 'foo\n' into a terminal fd, I get
+# back 'foo\r\n' at the other end. The behavior depends on the termios
+# setting. The newline translation may be OS-specific. To make the
+# test suite deterministic and OS-independent, the functions _readline
+# and normalize_output can be used.
+
def normalize_output(data):
# Some operating systems do conversions on newline. We could possibly
# fix that by doing the appropriate termios.tcsetattr()s. I couldn't
@@ -45,6 +56,12 @@ def normalize_output(data):
return data
+def _readline(fd):
+ """Read one line. May block forever if no newline is read."""
+ reader = io.FileIO(fd, mode='rb', closefd=False)
+ return reader.readline()
+
+
# Marginal testing of pty suite. Cannot do extensive 'do or fail' testing
# because pty code is not too portable.
@@ -97,14 +114,14 @@ def test_basic(self):
debug("Writing to slave_fd")
os.write(slave_fd, TEST_STRING_1)
- s1 = os.read(master_fd, 1024)
+ s1 = _readline(master_fd)
self.assertEqual('I wish to buy a fish license.\n',
normalize_output(s1))
debug("Writing chunked output")
os.write(slave_fd, TEST_STRING_2[:5])
os.write(slave_fd, TEST_STRING_2[5:])
- s2 = os.read(master_fd, 1024)
+ s2 = _readline(master_fd)
self.assertEqual('For my pet fish, Eric.\n', normalize_output(s2))
os.close(slave_fd)

View File

@ -0,0 +1,135 @@
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 4a71a57ec0d..2b40ada195a 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -146,9 +146,15 @@ dircheck(fileio* self, PyObject *nameobj)
{
#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR)
struct stat buf;
+ int res;
if (self->fd < 0)
return 0;
- if (fstat(self->fd, &buf) == 0 && S_ISDIR(buf.st_mode)) {
+
+ Py_BEGIN_ALLOW_THREADS
+ res = fstat(self->fd, &buf);
+ Py_END_ALLOW_THREADS
+
+ if (res == 0 && S_ISDIR(buf.st_mode)) {
errno = EISDIR;
PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, nameobj);
return -1;
@@ -162,17 +168,34 @@ check_fd(int fd)
{
#if defined(HAVE_FSTAT)
struct stat buf;
- if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) {
- PyObject *exc;
- char *msg = strerror(EBADF);
- exc = PyObject_CallFunction(PyExc_OSError, "(is)",
- EBADF, msg);
- PyErr_SetObject(PyExc_OSError, exc);
- Py_XDECREF(exc);
- return -1;
+ int res;
+ PyObject *exc;
+ char *msg;
+
+ if (!_PyVerify_fd(fd)) {
+ goto badfd;
}
-#endif
+
+ Py_BEGIN_ALLOW_THREADS
+ res = fstat(fd, &buf);
+ Py_END_ALLOW_THREADS
+
+ if (res < 0 && errno == EBADF) {
+ goto badfd;
+ }
+
return 0;
+
+badfd:
+ msg = strerror(EBADF);
+ exc = PyObject_CallFunction(PyExc_OSError, "(is)",
+ EBADF, msg);
+ PyErr_SetObject(PyExc_OSError, exc);
+ Py_XDECREF(exc);
+ return -1;
+#else
+ return 0;
+#endif
}
@@ -519,9 +542,19 @@ new_buffersize(fileio *self, size_t currentsize)
#ifdef HAVE_FSTAT
off_t pos, end;
struct stat st;
- if (fstat(self->fd, &st) == 0) {
+ int res;
+
+ Py_BEGIN_ALLOW_THREADS
+ res = fstat(self->fd, &st);
+ Py_END_ALLOW_THREADS
+
+ if (res == 0) {
end = st.st_size;
+
+ Py_BEGIN_ALLOW_THREADS
pos = lseek(self->fd, 0L, SEEK_CUR);
+ Py_END_ALLOW_THREADS
+
/* Files claiming a size smaller than SMALLCHUNK may
actually be streaming pseudo-files. In this case, we
apply the more aggressive algorithm below.
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index 2f63c374d1e..8d1c5812f0d 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -121,10 +121,15 @@ dircheck(PyFileObject* f)
{
#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR)
struct stat buf;
+ int res;
if (f->f_fp == NULL)
return f;
- if (fstat(fileno(f->f_fp), &buf) == 0 &&
- S_ISDIR(buf.st_mode)) {
+
+ Py_BEGIN_ALLOW_THREADS
+ res = fstat(fileno(f->f_fp), &buf);
+ Py_END_ALLOW_THREADS
+
+ if (res == 0 && S_ISDIR(buf.st_mode)) {
char *msg = strerror(EISDIR);
PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(isO)",
EISDIR, msg, f->f_name);
@@ -1010,7 +1015,13 @@ new_buffersize(PyFileObject *f, size_t currentsize)
#ifdef HAVE_FSTAT
off_t pos, end;
struct stat st;
- if (fstat(fileno(f->f_fp), &st) == 0) {
+ int res;
+
+ Py_BEGIN_ALLOW_THREADS
+ res = fstat(fileno(f->f_fp), &st);
+ Py_END_ALLOW_THREADS
+
+ if (res == 0) {
end = st.st_size;
/* The following is not a bug: we really need to call lseek()
*and* ftell(). The reason is that some stdio libraries
@@ -1021,7 +1032,11 @@ new_buffersize(PyFileObject *f, size_t currentsize)
works. We can't use the lseek() value either, because we
need to take the amount of buffered data into account.
(Yet another reason why stdio stinks. :-) */
+
+ Py_BEGIN_ALLOW_THREADS
pos = lseek(fileno(f->f_fp), 0L, SEEK_CUR);
+ Py_END_ALLOW_THREADS
+
if (pos >= 0) {
pos = ftell(f->f_fp);
}

View File

@ -1,69 +0,0 @@
diff --git a/setup.py b/setup.py
index 585e380..9993f11 100644
--- a/setup.py
+++ b/setup.py
@@ -1346,11 +1346,7 @@ class PyBuildExt(build_ext):
else:
missing.append('resource')
- nis = self._detect_nis(inc_dirs, lib_dirs)
- if nis is not None:
- exts.append(nis)
- else:
- missing.append('nis')
+ # nis (Sun yellow pages) is handled in Setup.dist
# Curses support, requiring the System V version of curses, often
# provided by the ncurses library.
@@ -2162,51 +2158,6 @@ class PyBuildExt(build_ext):
# for dlopen, see bpo-32647
ext.libraries.append('dl')
- def _detect_nis(self, inc_dirs, lib_dirs):
- if host_platform in {'win32', 'cygwin', 'qnx6'}:
- return None
-
- libs = []
- library_dirs = []
- includes_dirs = []
-
- # bpo-32521: glibc has deprecated Sun RPC for some time. Fedora 28
- # moved headers and libraries to libtirpc and libnsl. The headers
- # are in tircp and nsl sub directories.
- rpcsvc_inc = find_file(
- 'rpcsvc/yp_prot.h', inc_dirs,
- [os.path.join(inc_dir, 'nsl') for inc_dir in inc_dirs]
- )
- rpc_inc = find_file(
- 'rpc/rpc.h', inc_dirs,
- [os.path.join(inc_dir, 'tirpc') for inc_dir in inc_dirs]
- )
- if rpcsvc_inc is None or rpc_inc is None:
- # not found
- return None
- includes_dirs.extend(rpcsvc_inc)
- includes_dirs.extend(rpc_inc)
-
- if self.compiler.find_library_file(lib_dirs, 'nsl'):
- libs.append('nsl')
- else:
- # libnsl-devel: check for libnsl in nsl/ subdirectory
- nsl_dirs = [os.path.join(lib_dir, 'nsl') for lib_dir in lib_dirs]
- libnsl = self.compiler.find_library_file(nsl_dirs, 'nsl')
- if libnsl is not None:
- library_dirs.append(os.path.dirname(libnsl))
- libs.append('nsl')
-
- if self.compiler.find_library_file(lib_dirs, 'tirpc'):
- libs.append('tirpc')
-
- return Extension(
- 'nis', ['nismodule.c'],
- libraries=libs,
- library_dirs=library_dirs,
- include_dirs=includes_dirs
- )
-
class PyBuildInstall(install):
# Suppress the warning about installation into the lib_dynload

View File

@ -0,0 +1,68 @@
diff --git a/Misc/NEWS.d/next/Library/2017-12-20-09-25-10.bpo-32185.IL0cMt.rst b/Misc/NEWS.d/next/Library/2017-12-20-09-25-10.bpo-32185.IL0cMt.rst
new file mode 100644
index 000000000000..bfb2533b5dcf
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2017-12-20-09-25-10.bpo-32185.IL0cMt.rst
@@ -0,0 +1,2 @@
+The SSL module no longer sends IP addresses in SNI TLS extension on
+platforms with OpenSSL 1.0.2+ or inet_pton.
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index f70af266731a..b191b3a8687a 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -52,6 +52,11 @@
#include <sys/poll.h>
#endif
+#ifndef MS_WINDOWS
+/* inet_pton */
+#include <arpa/inet.h>
+#endif
+
/* Don't warn about deprecated functions */
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@@ -575,8 +580,41 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
SSL_set_mode(self->ssl, mode);
#if HAVE_SNI
- if (server_hostname != NULL)
- SSL_set_tlsext_host_name(self->ssl, server_hostname);
+ if (server_hostname != NULL) {
+/* Don't send SNI for IP addresses. We cannot simply use inet_aton() and
+ * inet_pton() here. inet_aton() may be linked weakly and inet_pton() isn't
+ * available on all platforms. Use OpenSSL's IP address parser. It's
+ * available since 1.0.2 and LibreSSL since at least 2.3.0. */
+ int send_sni = 1;
+#if OPENSSL_VERSION_NUMBER >= 0x10200000L
+ ASN1_OCTET_STRING *ip = a2i_IPADDRESS(server_hostname);
+ if (ip == NULL) {
+ send_sni = 1;
+ ERR_clear_error();
+ } else {
+ send_sni = 0;
+ ASN1_OCTET_STRING_free(ip);
+ }
+#elif defined(HAVE_INET_PTON)
+#ifdef ENABLE_IPV6
+ char packed[Py_MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
+#else
+ char packed[sizeof(struct in_addr)];
+#endif /* ENABLE_IPV6 */
+ if (inet_pton(AF_INET, server_hostname, packed)) {
+ send_sni = 0;
+#ifdef ENABLE_IPV6
+ } else if(inet_pton(AF_INET6, server_hostname, packed)) {
+ send_sni = 0;
+#endif /* ENABLE_IPV6 */
+ } else {
+ send_sni = 1;
+ }
+#endif /* HAVE_INET_PTON */
+ if (send_sni) {
+ SSL_set_tlsext_host_name(self->ssl, server_hostname);
+ }
+ }
#endif
/* If the socket is in non-blocking mode or timeout mode, set the BIO

View File

@ -0,0 +1,24 @@
From 439956a149f8a3eb44646498c63b2ef3337d5f3d Mon Sep 17 00:00:00 2001
From: Christian Heimes <christian@python.org>
Date: Sun, 25 Feb 2018 13:08:05 +0100
Subject: [PATCH] Fix ssl module, Python 2.7 doesn't have Py_MAX (#5878)
Signed-off-by: Christian Heimes <christian@python.org>
---
Modules/_ssl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index af66a581e15a..f9ed94dee1e1 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -610,7 +610,8 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock,
}
#elif defined(HAVE_INET_PTON)
#ifdef ENABLE_IPV6
- char packed[Py_MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
+ #define PySSL_MAX(x, y) (((x) > (y)) ? (x) : (y))
+ char packed[PySSL_MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
#else
char packed[sizeof(struct in_addr)];
#endif /* ENABLE_IPV6 */

2
pynche
View File

@ -1,2 +1,2 @@
#!/bin/bash
exec `python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific = True))"`/pynche/pynche
exec `python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific = True))"`/pynche/pynche

View File

@ -1,7 +1,5 @@
diff --git a/Modules/Setup.dist b/Modules/Setup.dist
index bbc9222..2cf35a9 100644
--- a/Modules/Setup.dist
+++ b/Modules/Setup.dist
--- Python-2.7.4/Modules/Setup.dist.rhconfig 2013-04-06 16:02:34.000000000 +0200
+++ Python-2.7.4/Modules/Setup.dist 2013-04-08 10:05:16.369985654 +0200
@@ -153,7 +153,7 @@ GLHACK=-Dclear=__GLclear
# modules are to be built as shared libraries (see above for more
# detail; also note that *static* reverses this effect):
@ -11,7 +9,7 @@ index bbc9222..2cf35a9 100644
# GNU readline. Unlike previous Python incarnations, GNU readline is
# now incorporated in an optional module, configured in the Setup file
@@ -163,33 +163,33 @@ GLHACK=-Dclear=__GLclear
@@ -163,77 +163,77 @@ GLHACK=-Dclear=__GLclear
# it, depending on your system -- see the GNU readline instructions.
# It's okay for this to be a shared library, too.
@ -61,7 +59,9 @@ index bbc9222..2cf35a9 100644
# Standard I/O baseline
#_io -I$(srcdir)/Modules/_io _io/bufferedio.c _io/bytesio.c _io/fileio.c _io/iobase.c _io/_iomodule.c _io/stringio.c _io/textio.c
@@ -199,41 +199,41 @@ GLHACK=-Dclear=__GLclear
# Modules with some UNIX dependencies -- on by default:
# (If you have a really backward UNIX, select and socket may not be
# supported...)
@ -111,13 +111,13 @@ index bbc9222..2cf35a9 100644
-#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
-#termios termios.c # Steen Lumholt's termios module
-#resource resource.c # Jeremy Hylton's rlimit interface
+nis nismodule.c -lnsl -ltirpc -I/usr/include/tirpc -I/usr/include/nsl -L/usr/lib/nsl
+nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
+termios termios.c # Steen Lumholt's termios module
+resource resource.c # Jeremy Hylton's rlimit interface
# Multimedia modules -- off by default.
@@ -241,8 +241,8 @@ GLHACK=-Dclear=__GLclear
@@ -238,8 +238,8 @@ GLHACK=-Dclear=__GLclear
# #993173 says audioop works on 64-bit platforms, though.
# These represent audio samples or images as strings:
@ -128,7 +128,7 @@ index bbc9222..2cf35a9 100644
# Note that the _md5 and _sha modules are normally only built if the
@@ -252,14 +252,14 @@ GLHACK=-Dclear=__GLclear
@@ -249,14 +249,14 @@ GLHACK=-Dclear=__GLclear
# Message-Digest Algorithm, described in RFC 1321. The necessary files
# md5.c and md5.h are included here.
@ -147,7 +147,7 @@ index bbc9222..2cf35a9 100644
# SGI IRIX specific modules -- off by default.
@@ -306,12 +306,12 @@ GLHACK=-Dclear=__GLclear
@@ -303,12 +303,12 @@ GLHACK=-Dclear=__GLclear
# A Linux specific module -- off by default; this may also work on
# some *BSDs.
@ -162,7 +162,7 @@ index bbc9222..2cf35a9 100644
# The _tkinter module.
@@ -326,7 +326,7 @@ GLHACK=-Dclear=__GLclear
@@ -323,7 +323,7 @@ GLHACK=-Dclear=__GLclear
# every system.
# *** Always uncomment this (leave the leading underscore in!):
@ -171,7 +171,7 @@ index bbc9222..2cf35a9 100644
# *** Uncomment and edit to reflect where your Tcl/Tk libraries are:
# -L/usr/local/lib \
# *** Uncomment and edit to reflect where your Tcl/Tk headers are:
@@ -336,7 +336,7 @@ GLHACK=-Dclear=__GLclear
@@ -333,7 +333,7 @@ GLHACK=-Dclear=__GLclear
# *** Or uncomment this for Solaris:
# -I/usr/openwin/include \
# *** Uncomment and edit for Tix extension only:
@ -180,7 +180,7 @@ index bbc9222..2cf35a9 100644
# *** Uncomment and edit for BLT extension only:
# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
# *** Uncomment and edit for PIL (TkImaging) extension only:
@@ -345,7 +345,7 @@ GLHACK=-Dclear=__GLclear
@@ -342,7 +342,7 @@ GLHACK=-Dclear=__GLclear
# *** Uncomment and edit for TOGL extension only:
# -DWITH_TOGL togl.c \
# *** Uncomment and edit to reflect your Tcl/Tk versions:
@ -189,7 +189,7 @@ index bbc9222..2cf35a9 100644
# *** Uncomment and edit to reflect where your X11 libraries are:
# -L/usr/X11R6/lib \
# *** Or uncomment this for Solaris:
@@ -355,7 +355,7 @@ GLHACK=-Dclear=__GLclear
@@ -352,7 +352,7 @@ GLHACK=-Dclear=__GLclear
# *** Uncomment for AIX:
# -lld \
# *** Always uncomment this; X11 libraries to link with:
@ -198,7 +198,7 @@ index bbc9222..2cf35a9 100644
# Lance Ellinghaus's syslog module
#syslog syslogmodule.c # syslog daemon interface
@@ -377,7 +377,7 @@ GLHACK=-Dclear=__GLclear
@@ -374,7 +374,7 @@ GLHACK=-Dclear=__GLclear
# it is a highly experimental and dangerous device for calling
# *arbitrary* C functions in *arbitrary* shared libraries:
@ -207,7 +207,7 @@ index bbc9222..2cf35a9 100644
# Modules that provide persistent dictionary-like semantics. You will
@@ -400,7 +400,7 @@ GLHACK=-Dclear=__GLclear
@@ -397,7 +397,7 @@ GLHACK=-Dclear=__GLclear
#
# First, look at Setup.config; configure may have set this for you.
@ -216,7 +216,7 @@ index bbc9222..2cf35a9 100644
# Sleepycat Berkeley DB interface.
@@ -415,11 +415,9 @@ GLHACK=-Dclear=__GLclear
@@ -412,11 +412,9 @@ GLHACK=-Dclear=__GLclear
#
# Edit the variables DB and DBLIBVERto point to the db top directory
# and the subdirectory of PORT where you built it.
@ -231,7 +231,7 @@ index bbc9222..2cf35a9 100644
# Historical Berkeley DB 1.85
#
@@ -434,14 +432,14 @@ GLHACK=-Dclear=__GLclear
@@ -431,14 +430,14 @@ GLHACK=-Dclear=__GLclear
# Helper module for various ascii-encoders
@ -250,7 +250,7 @@ index bbc9222..2cf35a9 100644
# Lee Busby's SIGFPE modules.
@@ -464,7 +462,7 @@ GLHACK=-Dclear=__GLclear
@@ -461,7 +460,7 @@ GLHACK=-Dclear=__GLclear
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
@ -258,21 +258,20 @@ index bbc9222..2cf35a9 100644
+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
# Interface to the Expat XML parser
# More information on Expat can be found at www.libexpat.org.
@@ -475,14 +473,14 @@ GLHACK=-Dclear=__GLclear
#
@@ -480,14 +479,14 @@ GLHACK=-Dclear=__GLclear
# Hye-Shik Chang's CJKCodecs
# multibytecodec is required for all the other CJK codec modules
-#_multibytecodec cjkcodecs/multibytecodec.c
-
+_multibytecodec cjkcodecs/multibytecodec.c
-#_codecs_cn cjkcodecs/_codecs_cn.c
-#_codecs_hk cjkcodecs/_codecs_hk.c
-#_codecs_iso2022 cjkcodecs/_codecs_iso2022.c
-#_codecs_jp cjkcodecs/_codecs_jp.c
-#_codecs_kr cjkcodecs/_codecs_kr.c
-#_codecs_tw cjkcodecs/_codecs_tw.c
+_multibytecodec cjkcodecs/multibytecodec.c
+
+_codecs_cn cjkcodecs/_codecs_cn.c
+_codecs_hk cjkcodecs/_codecs_hk.c
+_codecs_iso2022 cjkcodecs/_codecs_iso2022.c

View File

@ -2,20 +2,7 @@
# Conditionals and other variables controlling the build
# ======================================================
# Note that the bcond macros are named for the CLI option they create.
# "%%bcond_without" means "ENABLE by default and create a --without option"
# Whether to use RPM build wheels from the python-{pip,setuptools}-wheel package
# Uses upstream bundled prebuilt wheels otherwise
%bcond_without rpmwheels
# Extra build for debugging the interpreter or C-API extensions
# (the -debug subpackages)
%bcond_without debug_build
# Only use this when bootstrapping python3
# Needed to build setuptools for the first time
%bcond_with python3_bootstrap
%global with_rewheel 1
%global unicode ucs4
@ -40,6 +27,8 @@
%global py_INSTSONAME_optimized libpython%{pybasever}.so.%{py_SOVERSION}
%global py_INSTSONAME_debug libpython%{pybasever}_d.so.%{py_SOVERSION}
%global with_debug_build 1
# Disabled for now:
%global with_huntrleaks 0
@ -56,25 +45,27 @@
%global with_gdbm 1
# Turn this to 0 to turn off the "check" phase:
%global run_selftest_suite 1
%if 0%{?_module_build}
%global with_valgrind 0
%global with_systemtap 0
# (Don't) Run the test suite in %%check
%bcond_with tests
%else
# Run the test suite in %%check
%bcond_without tests
%global run_selftest_suite 0
%endif
# Disable automatic bytecompilation. The python2.7 binary is not yet
# available in /usr/bin when Python is built. Also, the bytecompilation fails
# on files that test invalid syntax.
%undefine __brp_python_bytecompile
# The above is broken now
# https://bugzilla.redhat.com/show_bug.cgi?id=1597664
# This is an older non-standard way to disable the brp script, as a workaround
%undefine py_auto_byte_compile
# Some of the files below /usr/lib/pythonMAJOR.MINOR/test (e.g. bad_coding.py)
# are deliberately invalid, leading to SyntaxError exceptions if they get
# byte-compiled.
#
# These errors are ignored by the normal python build, and aren't normally a
# problem in the buildroots since /usr/bin/python isn't present.
#
# However, for the case where we're rebuilding the python srpm on a machine
# that does have python installed we need to set this to avoid
# brp-python-bytecompile treating these as fatal errors:
#
%global _python_bytecompile_errors_terminate_build 0
# We need to get a newer configure generated out of configure.in for the following
# patches:
@ -105,34 +96,20 @@
# the rest of the build
%global regenerate_autotooling_patch 0
# Python 2 is deprecated in Fedora 30+, see:
# https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
# This means that new packages MUST NOT depend on python2, even transitively
# see: https://fedoraproject.org/wiki/Packaging:Deprecating_Packages
# Python 2 will not be supported after 2019. Use the python3 package instead
# if possible.
%if 0%{fedora} >= 30
%global deprecated Provides: deprecated()
%endif
# ==================
# Top-level metadata
# ==================
Summary: An interpreted, interactive, object-oriented programming language
Name: %{python}
# Remember to also rebase python2-docs when changing this:
%global general_version %{pybasever}.16
#global prerel ...
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 1%{?dist}
# Remember to also rebase python-docs when changing this:
Version: 2.7.14
Release: 7%{?dist}
License: Python
Group: Development/Languages
Requires: %{python}-libs%{?_isa} = %{version}-%{release}
Provides: python(abi) = %{pybasever}
%?deprecated
# =======================
# Build-time requirements
@ -146,23 +123,17 @@ BuildRequires: bluez-libs-devel
%endif
BuildRequires: bzip2
BuildRequires: bzip2-devel
BuildRequires: glibc-all-langpacks
BuildRequires: glibc-devel
BuildRequires: gmp-devel
BuildRequires: libdb-devel
BuildRequires: libffi-devel
BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: pkgconfig
BuildRequires: readline-devel
BuildRequires: sqlite-devel
BuildRequires: tcl-devel
BuildRequires: openssl-devel
# For the nis module
BuildRequires: libnsl2-devel
BuildRequires: libtirpc-devel
# expat 2.1.0 added the symbol XML_SetHashSalt without bumping SONAME. We use
# it (in pyexpat) in order to enable the fix in Python-2.7.3 for CVE-2012-0876:
BuildRequires: expat-devel >= 2.1.0
@ -170,8 +141,7 @@ BuildRequires: expat-devel >= 2.1.0
BuildRequires: findutils
BuildRequires: gcc-c++
%if %{with_gdbm}
# ABI change without soname bump, reverted
BuildRequires: gdbm-devel >= 1:1.13
BuildRequires: gdbm-devel
%endif
%if ! 0%{?_module_build}
BuildRequires: libGL-devel
@ -197,33 +167,23 @@ BuildRequires: valgrind-devel
BuildRequires: zlib-devel
%if %{with rpmwheels}
BuildRequires: python-setuptools-wheel
BuildRequires: python-pip-wheel
%if ! 0%{?_module_build}
%if 0%{?with_rewheel}
BuildRequires: python2-setuptools
BuildRequires: python2-pip
Requires: python2-setuptools
Requires: python2-pip
%endif
%endif
# Providing python27 as now multiple interpreters exist in Fedora
# alongside the system one e.g. python26, python33 etc
Provides: python27 = %{version}-%{release}
# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package
# We recommend /usr/bin/python so users get it by default
# Versioned recommends are problematic, and we know that the package requires
# python2 back with fixed version, so we just use the path here:
Recommends: %{_bindir}/python
# Previously, this was required for our rewheel patch to work.
# This is technically no longer needed, but we keep it recommended
# for the developer experience.
Recommends: python2-setuptools
Recommends: python2-pip
# =======================
# Source code and patches
# =======================
Source: https://www.python.org/ftp/python/%{version}/Python-%{upstream_version}.tar.xz
Source: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz
# Work around bug 562906 until it's fixed in rpm-build by providing a fixed
# version of pythondeps.sh:
@ -259,7 +219,6 @@ Source7: pynche
# - various modules are built by default by upstream as static libraries;
# we built them as shared libraries
# - build the "readline" module (appears to also be handled by setup.py now)
# - build the nis module (which needs the tirpc library since glibc 2.26)
# - enable the build of the following modules:
# - array arraymodule.c # array objects
# - cmath cmathmodule.c # -lm # complex math library functions
@ -286,6 +245,7 @@ Source7: pynche
# - _socket socketmodule.c # Socket module helper for socket(2)
# - _ssl _ssl.c
# - crypt cryptmodule.c -lcrypt # crypt(3)
# - nis nismodule.c -lnsl # Sun yellow pages -- not everywhere
# - termios termios.c # Steen Lumholt's termios module
# - resource resource.c # Jeremy Hylton's rlimit interface
# - audioop audioop.c # Operations on audio samples
@ -736,15 +696,10 @@ Patch185: 00185-urllib2-honors-noproxy-for-ftp.patch
Patch187: 00187-add-RPATH-to-pyexpat.patch
# 00189 #
# Instead of bundled wheels, use our RPM packaged wheels from
# /usr/share/python-wheels
Patch189: 00189-use-rpm-wheels.patch
# 00190 #
# Fixes gdb py-bt command not to raise exception while processing
# statements from eval
# rhbz#1008154 (patch by Attila Fazekas)
Patch190: 00190-gdb-py-bt-dont-raise-exception-from-eval.patch
Patch189: 00189-gdb-py-bt-dont-raise-exception-from-eval.patch
# 00191 #
# Disabling NOOP test as it fails without internet connection
@ -757,10 +712,50 @@ Patch191: 00191-disable-NOOP.patch
# Patch provided by John C. Peterson
Patch193: 00193-enable-loading-sqlite-extensions.patch
# 00289 #
# Disable automatic detection for the nis module
# (we handle it it in Setup.dist, see Patch0)
Patch289: 00289-disable-nis-detection.patch
# 00198 #
Patch198: 00198-add-rewheel-module.patch
# 00280 #
# The test `test_regrtest.test_crashed` fails on s390x architecture.
# https://bugs.python.org/issue31719
Patch280: 00280-Fix-test_regrtest-test_crashed-on-s390x.patch
# 00283 #
# Fix tests on debug build configured with COUNT_ALLOCS,
# and add a new environment variable PYTHONSHOWALLOCCOUNT:
# https://bugs.python.org/issue31692
Patch283: 00283-fix-tests_with_COUNT_ALLOCS.patch
# 00284 #
# Add a new PYTHONSHOWREFCOUNT environment variable. In debug mode, Python now
# will print the total reference count if PYTHONSHOWREFCOUNT is set.
# Backported from upstream: https://bugs.python.org/issue31733
Patch284: 00284-add-PYTHONSHOWREFCOUNT-env-var.patch
# 00285 #
# Fix nondeterministic read in test_pty which fails randomly in koji.
# Fixed upstream: https://bugs.python.org/issue31158
Patch285: 00285-fix-non-deterministic-read-in-test_pty.patch
# 00287 #
# On the creation of io.FileIO() and builtin file() objects the GIL is now released
# when checking the file descriptor. io.FileIO.readall(), io.FileIO.read(), and
# file.read() also now release the GIL when getting the file size, which fixes hanging
# of all threads when trying to access an inaccessible NFS server.
# Fixed upstream: https://bugs.python.org/issue32186
Patch287: 00287-fix-thread-hanging-on-inaccessible-nfs-server.patch
# 00298 #
# The SSL module no longer sends IP addresses in SNI TLS extension on
# platforms with OpenSSL 1.0.2+ or inet_pton.
# Fixed upstream: https://bugs.python.org/issue32185
Patch298: 00298-do-not-send-IP-in-SNI-TLS-extension.patch
# 00299 #
# Fix ssl module, Python 2.7 doesn't have Py_MAX
# The previous patch 298 broke python2. This is a fixup.
# Fixed upstream: https://github.com/python/cpython/pull/5878
Patch299: 00299-fix-ssl-module-pymax.patch
# (New patches go here ^^^)
#
@ -784,6 +779,20 @@ Patch5000: 05000-autotool-intermediates.patch
# Additional metadata, and subpackages
# ======================================================
Provides: python = %{version}-%{release}
Provides: python%{?_isa} = %{version}-%{release}
# All the obsolete tags similar to this one should be removed at Fedora 28
# Also, according to the guidelines, this should be a hardcoded version,
# but that was proven problematic, see rhbz#1457336
Obsoletes: python < %{version}-%{release}
# Providing python27 as now multiple interpreters exist in Fedora
# alongside the system one e.g. python26, python33 etc
Provides: python27 = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
URL: https://www.python.org/
%description
@ -799,26 +808,9 @@ package.
This package provides the "python2" executable; most of the actual
implementation is within the "python2-libs" package.
%package -n python-unversioned-command
Summary: The "python" command that runs Python 2
BuildArch: noarch
# https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package
%?deprecated
# In theory this could require any python2 version
Requires: python2 == %{version}-%{release}
# But since we want to provide versioned python, we require exact version
Provides: python = %{version}-%{release}
# This also save us an explicit conflict for older python2 builds
%description -n python-unversioned-command
This package contains /usr/bin/python - the "python" command that runs Python 2.
%package libs
Summary: Runtime libraries for Python 2
%?deprecated
Group: Applications/System
# Needed for ctypes, to load libraries, worked around for Live CDs size
# Requires: binutils
@ -832,50 +824,21 @@ Requires: expat >= 2.1.0
# Python built with glibc >= 2.24.90-26 needs to require it (rhbz#1410644).
Requires: glibc%{?_isa} >= 2.24.90-26
%if %{with_gdbm}
# ABI change without soname bump, reverted
Requires: gdbm%{?_isa} >= 1:1.13
%endif
%if %{with rpmwheels}
Requires: python-setuptools-wheel
Requires: python-pip-wheel
%else
Provides: bundled(python2-pip) = 18.1
Provides: bundled(python2-setuptools) = 40.6.2
%endif
Provides: python-libs = %{version}-%{release}
Provides: python-libs%{?_isa} = %{version}-%{release}
Obsoletes: python-libs < %{version}-%{release}
%description libs
This package contains files used to embed Python 2 into applications.
%package devel
Summary: Libraries and header files needed for Python 2 development
%?deprecated
Group: Development/Libraries
Requires: %{python}%{?_isa} = %{version}-%{release}
Requires: python-rpm-macros
Requires: python2-rpm-macros
Requires: pkgconfig
%if %{without python3_bootstrap}
# When bootstrapping python3, we need to build setuptools
# But setuptools BR python2-devel and that brings in python3-rpm-generators
# python3-rpm-generators needs python3-setuptools, so we cannot have it yet
Requires: python3-rpm-generators
%endif
# This is not "API" (packages that need setuptools should still BuildRequire it)
# However some packages apparently can build both with and without setuptools
# producing egg-info as file or directory (depending on setuptools presence).
# Directory-to-file updates are problematic in RPM, so we ensure setuptools is
# installed when -devel is required.
# See https://bugzilla.redhat.com/show_bug.cgi?id=1623922
# See https://fedoraproject.org/wiki/Packaging:Directory_Replacement
Requires: python2-setuptools
# https://bugzilla.redhat.com/show_bug.cgi?id=1217376
# https://bugzilla.redhat.com/show_bug.cgi?id=1496757
# https://bugzilla.redhat.com/show_bug.cgi?id=1218294
@ -888,6 +851,7 @@ Conflicts: %{python} < %{version}-%{release}
Provides: python-devel = %{version}-%{release}
Provides: python-devel%{?_isa} = %{version}-%{release}
Obsoletes: python-devel < %{version}-%{release}
%description devel
This package contains libraries and header files used to build applications
@ -895,13 +859,13 @@ with and native libraries for Python 2
%package tools
Summary: A collection of development tools included with Python 2
%?deprecated
Group: Development/Tools
Requires: %{name} = %{version}-%{release}
Requires: %{python}-tkinter = %{version}-%{release}
Provides: python-tools = %{version}-%{release}
Provides: python-tools%{?_isa} = %{version}-%{release}
Obsoletes: python-tools < %{version}-%{release}
%description tools
This package includes several tools to help with the development of Python 2
@ -910,8 +874,7 @@ color editor (pynche), and a python gettext program (pygettext.py).
%package tkinter
Summary: A graphical user interface for the Python 2 scripting language
%?deprecated
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Provides: tkinter = %{version}-%{release}
@ -920,6 +883,7 @@ Provides: tkinter2 = %{version}-%{release}
Provides: tkinter2%{?_isa} = %{version}-%{release}
Provides: python-tkinter = %{version}-%{release}
Provides: python-tkinter%{?_isa} = %{version}-%{release}
Obsoletes: tkinter < %{version}-%{release}
%description tkinter
@ -931,12 +895,12 @@ user interface for Python 2 programming.
%package test
Summary: The test modules from the main python2 package
%?deprecated
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Provides: python-test = %{version}-%{release}
Provides: python-test%{?_isa} = %{version}-%{release}
Obsoletes: python-test < %{version}-%{release}
%description test
@ -947,10 +911,10 @@ never used in production.
You might want to install the python2-test package if you're developing python 2
code that uses more than just unittest and/or test.support.
%if %{with debug_build}
%if 0%{?with_debug_build}
%package debug
Summary: Debug version of the Python 2 runtime
%?deprecated
Group: Applications/System
# The debug build is an all-in-one package version of the regular build, and
# shares the same .py/.pyc files and directories as the regular build. Hence
@ -964,6 +928,7 @@ Requires: %{name}-tools%{?_isa} = %{version}-%{release}
Provides: python-debug = %{version}-%{release}
Provides: python-debug%{?_isa} = %{version}-%{release}
Obsoletes: python-debug < %{version}-%{release}
%description debug
python2-debug provides a version of the Python 2 runtime with numerous debugging
@ -981,7 +946,7 @@ It shares installation directories with the standard Python 2 runtime, so that
.py and .pyc files can be shared. All compiled extension modules gain a "_d"
suffix ("foo_d.so" rather than "foo.so") so that each Python 2 implementation can
load its own extensions.
%endif # with debug_build
%endif # with_debug_build
# ======================================================
@ -989,7 +954,7 @@ load its own extensions.
# ======================================================
%prep
%setup -q -n Python-%{upstream_version}
%setup -q -n Python-%{version}
%if 0%{?with_systemtap}
# Provide an example of usage of the tapset:
@ -1098,16 +1063,20 @@ mv Modules/cryptmodule.c Modules/_cryptmodule.c
%patch181 -p1
%patch185 -p1
%patch187 -p1
%if %{with rpmwheels}
%patch189 -p1
rm Lib/ensurepip/_bundled/*.whl
%endif
%patch190 -p1
%patch191 -p1
%patch193 -p1
%patch289 -p1
%if 0%{with_rewheel}
%patch198 -p1
%endif
%patch280 -p1
%patch283 -p1
%patch284 -p1
%patch285 -p1
%patch287 -p1
%patch298 -p1
%patch299 -p1
%if 0%{?_module_build}
%patch4000 -p1
@ -1213,16 +1182,10 @@ make EXTRA_CFLAGS="$CFLAGS" %{?_smp_mflags}
# optimized python binary:
if $PathFixWithThisBinary
then
# pathfix.py currently only works with files matching ^[a-zA-Z0-9_]+\.py$
# when crawling through directories, so we handle the special cases manually
LD_LIBRARY_PATH="$topdir/$ConfDir" ./$BinaryName \
$topdir/Tools/scripts/pathfix.py \
-i "%{_bindir}/python%{pybasever}" \
$topdir \
$topdir/Tools/pynche/pynche \
$topdir/Demo/pdist/{rcvs,rcsbump,rrcs} \
$topdir/Demo/scripts/find-uname.py \
$topdir/Tools/scripts/reindent-rst.py
-i "/usr/bin/env $BinaryName" \
$topdir
fi
# Rebuild with new python
@ -1236,7 +1199,7 @@ LD_LIBRARY_PATH="$topdir/$ConfDir" PATH=$PATH:$topdir/$ConfDir make -s EXTRA_CFL
# Use "BuildPython" to support building with different configurations:
%if %{with debug_build}
%if 0%{?with_debug_build}
BuildPython debug \
python-debug \
python%{pybasever}-debug \
@ -1246,7 +1209,7 @@ BuildPython debug \
"--with-pydebug --with-count-allocs --with-call-profile" \
%endif
false
%endif # with debug_build
%endif # with_debug_build
BuildPython optimized \
python \
@ -1307,7 +1270,7 @@ make install DESTDIR=%{buildroot}
#
%if 0%{?with_gdb_hooks}
DirHoldingGdbPy=%{_prefix}/lib/debug/%{_libdir}
PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName-%{version}-%{release}.%{_arch}.debug-gdb.py
PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName.debug-gdb.py
mkdir -p %{buildroot}$DirHoldingGdbPy
cp $topdir/Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy
@ -1330,11 +1293,11 @@ LD_LIBRARY_PATH="$topdir/$ConfDir" $topdir/$ConfDir/$BinaryName -O \
# Use "InstallPython" to support building with different configurations:
# Install the "debug" build first, so that we can move some files aside
%if %{with debug_build}
%if 0%{?with_debug_build}
InstallPython debug \
python%{pybasever}-debug \
%{py_INSTSONAME_debug}
%endif # with debug_build
%endif # with_debug_build
# Now the optimized build:
InstallPython optimized \
@ -1450,7 +1413,7 @@ install -d %{buildroot}/%{_prefix}/lib/python%{pybasever}/site-packages
%global _pyconfig_h %{_pyconfig32_h}
%endif
%if %{with debug_build}
%if 0%{?with_debug_build}
%global PyIncludeDirs python%{pybasever} python%{pybasever}-debug
%else
%global PyIncludeDirs python%{pybasever}
@ -1526,33 +1489,18 @@ sed \
%{SOURCE3} \
> %{buildroot}%{tapsetdir}/%{libpython_stp_optimized}
%if %{with debug_build}
%if 0%{?with_debug_build}
sed \
-e "s|LIBRARY_PATH|%{_libdir}/%{py_INSTSONAME_debug}|" \
%{SOURCE3} \
> %{buildroot}%{tapsetdir}/%{libpython_stp_debug}
%endif # with debug_build
%endif # with_debug_build
%endif # with_systemtap
# Do bytecompilation with the newly installed interpreter.
# compile *.pyo
find %{buildroot} -type f -a -name "*.py" -print0 | \
LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
xargs -0 %{buildroot}%{_bindir}/python%{pybasever} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{buildroot}")[2]) for f in sys.argv[1:]]' || :
# compile *.pyc
find %{buildroot} -type f -a -name "*.py" -print0 | \
LD_LIBRARY_PATH="%{buildroot}%{dynload_dir}/:%{buildroot}%{_libdir}" \
PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \
xargs -0 %{buildroot}%{_bindir}/python%{pybasever} -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{buildroot}")[2]) for f in sys.argv[1:]]' || :
# Make library-files user writable
/usr/bin/chmod 755 %{buildroot}%{dynload_dir}/*.so
/usr/bin/chmod 755 %{buildroot}%{_libdir}/libpython%{pybasever}.so.1.0
%if %{with debug_build}
/usr/bin/chmod 755 %{buildroot}%{_libdir}/libpython%{pybasever}_d.so.1.0
%endif
# ======================================================
@ -1566,8 +1514,6 @@ CheckPython() {
BinaryName=$2
ConfDir=$(pwd)/build/$ConfName
export OPENSSL_CONF=/non-existing-file
echo STARTING: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName
# Note that we're running the tests using the version of the code in the
@ -1604,44 +1550,52 @@ CheckPython() {
}
%if %{with tests}
# no locale coercion in python2
# test_ssl:test_load_dh_params shutil.copies into unicode filename
export LC_ALL=C.utf-8
%if 0%{run_selftest_suite}
# Check each of the configurations:
%if %{with debug_build}
%if 0%{?with_debug_build}
CheckPython \
debug \
python%{pybasever}-debug
%endif # with debug_build
%endif # with_debug_build
CheckPython \
optimized \
python%{pybasever}
%endif # with tests
%endif # run_selftest_suite
# ======================================================
# Cleaning up
# ======================================================
%clean
rm -fr %{buildroot}
# ======================================================
# Scriptlets
# ======================================================
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%files
%defattr(-, root, root, -)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README
%{_bindir}/pydoc*
%{_bindir}/python
%{_bindir}/%{python}
%{_bindir}/python%{pybasever}
%{_mandir}/*/python2*
%files -n python-unversioned-command
%{_bindir}/python
%{_mandir}/*/python.1.*
%{_mandir}/*/*
%files libs
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README
@ -1653,7 +1607,7 @@ CheckPython \
%{dynload_dir}/_sha512module.so
%{dynload_dir}/_shamodule.so
%{dynload_dir}/Python-%{upstream_version}-py%{pybasever}.egg-info
%{dynload_dir}/Python-%{version}-py%{pybasever}.egg-info
%{dynload_dir}/_bisectmodule.so
%{dynload_dir}/_bsddb.so
%{dynload_dir}/_codecs_cn.so
@ -1792,15 +1746,16 @@ CheckPython \
%dir %{pylibdir}/ensurepip/
%{pylibdir}/ensurepip/*.py*
%if %{with rpmwheels}
%exclude %{pylibdir}/ensurepip/_bundled
%else
%dir %{pylibdir}/ensurepip/_bundled
%{pylibdir}/ensurepip/_bundled/*.whl
%if 0%{?with_rewheel}
%dir %{pylibdir}/ensurepip/rewheel/
%{pylibdir}/ensurepip/rewheel/*.py*
%endif
%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/python-%{pybasever}.pc
%{_libdir}/pkgconfig/python.pc
%{_libdir}/pkgconfig/python2.pc
@ -1816,13 +1771,11 @@ CheckPython \
%{_libdir}/libpython%{pybasever}.so
%files tools
%defattr(-,root,root,755)
%doc Tools/pynche/README.pynche
%{site_packages}/pynche
%{_bindir}/smtpd*.py*
# https://bugzilla.redhat.com/show_bug.cgi?id=1111275
%exclude %{_bindir}/2to3*
%{_bindir}/2to3*
%{_bindir}/idle*
%{_bindir}/pynche*
%{_bindir}/pygettext*.py*
@ -1832,12 +1785,14 @@ CheckPython \
%{pylibdir}/Doc
%files tkinter
%defattr(-,root,root,755)
%{pylibdir}/lib-tk
%if ! 0%{?_module_build}
%{dynload_dir}/_tkinter.so
%endif
%files test
%defattr(-, root, root, -)
%{pylibdir}/bsddb/test
%{pylibdir}/ctypes/test
%{pylibdir}/distutils/tests
@ -1864,8 +1819,9 @@ CheckPython \
# Hence the manifest is the combination of analogous files in the manifests of
# all of the other subpackages
%if %{with debug_build}
%if 0%{?with_debug_build}
%files debug
%defattr(-,root,root,-)
# Analog of the core subpackage's files:
%{_bindir}/python-debug
@ -1985,7 +1941,7 @@ CheckPython \
%{dynload_dir}/_ctypes_test_d.so
%{dynload_dir}/_testcapimodule_d.so
%endif # with debug_build
%endif # with_debug_build
# We put the debug-gdb.py file inside /usr/lib/debug to avoid noise from
# ldconfig (rhbz:562980).
@ -2000,110 +1956,23 @@ CheckPython \
# (if it doesn't, then the rpmbuild ought to fail since the debug-gdb.py
# payload file would be unpackaged)
# Workaround for rhbz#1476593
%undefine _debuginfo_subpackages
# ======================================================
# Finally, the changelog:
# ======================================================
%changelog
* Mon Mar 04 2019 Miro Hrončok <mhroncok@redhat.com> - 2.7.16-1
- Update to 2.7.16 final
* Tue Feb 19 2019 Charalampos Stratakis <cstratak@redhat.com> - 2.7.16~rc1-1
- Update to 2.7.16rc1
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.7.15-14
- Rebuild for readline 8.0
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.15-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 2.7.15-12
- Rebuilt for libcrypt.so.2 (#1666033)
* Mon Sep 24 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-11
- Security fix for CVE-2018-14647 (#1631822)
* Thu Sep 20 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-10
- Security fix for CVE-2018-1000802 (#1631662)
* Thu Sep 06 2018 Petr Viktorin <pviktori@redhat.com> - 2.7.15-9
- Deprecate python2 and all subpackages in Fedora 30+ (#1625773)
* Thu Aug 30 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-8
- Require python2-setuptools from python2-devel to prevent packaging errors (#1623922)
* Tue Aug 21 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-7
- Use RPM built wheels of pip and setuptools in ensurepip instead of our rewheel patch
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.15-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 14 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-5
- Move /usr/bin/python into a separate package
https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package
- Revert https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build
* Wed Jun 13 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-4
- Rebuilt for Python 3.7
* Wed Jun 13 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-3
- Bootstrap for Python 3.7
* Tue May 15 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.7.15-2
- Fix loading of the gdb python plugin (rhbz#1578001)
* Tue May 01 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.15-1
- Update to version 2.7.15
* Wed Apr 25 2018 Tomas Orsava <torsava@redhat.com> - 2.7.14-17
- Change shebangs to the proper versioned binary
- Bytecompile files manually, disbale brp-python-bytecompile
Resolves: rhbz#1572171
* Fri Apr 13 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.14-16
- Remove Obsoletes tag from when python was renamed to python2 (Fedora 25 was last)
* Wed Mar 14 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.14-15
* Wed Mar 14 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.14-7
- Fix broken SSL module
Resolves: rhbz#1555081
* Tue Mar 13 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.7.14-14
* Tue Mar 13 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.7.14-6
- Do not send IP addresses in SNI TLS extension
* Mon Feb 26 2018 Petr Viktorin <pviktori@redhat.com> - 2.7.14-13
- Fix -Wint-in-bool-context warnings
Resolves: rhbz#1473425
* Sat Feb 24 2018 Florian Weimer <fweimer@redhat.com> - 2.7.14-12
- Rebuild with new LDFLAGS from redhat-rpm-config
* Thu Feb 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.14-11
* Thu Feb 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.14-5
- Move test.support and test.script_helper to python2-libs
Resolves: rhbz#1528899
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.14-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Tue Jan 30 2018 Petr Viktorin <pviktori@redhat.com> - 2.7.14-9
- Add patch 288: warn/fail if Python 2 is called as /usr/bin/python and
PYTHON_DISALLOW_AMBIGUOUS_VERSION is set
- Add patch 289: Fix for over-aligned GC info
* Sat Jan 20 2018 Björn Esser <besser82@fedoraproject.org> - 2.7.14-8
- Rebuilt for switch to libxcrypt
* Wed Jan 17 2018 Petr Viktorin <pviktori@redhat.com> - 2.7.14-7
- Build the nis module with tirpc
* Tue Jan 16 2018 Miro Hrončok <mhroncok@redhat.com> - 2.7.14-6
- Rebuild for reverted gdbm 1.13 on Fedora 27
* Thu Jan 11 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.7.14-5
- Rebuild for gdbm 1.14
* Mon Dec 11 2017 Charalampos Stratakis <cstratak@redhat.com> - 2.7.14-4
- Fix hanging of all threads when trying to access an inaccessible NFS server.
@ -2119,42 +1988,19 @@ Resolves: rhbz#1496757
* Mon Oct 09 2017 Iryna Shcherbina <ishcherb@redhat.com> - 2.7.14-1
- Update to version 2.7.14
* Thu Aug 31 2017 Tomas Orsava <torsava@redhat.com> - 2.7.13-18
- Switch some macros into bconds to facilitate modularity
* Wed Aug 16 2017 Miro Hrončok <mhroncok@redhat.com> - 2.7.13-17
- Exclude /usr/bin/2to3 (rhbz#1111275)
* Mon Aug 14 2017 David "Sanqui" Labský <dlabsky@redhat.com> - 2.7.13-16
- Do not generate debuginfo subpackages (#1476593)
* Wed Aug 09 2017 Michal Cyprian <mcyprian@redhat.com> - 2.7.13-15
* Thu Aug 10 2017 Michal Cyprian <mcyprian@redhat.com> - 2.7.13-12
- Revert "Add --executable option to install.py command"
This enhancement is currently not needed and it can possibly
collide with `pip --editable`option
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.13-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.7.13-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon Jun 26 2017 Charalampos Stratakis <cstratak@redhat.com> - 2.7.13-11
- Fix test_alpn_protocols from test_ssl
* Wed May 31 2017 Miro Hrončok <mhroncok@redhat.com> - 2.7.13-11
* Wed May 31 2017 Miro Hrončok <mhroncok@redhat.com> - 2.7.13-10
- Change fixed Obsoletes version with a dynamic one (rhbz#1457336)
* Thu May 18 2017 Karsten Hopp <karsten@redhat.com> - 2.7.13-10
- revert logic for modularity patch and enable gdbm for modularity
* Tue May 16 2017 Tomas Orsava <torsava@redhat.com> - 2.7.13-9
- Added a dependency to the devel subpackage on python3-rpm-generators which
have been excised out of rpm-build
- There is no Python 2 package containing Python RPM generators, therefore
Python 3 is needed when Python 2 package is to be built, but this was
decided not to be a problem due to nearing EOL of Python 2
- Involves: rhbz#1410631, rhbz#1444925
* Thu May 18 2017 Karsten Hopp <karsten@redhat.com> - 2.7.13-9
- revert logic for modularity patch and enable gdbm for modularity
* Wed May 10 2017 Charalampos Stratakis <cstratak@redhat.com> - 2.7.13-8
- Enable profile guided optimizations for x86_64 and i686 architectures

View File

@ -1 +1 @@
SHA512 (Python-2.7.16.tar.xz) = 16e814e8dcffc707b595ca2919bd2fa3db0d15794c63d977364652c4a5b92e90e72b8c9e1cc83b5020398bd90a1b397dbdd7cb931c49f1aa4af6ef95414b43e0
SHA512 (Python-2.7.14.tar.xz) = 78310b0be6388ffa15f29a80afb9ab3c03a572cb094e9da00cfe391afadb51696e41f592eb658d6a31a2f422fdac8a55214a382cbb8cfb43d4a127d5b35ea7f9

View File

@ -1,19 +0,0 @@
---
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
repositories:
- repo: "https://src.fedoraproject.org/tests/python.git"
dest: "python"
tests:
- smoke:
dir: python/smoke
run: METHOD=virtualenv VERSION=2.7 ./venv.sh
required_packages:
- gcc
- virtualenv
- python3-tox
- python2-devel
- glibc-all-langpacks # for locale tests