Kaydet (Commit) f36c75f6 authored tarafından Thomas Arnhold's avatar Thomas Arnhold Kaydeden (comit) Fridrich Štrba

upgrade to python-3.3.5

- remove now obselete patches, which were applied upstream.
- Hack to get MacOS to build

Change-Id: Id68e78e411efc92a46ea9e180f09c390fe5acb4a
Reviewed-on: https://gerrit.libreoffice.org/9311Tested-by: 's avatarLibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 98071966
...@@ -110,7 +110,8 @@ export PNG_MD5SUM := 5266905cef49d1224437465ad4d67fd9 ...@@ -110,7 +110,8 @@ export PNG_MD5SUM := 5266905cef49d1224437465ad4d67fd9
export PNG_TARBALL := libpng-1.5.18.tar.gz export PNG_TARBALL := libpng-1.5.18.tar.gz
export POPPLER_TARBALL := 1cd27460f7e3379d1eb109cfd7bcdb39-poppler-0.22.5.tar.gz export POPPLER_TARBALL := 1cd27460f7e3379d1eb109cfd7bcdb39-poppler-0.22.5.tar.gz
export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2 export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
export PYTHON_TARBALL := f3ebe34d4d8695bf889279b54673e10c-Python-3.3.3.tar.bz2 export PYTHON_MD5SUM := 803a75927f8f241ca78633890c798021
export PYTHON_TARBALL := Python-3.3.5.tgz
export RAPTOR_TARBALL := 4ceb9316488b0ea01acf011023cf7fff-raptor2-2.0.9.tar.gz export RAPTOR_TARBALL := 4ceb9316488b0ea01acf011023cf7fff-raptor2-2.0.9.tar.gz
export RASQAL_TARBALL := b12c5f9cfdb6b04efce5a4a186b8416b-rasqal-0.9.30.tar.gz export RASQAL_TARBALL := b12c5f9cfdb6b04efce5a4a186b8416b-rasqal-0.9.30.tar.gz
export REDLAND_TARBALL := 32f8e1417a64d3c6f2c727f9053f55ea-redland-1.0.16.tar.gz export REDLAND_TARBALL := 32f8e1417a64d3c6f2c727f9053f55ea-redland-1.0.16.tar.gz
......
...@@ -24,13 +24,12 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\ ...@@ -24,13 +24,12 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
external/python3/python-3.3.0-msvc-disable.patch.1 \ external/python3/python-3.3.0-msvc-disable.patch.1 \
external/python3/python-3.3.0-msvc-x64.patch.1 \ external/python3/python-3.3.0-msvc-x64.patch.1 \
external/python3/python-3.3.0-ssl.patch.1 \ external/python3/python-3.3.0-ssl.patch.1 \
external/python3/python-3.3.0-implicit-int.patch.1 \
external/python3/python-3.3.0-gcc-4.8.patch.1 \ external/python3/python-3.3.0-gcc-4.8.patch.1 \
external/python3/python-3.3.0-pythreadstate.patch.1 \ external/python3/python-3.3.0-pythreadstate.patch.1 \
external/python3/python-3.3.0-clang.patch.1 \ external/python3/python-3.3.0-clang.patch.1 \
external/python3/python-3.3.3-quoted-printable.patch.1 \
external/python3/python-3.3.3-py17797.patch.1 \ external/python3/python-3.3.3-py17797.patch.1 \
external/python3/python-3.3.3-msvc2012-winxp.patch.1 \ external/python3/python-3.3.3-msvc2012-winxp.patch.1 \
external/python3/python-3.3.5-pyexpat-symbols.patch.1 \
)) ))
ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),) ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD SOLARIS,$(OS)),)
......
fix function names in import.h
MSVC complains about some declarations in Include/import.h.
Apparently the problem is a missing space between PyAPI_FUNC(int) and the
function name, leading to concatenated int_PyImport... names and no
return type.
diff -ru python3.old/Include/import.h python3/Include/import.h
--- python3.old/Include/import.h 2012-09-29 10:00:26.000000000 +0200
+++ python3/Include/import.h 2012-11-27 16:09:26.449390966 +0100
@@ -86,15 +86,15 @@
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
-PyAPI_FUNC(PyObject *)_PyImport_FindBuiltin(
+PyAPI_FUNC(PyObject *) _PyImport_FindBuiltin(
const char *name /* UTF-8 encoded string */
);
-PyAPI_FUNC(PyObject *)_PyImport_FindExtensionObject(PyObject *, PyObject *);
-PyAPI_FUNC(int)_PyImport_FixupBuiltin(
+PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *);
+PyAPI_FUNC(int) _PyImport_FixupBuiltin(
PyObject *mod,
char *name /* UTF-8 encoded string */
);
-PyAPI_FUNC(int)_PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
+PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
struct _inittab {
char *name; /* ASCII encoded string */
...@@ -210,7 +210,7 @@ diff -ru python3/PCbuild/pcbuild.sln python3.new/PCbuild/pcbuild.sln ...@@ -210,7 +210,7 @@ diff -ru python3/PCbuild/pcbuild.sln python3.new/PCbuild/pcbuild.sln
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
--- python3/PCbuild/pythoncore.vcxproj --- python3/PCbuild/pythoncore.vcxproj
+++ python3/PCbuild/pythoncore.vcxproj +++ python3/PCbuild/pythoncore.vcxproj
@@ -185,35 +185,35 @@ @@ -195,35 +195,35 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl> <Midl>
<TargetEnvironment>X64</TargetEnvironment> <TargetEnvironment>X64</TargetEnvironment>
...@@ -236,14 +236,14 @@ diff -ru python3/PCbuild/pcbuild.sln python3.new/PCbuild/pcbuild.sln ...@@ -236,14 +236,14 @@ diff -ru python3/PCbuild/pcbuild.sln python3.new/PCbuild/pcbuild.sln
<IgnoreSpecificDefaultLibraries>libc;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>libc;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<BaseAddress>0x1e000000</BaseAddress> <BaseAddress>0x1e000000</BaseAddress>
</Link> </Link>
<PreBuildEvent>
<Command>$(KillPythonExe)
IF %ERRORLEVEL% NEQ 0 (
echo kill_python: warning: could not kill running Pythons, exit code %ERRORLEVEL%
exit /b 0
)</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Killing any running $(PythonExe) instances...</Message>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\Python;..\Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_ENABLE_SHARED;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
# HG changeset patch
# User R David Murray <rdmurray@bitdance.com>
# Date 1389637161 18000
# Node ID 4c5b1932354bc4707ef182cf0fa61b2e8ccfaa5e
# Parent 0ce2396a134bebca11b17337734d5e9966e2a95f
#20206, #5803: more efficient algorithm that doesn't truncate output.
This fixes an edge case (20206) where if the input ended in a character
needing encoding but there was no newline on the string, the last byte
of the encoded character would be dropped. The fix is to use a more
efficient algorithm, provided by Serhiy Storchaka (5803), that does not
have the bug.
diff --git a/Lib/email/quoprimime.py b/Lib/email/quoprimime.py
--- a/Lib/email/quoprimime.py
+++ b/Lib/email/quoprimime.py
@@ -53,8 +53,9 @@ EMPTYSTRING = ''
# space-wise. Remember that headers and bodies have different sets of safe
# characters. Initialize both maps with the full expansion, and then override
# the safe bytes with the more compact form.
-_QUOPRI_HEADER_MAP = dict((c, '=%02X' % c) for c in range(256))
-_QUOPRI_BODY_MAP = _QUOPRI_HEADER_MAP.copy()
+_QUOPRI_MAP = ['=%02X' % c for c in range(256)]
+_QUOPRI_HEADER_MAP = _QUOPRI_MAP[:]
+_QUOPRI_BODY_MAP = _QUOPRI_MAP[:]
# Safe header bytes which need no encoding.
for c in b'-!*+/' + ascii_letters.encode('ascii') + digits.encode('ascii'):
@@ -121,8 +122,7 @@ def unquote(s):
def quote(c):
- return '=%02X' % ord(c)
-
+ return _QUOPRI_MAP[ord(c)]
def header_encode(header_bytes, charset='iso-8859-1'):
@@ -140,67 +140,15 @@ def header_encode(header_bytes, charset=
if not header_bytes:
return ''
# Iterate over every byte, encoding if necessary.
- encoded = []
- for octet in header_bytes:
- encoded.append(_QUOPRI_HEADER_MAP[octet])
+ encoded = header_bytes.decode('latin1').translate(_QUOPRI_HEADER_MAP)
# Now add the RFC chrome to each encoded chunk and glue the chunks
# together.
- return '=?%s?q?%s?=' % (charset, EMPTYSTRING.join(encoded))
+ return '=?%s?q?%s?=' % (charset, encoded)
-class _body_accumulator(io.StringIO):
-
- def __init__(self, maxlinelen, eol, *args, **kw):
- super().__init__(*args, **kw)
- self.eol = eol
- self.maxlinelen = self.room = maxlinelen
-
- def write_str(self, s):
- """Add string s to the accumulated body."""
- self.write(s)
- self.room -= len(s)
-
- def newline(self):
- """Write eol, then start new line."""
- self.write_str(self.eol)
- self.room = self.maxlinelen
-
- def write_soft_break(self):
- """Write a soft break, then start a new line."""
- self.write_str('=')
- self.newline()
-
- def write_wrapped(self, s, extra_room=0):
- """Add a soft line break if needed, then write s."""
- if self.room < len(s) + extra_room:
- self.write_soft_break()
- self.write_str(s)
-
- def write_char(self, c, is_last_char):
- if not is_last_char:
- # Another character follows on this line, so we must leave
- # extra room, either for it or a soft break, and whitespace
- # need not be quoted.
- self.write_wrapped(c, extra_room=1)
- elif c not in ' \t':
- # For this and remaining cases, no more characters follow,
- # so there is no need to reserve extra room (since a hard
- # break will immediately follow).
- self.write_wrapped(c)
- elif self.room >= 3:
- # It's a whitespace character at end-of-line, and we have room
- # for the three-character quoted encoding.
- self.write(quote(c))
- elif self.room == 2:
- # There's room for the whitespace character and a soft break.
- self.write(c)
- self.write_soft_break()
- else:
- # There's room only for a soft break. The quoted whitespace
- # will be the only content on the subsequent line.
- self.write_soft_break()
- self.write(quote(c))
-
+_QUOPRI_BODY_ENCODE_MAP = _QUOPRI_BODY_MAP[:]
+for c in b'\r\n':
+ _QUOPRI_BODY_ENCODE_MAP[c] = chr(c)
def body_encode(body, maxlinelen=76, eol=NL):
"""Encode with quoted-printable, wrapping at maxlinelen characters.
@@ -226,26 +174,56 @@ def body_encode(body, maxlinelen=76, eol
if not body:
return body
- # The last line may or may not end in eol, but all other lines do.
- last_has_eol = (body[-1] in '\r\n')
+ # quote speacial characters
+ body = body.translate(_QUOPRI_BODY_ENCODE_MAP)
- # This accumulator will make it easier to build the encoded body.
- encoded_body = _body_accumulator(maxlinelen, eol)
+ soft_break = '=' + eol
+ # leave space for the '=' at the end of a line
+ maxlinelen1 = maxlinelen - 1
- lines = body.splitlines()
- last_line_no = len(lines) - 1
- for line_no, line in enumerate(lines):
- last_char_index = len(line) - 1
- for i, c in enumerate(line):
- if body_check(ord(c)):
- c = quote(c)
- encoded_body.write_char(c, i==last_char_index)
- # Add an eol if input line had eol. All input lines have eol except
- # possibly the last one.
- if line_no < last_line_no or last_has_eol:
- encoded_body.newline()
+ encoded_body = []
+ append = encoded_body.append
- return encoded_body.getvalue()
+ for line in body.splitlines():
+ # break up the line into pieces no longer than maxlinelen - 1
+ start = 0
+ laststart = len(line) - 1 - maxlinelen
+ while start <= laststart:
+ stop = start + maxlinelen1
+ # make sure we don't break up an escape sequence
+ if line[stop - 2] == '=':
+ append(line[start:stop - 1])
+ start = stop - 2
+ elif line[stop - 1] == '=':
+ append(line[start:stop])
+ start = stop - 1
+ else:
+ append(line[start:stop] + '=')
+ start = stop
+
+ # handle rest of line, special case if line ends in whitespace
+ if line and line[-1] in ' \t':
+ room = start - laststart
+ if room >= 3:
+ # It's a whitespace character at end-of-line, and we have room
+ # for the three-character quoted encoding.
+ q = quote(line[-1])
+ elif room == 2:
+ # There's room for the whitespace character and a soft break.
+ q = line[-1] + soft_break
+ else:
+ # There's room only for a soft break. The quoted whitespace
+ # will be the only content on the subsequent line.
+ q = soft_break + quote(line[-1])
+ append(line[start:-1] + q)
+ else:
+ append(line[start:])
+
+ # add back final newline if present
+ if body[-1] in CRLF:
+ append('')
+
+ return eol.join(encoded_body)
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -4216,6 +4216,11 @@ class TestQuopri(unittest.TestCase):
def test_encode_one_line_eol(self):
self._test_encode('hello\n', 'hello\r\n', eol='\r\n')
+ def test_encode_one_line_eol_after_non_ascii(self):
+ # issue 20206; see changeset 0cf700464177 for why the encode/decode.
+ self._test_encode('hello\u03c5\n'.encode('utf-8').decode('latin1'),
+ 'hello=CF=85\r\n', eol='\r\n')
+
def test_encode_one_space(self):
self._test_encode(' ', '=20')
HACK: Fix build breakage on MacOS:
*** WARNING: renaming "pyexpat" since importing it failed: dlopen(build/lib.macosx-10.6-i386-3.3/pyexpat.so, 2): Symbol not found: _XML_ErrorString
This reverts c242a8f30806 from the python hg repo:
restore namespacing of pyexpat symbols (closes #19186)
See http://bugs.python.org/issue19186#msg214069
The recommendation to include Modules/inc at first broke the Linux build...
So do it this way, as it was before. Needs some realignment later.
--- python3/Modules/expat/expat_external.h
+++ python3/Modules/expat/expat_external.h
@@ -7,10 +7,6 @@
/* External API definitions */
-/* Namespace external symbols to allow multiple libexpat version to
- co-exist. */
-#include "pyexpatns.h"
-
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
#define XML_USE_MSC_EXTENSIONS 1
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment