add patches for 3.1, 3.1.1, 3.1.2 to fix build with recent version of openssl (fixes #421)
This commit is contained in:
parent
c0f691fc57
commit
461ae27a19
@ -0,0 +1,45 @@
|
|||||||
|
diff -r -u ../Python-3.1/setup.py ./setup.py
|
||||||
|
--- ../Python-3.1/setup.py 2009-05-24 02:13:14.000000000 +0900
|
||||||
|
+++ ./setup.py 2015-08-15 13:29:18.300777605 +0900
|
||||||
|
@@ -14,6 +14,7 @@
|
||||||
|
from distutils.command.build_ext import build_ext
|
||||||
|
from distutils.command.install import install
|
||||||
|
from distutils.command.install_lib import install_lib
|
||||||
|
+from distutils.spawn import find_executable
|
||||||
|
|
||||||
|
# This global variable is used to hold the list of modules to be disabled.
|
||||||
|
disabled_module_list = []
|
||||||
|
@@ -293,10 +294,33 @@
|
||||||
|
return platform
|
||||||
|
return sys.platform
|
||||||
|
|
||||||
|
+ def add_multiarch_paths(self):
|
||||||
|
+ # Debian/Ubuntu multiarch support.
|
||||||
|
+ # https://wiki.ubuntu.com/MultiarchSpec
|
||||||
|
+ if not find_executable('dpkg-architecture'):
|
||||||
|
+ return
|
||||||
|
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
|
||||||
|
+ if not os.path.exists(self.build_temp):
|
||||||
|
+ os.makedirs(self.build_temp)
|
||||||
|
+ ret = os.system(
|
||||||
|
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
|
||||||
|
+ tmpfile)
|
||||||
|
+ try:
|
||||||
|
+ if ret >> 8 == 0:
|
||||||
|
+ with open(tmpfile) as fp:
|
||||||
|
+ multiarch_path_component = fp.readline().strip()
|
||||||
|
+ add_dir_to_list(self.compiler.library_dirs,
|
||||||
|
+ '/usr/lib/' + multiarch_path_component)
|
||||||
|
+ add_dir_to_list(self.compiler.include_dirs,
|
||||||
|
+ '/usr/include/' + multiarch_path_component)
|
||||||
|
+ finally:
|
||||||
|
+ os.unlink(tmpfile)
|
||||||
|
+
|
||||||
|
def detect_modules(self):
|
||||||
|
# Ensure that /usr/local is always used
|
||||||
|
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
|
||||||
|
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
||||||
|
+ self.add_multiarch_paths()
|
||||||
|
|
||||||
|
# Add paths specified in the environment variables LDFLAGS and
|
||||||
|
# CPPFLAGS for header and library files.
|
@ -0,0 +1,75 @@
|
|||||||
|
diff -r -u ../Python-3.1/Lib/ssl.py ./Lib/ssl.py
|
||||||
|
--- ../Python-3.1/Lib/ssl.py 2009-06-04 18:42:55.000000000 +0900
|
||||||
|
+++ ./Lib/ssl.py 2015-08-15 13:12:22.270915671 +0900
|
||||||
|
@@ -60,8 +60,20 @@
|
||||||
|
|
||||||
|
from _ssl import SSLError
|
||||||
|
from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
|
||||||
|
-from _ssl import (PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23,
|
||||||
|
+from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23,
|
||||||
|
PROTOCOL_TLSv1)
|
||||||
|
+_PROTOCOL_NAMES = {
|
||||||
|
+ PROTOCOL_TLSv1: "TLSv1",
|
||||||
|
+ PROTOCOL_SSLv23: "SSLv23",
|
||||||
|
+ PROTOCOL_SSLv3: "SSLv3",
|
||||||
|
+}
|
||||||
|
+try:
|
||||||
|
+ from _ssl import PROTOCOL_SSLv2
|
||||||
|
+ _SSLv2_IF_EXISTS = PROTOCOL_SSLv2
|
||||||
|
+except ImportError:
|
||||||
|
+ _SSLv2_IF_EXISTS = None
|
||||||
|
+else:
|
||||||
|
+ _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2"
|
||||||
|
from _ssl import RAND_status, RAND_egd, RAND_add
|
||||||
|
from _ssl import (
|
||||||
|
SSL_ERROR_ZERO_RETURN,
|
||||||
|
@@ -434,13 +446,4 @@
|
||||||
|
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>')
|
||||||
|
diff -r -u ../Python-3.1/Modules/_ssl.c ./Modules/_ssl.c
|
||||||
|
--- ../Python-3.1/Modules/_ssl.c 2009-05-06 07:31:58.000000000 +0900
|
||||||
|
+++ ./Modules/_ssl.c 2015-08-15 13:13:23.812369742 +0900
|
||||||
|
@@ -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,
|
||||||
|
@@ -301,8 +303,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
|
||||||
|
@@ -1693,8 +1697,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",
|
@ -0,0 +1,70 @@
|
|||||||
|
diff -r -u ../Python-3.3.3.orig/Modules/readline.c ./Modules/readline.c
|
||||||
|
--- ../Python-3.3.3.orig/Modules/readline.c 2013-11-17 16:23:01.000000000 +0900
|
||||||
|
+++ ./Modules/readline.c 2014-03-29 16:22:10.219305878 +0900
|
||||||
|
@@ -231,8 +231,7 @@
|
||||||
|
if (!PyArg_ParseTuple(args, buf, &function))
|
||||||
|
return NULL;
|
||||||
|
if (function == Py_None) {
|
||||||
|
- Py_XDECREF(*hook_var);
|
||||||
|
- *hook_var = NULL;
|
||||||
|
+ Py_CLEAR(*hook_var);
|
||||||
|
}
|
||||||
|
else if (PyCallable_Check(function)) {
|
||||||
|
PyObject *tmp = *hook_var;
|
||||||
|
@@ -774,14 +773,22 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
+#if defined(_RL_FUNCTION_TYPEDEF)
|
||||||
|
on_startup_hook(void)
|
||||||
|
+#else
|
||||||
|
+on_startup_hook()
|
||||||
|
+#endif
|
||||||
|
{
|
||||||
|
return on_hook(startup_hook);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
||||||
|
static int
|
||||||
|
+#if defined(_RL_FUNCTION_TYPEDEF)
|
||||||
|
on_pre_input_hook(void)
|
||||||
|
+#else
|
||||||
|
+on_pre_input_hook()
|
||||||
|
+#endif
|
||||||
|
{
|
||||||
|
return on_hook(pre_input_hook);
|
||||||
|
}
|
||||||
|
@@ -819,7 +826,7 @@
|
||||||
|
(r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- Py_XDECREF(r); r=NULL;
|
||||||
|
+ Py_CLEAR(r);
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
error:
|
||||||
|
@@ -877,7 +884,7 @@
|
||||||
|
* before calling the normal completer */
|
||||||
|
|
||||||
|
static char **
|
||||||
|
-flex_complete(char *text, int start, int end)
|
||||||
|
+flex_complete(const char *text, int start, int end)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
||||||
|
rl_completion_append_character ='\0';
|
||||||
|
@@ -936,12 +943,12 @@
|
||||||
|
rl_bind_key_in_map ('\t', rl_complete, emacs_meta_keymap);
|
||||||
|
rl_bind_key_in_map ('\033', rl_complete, emacs_meta_keymap);
|
||||||
|
/* Set our hook functions */
|
||||||
|
- rl_startup_hook = (Function *)on_startup_hook;
|
||||||
|
+ rl_startup_hook = on_startup_hook;
|
||||||
|
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
||||||
|
- rl_pre_input_hook = (Function *)on_pre_input_hook;
|
||||||
|
+ rl_pre_input_hook = on_pre_input_hook;
|
||||||
|
#endif
|
||||||
|
/* Set our completion function */
|
||||||
|
- rl_attempted_completion_function = (CPPFunction *)flex_complete;
|
||||||
|
+ rl_attempted_completion_function = flex_complete;
|
||||||
|
/* Set Python word break characters */
|
||||||
|
completer_word_break_characters =
|
||||||
|
rl_completer_word_break_characters =
|
@ -0,0 +1,45 @@
|
|||||||
|
diff -r -u ../Python-3.1/setup.py ./setup.py
|
||||||
|
--- ../Python-3.1/setup.py 2009-05-24 02:13:14.000000000 +0900
|
||||||
|
+++ ./setup.py 2015-08-15 13:29:18.300777605 +0900
|
||||||
|
@@ -14,6 +14,7 @@
|
||||||
|
from distutils.command.build_ext import build_ext
|
||||||
|
from distutils.command.install import install
|
||||||
|
from distutils.command.install_lib import install_lib
|
||||||
|
+from distutils.spawn import find_executable
|
||||||
|
|
||||||
|
# This global variable is used to hold the list of modules to be disabled.
|
||||||
|
disabled_module_list = []
|
||||||
|
@@ -293,10 +294,33 @@
|
||||||
|
return platform
|
||||||
|
return sys.platform
|
||||||
|
|
||||||
|
+ def add_multiarch_paths(self):
|
||||||
|
+ # Debian/Ubuntu multiarch support.
|
||||||
|
+ # https://wiki.ubuntu.com/MultiarchSpec
|
||||||
|
+ if not find_executable('dpkg-architecture'):
|
||||||
|
+ return
|
||||||
|
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
|
||||||
|
+ if not os.path.exists(self.build_temp):
|
||||||
|
+ os.makedirs(self.build_temp)
|
||||||
|
+ ret = os.system(
|
||||||
|
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
|
||||||
|
+ tmpfile)
|
||||||
|
+ try:
|
||||||
|
+ if ret >> 8 == 0:
|
||||||
|
+ with open(tmpfile) as fp:
|
||||||
|
+ multiarch_path_component = fp.readline().strip()
|
||||||
|
+ add_dir_to_list(self.compiler.library_dirs,
|
||||||
|
+ '/usr/lib/' + multiarch_path_component)
|
||||||
|
+ add_dir_to_list(self.compiler.include_dirs,
|
||||||
|
+ '/usr/include/' + multiarch_path_component)
|
||||||
|
+ finally:
|
||||||
|
+ os.unlink(tmpfile)
|
||||||
|
+
|
||||||
|
def detect_modules(self):
|
||||||
|
# Ensure that /usr/local is always used
|
||||||
|
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
|
||||||
|
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
||||||
|
+ self.add_multiarch_paths()
|
||||||
|
|
||||||
|
# Add paths specified in the environment variables LDFLAGS and
|
||||||
|
# CPPFLAGS for header and library files.
|
@ -0,0 +1,75 @@
|
|||||||
|
diff -r -u ../Python-3.1/Lib/ssl.py ./Lib/ssl.py
|
||||||
|
--- ../Python-3.1/Lib/ssl.py 2009-06-04 18:42:55.000000000 +0900
|
||||||
|
+++ ./Lib/ssl.py 2015-08-15 13:12:22.270915671 +0900
|
||||||
|
@@ -60,8 +60,20 @@
|
||||||
|
|
||||||
|
from _ssl import SSLError
|
||||||
|
from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
|
||||||
|
-from _ssl import (PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23,
|
||||||
|
+from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23,
|
||||||
|
PROTOCOL_TLSv1)
|
||||||
|
+_PROTOCOL_NAMES = {
|
||||||
|
+ PROTOCOL_TLSv1: "TLSv1",
|
||||||
|
+ PROTOCOL_SSLv23: "SSLv23",
|
||||||
|
+ PROTOCOL_SSLv3: "SSLv3",
|
||||||
|
+}
|
||||||
|
+try:
|
||||||
|
+ from _ssl import PROTOCOL_SSLv2
|
||||||
|
+ _SSLv2_IF_EXISTS = PROTOCOL_SSLv2
|
||||||
|
+except ImportError:
|
||||||
|
+ _SSLv2_IF_EXISTS = None
|
||||||
|
+else:
|
||||||
|
+ _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2"
|
||||||
|
from _ssl import RAND_status, RAND_egd, RAND_add
|
||||||
|
from _ssl import (
|
||||||
|
SSL_ERROR_ZERO_RETURN,
|
||||||
|
@@ -434,13 +446,4 @@
|
||||||
|
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>')
|
||||||
|
diff -r -u ../Python-3.1/Modules/_ssl.c ./Modules/_ssl.c
|
||||||
|
--- ../Python-3.1/Modules/_ssl.c 2009-05-06 07:31:58.000000000 +0900
|
||||||
|
+++ ./Modules/_ssl.c 2015-08-15 13:13:23.812369742 +0900
|
||||||
|
@@ -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,
|
||||||
|
@@ -301,8 +303,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
|
||||||
|
@@ -1693,8 +1697,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",
|
@ -0,0 +1,70 @@
|
|||||||
|
diff -r -u ../Python-3.3.3.orig/Modules/readline.c ./Modules/readline.c
|
||||||
|
--- ../Python-3.3.3.orig/Modules/readline.c 2013-11-17 16:23:01.000000000 +0900
|
||||||
|
+++ ./Modules/readline.c 2014-03-29 16:22:10.219305878 +0900
|
||||||
|
@@ -231,8 +231,7 @@
|
||||||
|
if (!PyArg_ParseTuple(args, buf, &function))
|
||||||
|
return NULL;
|
||||||
|
if (function == Py_None) {
|
||||||
|
- Py_XDECREF(*hook_var);
|
||||||
|
- *hook_var = NULL;
|
||||||
|
+ Py_CLEAR(*hook_var);
|
||||||
|
}
|
||||||
|
else if (PyCallable_Check(function)) {
|
||||||
|
PyObject *tmp = *hook_var;
|
||||||
|
@@ -774,14 +773,22 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
+#if defined(_RL_FUNCTION_TYPEDEF)
|
||||||
|
on_startup_hook(void)
|
||||||
|
+#else
|
||||||
|
+on_startup_hook()
|
||||||
|
+#endif
|
||||||
|
{
|
||||||
|
return on_hook(startup_hook);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
||||||
|
static int
|
||||||
|
+#if defined(_RL_FUNCTION_TYPEDEF)
|
||||||
|
on_pre_input_hook(void)
|
||||||
|
+#else
|
||||||
|
+on_pre_input_hook()
|
||||||
|
+#endif
|
||||||
|
{
|
||||||
|
return on_hook(pre_input_hook);
|
||||||
|
}
|
||||||
|
@@ -819,7 +826,7 @@
|
||||||
|
(r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
- Py_XDECREF(r); r=NULL;
|
||||||
|
+ Py_CLEAR(r);
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
error:
|
||||||
|
@@ -877,7 +884,7 @@
|
||||||
|
* before calling the normal completer */
|
||||||
|
|
||||||
|
static char **
|
||||||
|
-flex_complete(char *text, int start, int end)
|
||||||
|
+flex_complete(const char *text, int start, int end)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
||||||
|
rl_completion_append_character ='\0';
|
||||||
|
@@ -936,12 +943,12 @@
|
||||||
|
rl_bind_key_in_map ('\t', rl_complete, emacs_meta_keymap);
|
||||||
|
rl_bind_key_in_map ('\033', rl_complete, emacs_meta_keymap);
|
||||||
|
/* Set our hook functions */
|
||||||
|
- rl_startup_hook = (Function *)on_startup_hook;
|
||||||
|
+ rl_startup_hook = on_startup_hook;
|
||||||
|
#ifdef HAVE_RL_PRE_INPUT_HOOK
|
||||||
|
- rl_pre_input_hook = (Function *)on_pre_input_hook;
|
||||||
|
+ rl_pre_input_hook = on_pre_input_hook;
|
||||||
|
#endif
|
||||||
|
/* Set our completion function */
|
||||||
|
- rl_attempted_completion_function = (CPPFunction *)flex_complete;
|
||||||
|
+ rl_attempted_completion_function = flex_complete;
|
||||||
|
/* Set Python word break characters */
|
||||||
|
completer_word_break_characters =
|
||||||
|
rl_completer_word_break_characters =
|
@ -0,0 +1,45 @@
|
|||||||
|
diff -r -u ../Python-3.1/setup.py ./setup.py
|
||||||
|
--- ../Python-3.1/setup.py 2009-05-24 02:13:14.000000000 +0900
|
||||||
|
+++ ./setup.py 2015-08-15 13:29:18.300777605 +0900
|
||||||
|
@@ -14,6 +14,7 @@
|
||||||
|
from distutils.command.build_ext import build_ext
|
||||||
|
from distutils.command.install import install
|
||||||
|
from distutils.command.install_lib import install_lib
|
||||||
|
+from distutils.spawn import find_executable
|
||||||
|
|
||||||
|
# This global variable is used to hold the list of modules to be disabled.
|
||||||
|
disabled_module_list = []
|
||||||
|
@@ -293,10 +294,33 @@
|
||||||
|
return platform
|
||||||
|
return sys.platform
|
||||||
|
|
||||||
|
+ def add_multiarch_paths(self):
|
||||||
|
+ # Debian/Ubuntu multiarch support.
|
||||||
|
+ # https://wiki.ubuntu.com/MultiarchSpec
|
||||||
|
+ if not find_executable('dpkg-architecture'):
|
||||||
|
+ return
|
||||||
|
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
|
||||||
|
+ if not os.path.exists(self.build_temp):
|
||||||
|
+ os.makedirs(self.build_temp)
|
||||||
|
+ ret = os.system(
|
||||||
|
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
|
||||||
|
+ tmpfile)
|
||||||
|
+ try:
|
||||||
|
+ if ret >> 8 == 0:
|
||||||
|
+ with open(tmpfile) as fp:
|
||||||
|
+ multiarch_path_component = fp.readline().strip()
|
||||||
|
+ add_dir_to_list(self.compiler.library_dirs,
|
||||||
|
+ '/usr/lib/' + multiarch_path_component)
|
||||||
|
+ add_dir_to_list(self.compiler.include_dirs,
|
||||||
|
+ '/usr/include/' + multiarch_path_component)
|
||||||
|
+ finally:
|
||||||
|
+ os.unlink(tmpfile)
|
||||||
|
+
|
||||||
|
def detect_modules(self):
|
||||||
|
# Ensure that /usr/local is always used
|
||||||
|
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
|
||||||
|
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
||||||
|
+ self.add_multiarch_paths()
|
||||||
|
|
||||||
|
# Add paths specified in the environment variables LDFLAGS and
|
||||||
|
# CPPFLAGS for header and library files.
|
@ -0,0 +1,75 @@
|
|||||||
|
diff -r -u ../Python-3.1/Lib/ssl.py ./Lib/ssl.py
|
||||||
|
--- ../Python-3.1/Lib/ssl.py 2009-06-04 18:42:55.000000000 +0900
|
||||||
|
+++ ./Lib/ssl.py 2015-08-15 13:12:22.270915671 +0900
|
||||||
|
@@ -60,8 +60,20 @@
|
||||||
|
|
||||||
|
from _ssl import SSLError
|
||||||
|
from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
|
||||||
|
-from _ssl import (PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23,
|
||||||
|
+from _ssl import (PROTOCOL_SSLv3, PROTOCOL_SSLv23,
|
||||||
|
PROTOCOL_TLSv1)
|
||||||
|
+_PROTOCOL_NAMES = {
|
||||||
|
+ PROTOCOL_TLSv1: "TLSv1",
|
||||||
|
+ PROTOCOL_SSLv23: "SSLv23",
|
||||||
|
+ PROTOCOL_SSLv3: "SSLv3",
|
||||||
|
+}
|
||||||
|
+try:
|
||||||
|
+ from _ssl import PROTOCOL_SSLv2
|
||||||
|
+ _SSLv2_IF_EXISTS = PROTOCOL_SSLv2
|
||||||
|
+except ImportError:
|
||||||
|
+ _SSLv2_IF_EXISTS = None
|
||||||
|
+else:
|
||||||
|
+ _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2"
|
||||||
|
from _ssl import RAND_status, RAND_egd, RAND_add
|
||||||
|
from _ssl import (
|
||||||
|
SSL_ERROR_ZERO_RETURN,
|
||||||
|
@@ -434,13 +446,4 @@
|
||||||
|
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>')
|
||||||
|
diff -r -u ../Python-3.1/Modules/_ssl.c ./Modules/_ssl.c
|
||||||
|
--- ../Python-3.1/Modules/_ssl.c 2009-05-06 07:31:58.000000000 +0900
|
||||||
|
+++ ./Modules/_ssl.c 2015-08-15 13:13:23.812369742 +0900
|
||||||
|
@@ -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,
|
||||||
|
@@ -301,8 +303,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
|
||||||
|
@@ -1693,8 +1697,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",
|
Loading…
x
Reference in New Issue
Block a user