Permalink
Browse files

Adapt to Python 2.7.x

  • Loading branch information...
1 parent 622da46 commit af751ab3e861e0543f481157f3b291963dea94a5 @smcmahon smcmahon committed Feb 14, 2012
View
2 HISTORY.txt 100755 → 100644
@@ -1,6 +1,6 @@
4.2.x - unreleased
- - More general fix for debian multiarch. Fixes #12188.
+ - Adapt to use Python 2.7.x.
- if --with-python is used, there is no need to check for ssl libraries.
View
@@ -245,7 +245,7 @@ Install Location, Root Install
- Base install at /usr/local/Plone by default. This may be changed
with the --target installation option. If you change it, you'll also need
to change the paths below.
-- Python installed at /usr/local/Plone/Python-2.6
+- Python installed at /usr/local/Plone/Python-2.7
- For ZEO Cluster
- ZEO cluster (server and 2 clients) installed and configured at /usr/local/Plone/zeocluster
Both --target and --name options may change this.
@@ -267,7 +267,7 @@ Install Location, Root-less Install
- Base install at $HOME/Plone, where $HOME is the user's home
directory, by default. This may be changed with the --target installation
option. If you change it, you'll also need to change the paths below.
-- Python installed at $HOME/Plone/Python-2.6
+- Python installed at $HOME/Plone/Python-2.7
- For ZEO Cluster
- ZEO cluster (server and 2 clients) installed and configured at $HOME/Plone/zeocluster
Both --target and --name options may change this.
@@ -500,7 +500,7 @@ then telling the Unified Installer to use the preinstalled Python.
Test builds on OpenBSD 4.2 succeeded with the following packages pre-installed:
bzip2-1.0.4 block-sorting file compressor, unencumbered
-python-2.6.7 interpreted object-oriented programming language
+python-2.7.2 interpreted object-oriented programming language
python-expat-2.6.7 expat module for Python
If you are unable to install python-expat-2.6.7, you may need to install the
@@ -529,8 +529,8 @@ Live backup is possible. See http://plone.org/documentation/how-to/backup-plone
Coexistence with System Python
==============================
The Python installed by the Unified Installer should *not* interfere with
-any other Python on your system. The Installer bundles Python 2.6.7,
-placing it at /usr/local/Plone/Python-2.6 or $HOME/Plone/Python-2.6.
+any other Python on your system. The Installer bundles Python 2.7.2,
+placing it at /usr/local/Plone/Python-2.7 or $HOME/Plone/Python-2.7.
Developer Options
View
@@ -3,41 +3,20 @@
# note: Install readline and zlib before running this script
#
-echo "Installing Python 2.6.7. This takes a while..."
+echo "Installing ${PYTHON_DIR}. This takes a while..."
cd "$PKG"
untar "$PYTHON_TB"
chmod -R 755 "$PYTHON_DIR"
cd "$PYTHON_DIR"
-# Look for Debian/Ubuntu Multiarch libraries
-ls -d /usr/lib/*-linux-gnu > /dev/null 2>&1
-if [ $? -eq 0 ]; then
- echo "Patching for Debian/Ubuntu Multiarch"
- patch < ../multiarch-patch.txt >> "$INSTALL_LOG" 2>&1
- if [ $? -gt 0 ]; then
- echo "Failed to patch for Debian/Ubuntu Multiarch."
- seelog
- exit 1
- fi
-fi
-
-echo "Patching for thread size"
-patch -p0 < ../issue9670-v2.txt >> "$INSTALL_LOG" 2>&1
-if [ $? -gt 0 ]; then
- echo "Failed to patch for thread size."
- seelog
- exit 1
-fi
-
-if [ "$HAVE_SSL2" != "yes" ]; then
- echo "Patching for disabled ssl2"
- patch -p0 < ../issue12012-sslv2.txt >> "$INSTALL_LOG" 2>&1
- if [ $? -gt 0 ]; then
- echo "Failed to patch for disabled ssl2."
- seelog
- exit 1
- fi
-fi
+# XXX: See if we still need this.
+# echo "Patching for thread size"
+# patch -p0 < ../issue9670-v2.txt >> "$INSTALL_LOG" 2>&1
+# if [ $? -gt 0 ]; then
+# echo "Failed to patch for thread size."
+# seelog
+# exit 1
+# fi
# Look for Darwin
if [ `uname` = 'Darwin' ]; then
@@ -55,14 +34,14 @@ fi
./configure $EXFLAGS --prefix="$PY_HOME" >> "$INSTALL_LOG" 2>&1
-## OpenSolaris has netpacket/packet.h but it does not compile Modules/socketmodule.c
-if [ `uname` = 'SunOS' ]; then
- # OpenSolaris and Oracle Solaris 11 Express are SunOS 5.11 for now.
- if [ `uname -r | awk -F. '{print $2}'` -gt 10 ]; then
- mv pyconfig.h pyconfig.h.bak
- /usr/bin/sed -e "s|\(^#define HAVE_NETPACKET_PACKET_H 1$\)|/* \1 */|" pyconfig.h.bak >pyconfig.h
- fi
-fi
+# ## OpenSolaris has netpacket/packet.h but it does not compile Modules/socketmodule.c
+# if [ `uname` = 'SunOS' ]; then
+# # OpenSolaris and Oracle Solaris 11 Express are SunOS 5.11 for now.
+# if [ `uname -r | awk -F. '{print $2}'` -gt 10 ]; then
+# mv pyconfig.h pyconfig.h.bak
+# /usr/bin/sed -e "s|\(^#define HAVE_NETPACKET_PACKET_H 1$\)|/* \1 */|" pyconfig.h.bak >pyconfig.h
+# fi
+# fi
make install >> "$INSTALL_LOG" 2>&1
@@ -73,7 +52,7 @@ then
fi
if [ ! -x "$PY_HOME/bin/python" ]
then
- echo "Install of Python 2.6.7 has failed."
+ echo "Install of ${PYTHON_DIR} has failed."
seelog
exit 1
fi
View
@@ -9,12 +9,12 @@
# check version
vi = sys.version_info[:3]
-if vi < (2, 6, 0) or vi >= (2, 7, 0):
- print "Failed: Python version must be 2.6+."
+if vi < (2, 7, 0) or vi >= (2, 8, 0):
+ print "Failed: Python version must be 2.7.x."
# not much point in further testing.
sys.exit(1)
-if not os.path.isfile(os.path.join(sys.prefix, 'include', 'python2.6', 'Python.h')):
+if not os.path.isfile(os.path.join(sys.prefix, 'include', 'python2.7', 'Python.h')):
print "Failed: We need to be able to use Python.h, which is missing."
print "You may be able to resolve this by installing the python-dev package."
passed = False
View
@@ -37,7 +37,7 @@
# In a server-mode install, sets the effective user for running the
# instance. Default is 'plone'. Ignored for non-server-mode installs.
#
-# --with-python=/fullpathtopython2.6
+# --with-python=/fullpathtopython2.7.x
# If you have an already built Python that's adequate to run
# Zope / Plone, you may specify it here.
# virtualenv will be used to isolate the copy used for the install.
@@ -106,8 +106,8 @@ ONLINE_PACKAGES_DIR=opackages
HSCRIPTS_DIR=helper_scripts
-PYTHON_TB=Python-2.6.7.tar.bz2
-PYTHON_DIR=Python-2.6.7
+PYTHON_TB=Python-2.7.2.tar.bz2
+PYTHON_DIR=Python-2.7.2
DISTRIBUTE_TB=distribute-0.6.19.tar.gz
DISTRIBUTE_DIR=distribute-0.6.19
JPEG_TB=jpegsrc.v8c.tar.bz2
@@ -472,7 +472,7 @@ if [ ! -d "$PACKAGES_DIR" ]; then
fi
-if [ -x "$PLONE_HOME/Python-2.6/bin/python" ] ; then
+if [ -x "$PLONE_HOME/Python-2.7/bin/python" ] ; then
HAVE_PYTHON=yes
if [ "x$WITH_PYTHON" != "x" ]; then
echo "We already have a Python environment for this target; ignoring --with-python."
@@ -704,7 +704,7 @@ fi
if [ "x$WITH_PYTHON" != "x" ] # try to use specified python
then
PYBNAME=`basename "$WITH_PYTHON"`
- PY_HOME=$PLONE_HOME/Python-2.6
+ PY_HOME=$PLONE_HOME/Python-2.7
cd "$PKG"
untar $VIRTUALENV_TB
cd $VIRTUALENV_DIR
@@ -737,7 +737,7 @@ then
exit 1
fi
else # use already-placed python or build one
- PY_HOME=$PLONE_HOME/Python-2.6
+ PY_HOME=$PLONE_HOME/Python-2.7
PY=$PY_HOME/bin/python
if [ -x "$PY" ]; then
# no point in installing zlib -- too late!
@@ -1,161 +0,0 @@
-diff -Naur Doc/library/ssl.rst Doc/library/ssl.rst
---- Doc/library/ssl.rst 2010-05-16 16:17:51.000000000 +0200
-+++ Doc/library/ssl.rst 2011-11-15 11:03:51.819347994 +0100
-@@ -222,6 +222,9 @@
-
- Selects SSL version 2 as the channel encryption protocol.
-
-+ This protocol is not available if OpenSSL is compiled with OPENSSL_NO_SSL2
-+ flag.
-+
- .. warning::
-
- SSL version 2 is insecure. Its use is highly discouraged.
-diff -Naur Lib/ssl.py Lib/ssl.py
---- Lib/ssl.py 2010-04-28 00:05:18.000000000 +0200
-+++ Lib/ssl.py 2011-11-15 11:07:01.916290627 +0100
-@@ -61,7 +61,7 @@
-
- from _ssl import SSLError
- from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
--from _ssl import PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1
-+from _ssl import PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1
- from _ssl import RAND_status, RAND_egd, RAND_add
- from _ssl import \
- SSL_ERROR_ZERO_RETURN, \
-@@ -73,6 +73,17 @@
- SSL_ERROR_WANT_CONNECT, \
- SSL_ERROR_EOF, \
- SSL_ERROR_INVALID_ERROR_CODE
-+_PROTOCOL_NAMES = {
-+ PROTOCOL_TLSv1: "TLSv1",
-+ PROTOCOL_SSLv23: "SSLv23",
-+ PROTOCOL_SSLv3: "SSLv3",
-+}
-+try:
-+ from _ssl import PROTOCOL_SSLv2
-+except ImportError:
-+ pass
-+else:
-+ _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2"
-
- from socket import socket, _fileobject, _delegate_methods
- from socket import error as socket_error
-@@ -402,16 +413,7 @@
- return DER_cert_to_PEM_cert(dercert)
-
- def get_protocol_name(protocol_code):
-- if protocol_code == PROTOCOL_TLSv1:
-- return "TLSv1"
-- elif protocol_code == PROTOCOL_SSLv23:
-- return "SSLv23"
-- elif protocol_code == PROTOCOL_SSLv2:
-- return "SSLv2"
-- elif protocol_code == PROTOCOL_SSLv3:
-- return "SSLv3"
-- else:
-- return "<unknown>"
-+ return _PROTOCOL_NAMES.get(protocol_code, '<unknown>')
-
-
- # a replacement for the old socket.ssl function
-diff -Naur Lib/test/test_ssl.py Lib/test/test_ssl.py
---- Lib/test/test_ssl.py 2010-08-02 21:56:05.000000000 +0200
-+++ Lib/test/test_ssl.py 2011-11-15 11:14:41.630570228 +0100
-@@ -58,7 +58,7 @@
- raise
-
- def test_constants(self):
-- ssl.PROTOCOL_SSLv2
-+ #ssl.PROTOCOL_SSLv2
- ssl.PROTOCOL_SSLv23
- ssl.PROTOCOL_SSLv3
- ssl.PROTOCOL_TLSv1
-@@ -829,6 +829,7 @@
- bad_cert_test(os.path.join(os.path.dirname(__file__) or os.curdir,
- "badkey.pem"))
-
-+ @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv2'), "need SSLv2")
- def test_protocol_sslv2(self):
- """Connecting to an SSLv2 server with various client options"""
- if test_support.verbose:
-@@ -848,14 +849,15 @@
- sys.stdout.write("\ntest_protocol_sslv23 disabled, "
- "as it fails on OpenSSL 1.0.0+")
- return
-- try:
-- try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True)
-- except (ssl.SSLError, socket.error), x:
-- # this fails on some older versions of OpenSSL (0.9.7l, for instance)
-- if test_support.verbose:
-- sys.stdout.write(
-- " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n"
-- % str(x))
-+ if hasattr(ssl, 'PROTOCOL_SSLv2'):
-+ try:
-+ try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True)
-+ except (ssl.SSLError, socket.error), x:
-+ # this fails on some older versions of OpenSSL (0.9.7l, for instance)
-+ if test_support.verbose:
-+ sys.stdout.write(
-+ " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n"
-+ % str(x))
- try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True)
- try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True)
- try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True)
-@@ -877,7 +879,8 @@
- try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True)
- try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL)
- try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED)
-- try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False)
-+ if hasattr(ssl, 'PROTOCOL_SSLv2'):
-+ try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False)
- try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False)
- try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False)
-
-@@ -890,7 +893,8 @@
- try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True)
- try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL)
- try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED)
-- try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False)
-+ if hasattr(ssl, 'PROTOCOL_SSLv2'):
-+ try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False)
- try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False)
- try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False)
-
-diff -Naur Modules/_ssl.c Modules/_ssl.c
---- Modules/_ssl.c 2010-08-03 20:50:32.000000000 +0200
-+++ Modules/_ssl.c 2011-11-15 11:19:55.132124801 +0100
-@@ -62,7 +62,9 @@
- };
-
- enum py_ssl_version {
-+#ifndef OPENSSL_NO_SSL2
- PY_SSL_VERSION_SSL2,
-+#endif
- PY_SSL_VERSION_SSL3,
- PY_SSL_VERSION_SSL23,
- PY_SSL_VERSION_TLS1
-@@ -302,8 +304,10 @@
- self->ctx = SSL_CTX_new(TLSv1_method()); /* Set up context */
- else if (proto_version == PY_SSL_VERSION_SSL3)
- self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */
-+#ifndef OPENSSL_NO_SSL2
- else if (proto_version == PY_SSL_VERSION_SSL2)
- self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */
-+#endif
- else if (proto_version == PY_SSL_VERSION_SSL23)
- self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */
- PySSL_END_ALLOW_THREADS
-@@ -1687,8 +1691,10 @@
- PY_SSL_CERT_REQUIRED);
-
- /* protocol versions */
-+#ifndef OPENSSL_NO_SSL2
- PyModule_AddIntConstant(m, "PROTOCOL_SSLv2",
- PY_SSL_VERSION_SSL2);
-+#endif
- PyModule_AddIntConstant(m, "PROTOCOL_SSLv3",
- PY_SSL_VERSION_SSL3);
- PyModule_AddIntConstant(m, "PROTOCOL_SSLv23",
-
@@ -1,22 +0,0 @@
-diff -u Python/thread_pthread.h Python/thread_pthread.h
---- Python/thread_pthread.h
-+++ Python/thread_pthread.h
-@@ -18,6 +18,18 @@
- #ifndef THREAD_STACK_SIZE
- #define THREAD_STACK_SIZE 0 /* use default stack size */
- #endif
-+
-+#if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
-+ /* The default stack size for new threads on OSX is small enough that
-+ * we'll get hard crashes instead of 'maximum recursion depth exceeded'
-+ * exceptions.
-+ *
-+ * The default stack size below is the minimal stack size where a
-+ * simple recursive function doesn't cause a hard crash.
-+ */
-+#undef THREAD_STACK_SIZE
-+#define THREAD_STACK_SIZE 0x100000
-+#endif
- /* for safety, ensure a viable minimum stacksize */
- #define THREAD_STACK_MIN 0x8000 /* 32kB */
- #else /* !_POSIX_THREAD_ATTR_STACKSIZE */
Oops, something went wrong. Retry.

0 comments on commit af751ab

Please sign in to comment.