From: Oleg Broytman Date: Wed, 14 Jun 2017 22:17:25 +0000 (+0300) Subject: Fixed last problems with Python 3 X-Git-Tag: 2.8.0~35 X-Git-Url: https://git.phdru.name/?p=mimedecode.git;a=commitdiff_plain;h=dfed6f14d5081d17f9e9bf4d7f2eb6fc6a5bf949 Fixed last problems with Python 3 --- diff --git a/ChangeLog b/ChangeLog index 211c766..e6d5d97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ Version 2.8.0 (2017-05-??) Fix: do not decode bytes to unicode under Python 2.7. + Fixed last problems with Python 3. + Version 2.7.0 (2017-04-26) Use m_lib.defenc instead of m_lib; install it from PyPI. diff --git a/TODO b/TODO index 8dfe2da..e9223a1 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,3 @@ -Python 3. - - tox. diff --git a/setup.py b/setup.py index e100825..af03bfb 100755 --- a/setup.py +++ b/setup.py @@ -33,6 +33,11 @@ setup(name = "mimedecode", 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2 :: Only', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', ], py_modules = ['formatparam_27', 'mimedecode_version'], scripts = ['mimedecode.py'], diff --git a/test/expected/msg_26.txt-py3 b/test/expected/msg_26.txt-py3 new file mode 100644 index 0000000..bf28802 Binary files /dev/null and b/test/expected/msg_26.txt-py3 differ diff --git a/test/expected/msg_39.txt-py3 b/test/expected/msg_39.txt-py3 new file mode 100644 index 0000000..5866bf7 --- /dev/null +++ b/test/expected/msg_39.txt-py3 @@ -0,0 +1,87 @@ +From test Sat Feb 1 00:00:00 2014 +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" + +------- =_aaaaaaaaaa0 +Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa1" +Content-ID: <20592.1022586929.1@example.com> + +------- =_aaaaaaaaaa1 +Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" +Content-ID: <20592.1022586929.2@example.com> + + +------- =_aaaaaaaaaa1 +Content-Type: application/octet-stream +Content-ID: <20592.1022586929.3@example.com> +Content-Description: patch1 +Content-Transfer-Encoding: 8bit +X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode.py + +]u +------- =_aaaaaaaaaa1 +Content-Type: application/octet-stream +Content-ID: <20592.1022586929.4@example.com> +Content-Description: patch2 +Content-Transfer-Encoding: 8bit +X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode.py + +]u +------- =_aaaaaaaaaa1-- + +------- =_aaaaaaaaaa1 +Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" +Content-ID: <20592.1022586929.6@example.com> + +------- =_aaaaaaaaaa1 +Content-Type: application/octet-stream +Content-ID: <20592.1022586929.7@example.com> +Content-Description: patch3 +Content-Transfer-Encoding: base64 + +XXX + +------- =_aaaaaaaaaa1 +Content-Type: application/octet-stream +Content-ID: <20592.1022586929.8@example.com> +Content-Description: patch4 +Content-Transfer-Encoding: base64 + +XXX + +------- =_aaaaaaaaaa1-- + +------- =_aaaaaaaaaa1 +Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1" +Content-ID: <20592.1022586929.10@example.com> + +------- =_aaaaaaaaaa1 +Content-Type: application/octet-stream +Content-ID: <20592.1022586929.11@example.com> +Content-Description: patch5 +Content-Transfer-Encoding: base64 + +XXX + +------- =_aaaaaaaaaa1 +Content-Type: application/octet-stream +Content-ID: <20592.1022586929.12@example.com> +Content-Description: patch6 +Content-Transfer-Encoding: base64 + +XXX + +------- =_aaaaaaaaaa1-- + +------- =_aaaaaaaaaa1-- + +------- =_aaaaaaaaaa0 +Content-ID: <20592.1022586929.15@example.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode.py + +-- +It's never too late to have a happy childhood. + +------- =_aaaaaaaaaa0-- diff --git a/test/test_all b/test/test_all index b05f383..d5b06e1 100755 --- a/test/test_all +++ b/test/test_all @@ -8,11 +8,19 @@ rm -rf save tmp && mkdir tmp || exit 1 RC=0 +if [ `$PYTHON -c "import sys; print(sys.version[0])"` -eq 2 ]; then + PY3=NO +else + PY3=YES +fi test1() { infile="$1" shift expfile="$1" + if [ $PY3 = YES -a -f expected/"$expfile"-py3 ]; then + expfile="$expfile"-py3 + fi shift $PYTHON ../mimedecode.py -H test -f utf-8 "$@" input/"$infile" >tmp/"$expfile" || return 1