From: Oleg Broytman Date: Tue, 12 Dec 2017 11:55:25 +0000 (+0300) Subject: Split mimedecode.py into a mimedecode library and a small script X-Git-Tag: 2.9.0~6 X-Git-Url: https://git.phdru.name/?p=mimedecode.git;a=commitdiff_plain;h=0d9cead275145c7e37e9acc6c1bd62bbbfd09f2e Split mimedecode.py into a mimedecode library and a small script --- diff --git a/ANNOUNCE b/ANNOUNCE index 05d7830..198bf47 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -30,16 +30,18 @@ everything else. This is how it could be done: mimedecode.py -t application/pdf -t application/postscript -t text/plain -b text/html -B 'image/*' -i '*/*' +Version 2.9.0 (2017-12-??) + + Split mimedecode.py into a mimedecode library and a small script. + + Made the library executable via ``python -m mimedecode``. + Version 2.8.0 (2017-11-03) Python 3. Stop supporting Python 2.6. - Code cleanup: fixed flake8 errors and warnings. - - Pushed to GitHub. Tests at Travis. - WHERE TO GET Home page: http://phdru.name/Software/Python/#mimedecode diff --git a/ChangeLog b/ChangeLog index eeb317c..5ea9936 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Version 2.9.0 (2017-12-??) + + Split mimedecode.py into a mimedecode library and a small script. + + Moved formatparam_27.py and mimedecode_version.py to the library. + + Made the library executable via ``python -m mimedecode``. + + Renamed mimedecode_version.py to __version__.py. + Version 2.8.0 (2017-11-03) Python 3. diff --git a/Makefile.4xslt b/Makefile.4xslt index 96981a0..cea0f13 100644 --- a/Makefile.4xslt +++ b/Makefile.4xslt @@ -5,7 +5,7 @@ mimedecode.html: mimedecode.docbook Makefile.4xslt mimedecode.man: mimedecode.docbook Makefile.4xslt 4xslt $< $(DOCBOOK_XSL)/manpages/docbook.xsl - mv mimedecode.py.1 $@ + mv mimedecode.1 $@ mimedecode.txt: mimedecode.html Makefile.4xslt elinks -dump -no-numbering -no-references $< >$@ diff --git a/Makefile.sgmlt b/Makefile.sgmlt index cadd36f..ba8e333 100644 --- a/Makefile.sgmlt +++ b/Makefile.sgmlt @@ -1,6 +1,6 @@ mimedecode.html: mimedecode.docbook Makefile.sgmlt sgmltools -b html $< - mv mimedecode/mimedecode.py.html mimedecode.html + mv mimedecode/mimedecode.html mimedecode.html rmdir mimedecode mimedecode.man: mimedecode.docbook Makefile.sgmlt diff --git a/Makefile.xsltproc b/Makefile.xsltproc index c800f78..421f413 100644 --- a/Makefile.xsltproc +++ b/Makefile.xsltproc @@ -5,7 +5,7 @@ mimedecode.html: mimedecode.docbook Makefile.xsltproc mimedecode.man: mimedecode.docbook Makefile.xsltproc xsltproc $(DOCBOOK_XSL)/manpages/docbook.xsl $< - mv mimedecode.py.1 $@ + mv mimedecode.1 $@ mimedecode.txt: mimedecode.html Makefile.xsltproc elinks -dump -no-numbering -no-references $< >$@ diff --git a/TODO b/TODO index e665141..62aa862 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,3 @@ -Split mimedecode.py into a library and a small script. -Move formatparam_27.py and mimedecode_version.py to the library. -Rename mimedecode_version.py to __version__.py. - - -Release 2.9. - - Convert mimedecode.py library from global functions to a class. diff --git a/mimedecode.docbook b/mimedecode.docbook index 0129709..8da5d2f 100644 --- a/mimedecode.docbook +++ b/mimedecode.docbook @@ -2,10 +2,10 @@ - + - mimedecode.py + mimedecode mimedecode.docbook Oleg @@ -20,18 +20,18 @@ - mimedecode.py + mimedecode 1 - mimedecode.py + mimedecode decode MIME message - mimedecode.py + mimedecode @@ -122,7 +122,7 @@ - Here is a solution - mimedecode.py! + Here is a solution - mimedecode! @@ -494,8 +494,8 @@ Save output to the file related to the destination directory from option -O. Also useful in case of redirected stdin: - mimedecode.py -o output_file < input_file -cat input_file | mimedecode.py -o output_file + mimedecode -o output_file < input_file +cat input_file | mimedecode -o output_file @@ -512,7 +512,7 @@ cat input_file | mimedecode.py -o output_file - mimedecode.py -t application/pdf -t application/postscript -t text/plain + mimedecode -t application/pdf -t application/postscript -t text/plain -b text/html -B 'image/*' -i '*/*' @@ -641,7 +641,7 @@ cat input_file | mimedecode.py -o output_file SEE ALSO - mimedecode.py home page: + mimedecode home page: http://phdru.name/Software/Python/#mimedecode diff --git a/mimedecode/__init__.py b/mimedecode/__init__.py new file mode 100644 index 0000000..792d600 --- /dev/null +++ b/mimedecode/__init__.py @@ -0,0 +1 @@ +# diff --git a/mimedecode/__main__.py b/mimedecode/__main__.py new file mode 100644 index 0000000..d41b0c0 --- /dev/null +++ b/mimedecode/__main__.py @@ -0,0 +1,4 @@ +from .mimedecode import main + +if __name__ == "__main__": + main() diff --git a/mimedecode_version.py b/mimedecode/__version__.py similarity index 85% rename from mimedecode_version.py rename to mimedecode/__version__.py index 1c7393c..f5653d0 100644 --- a/mimedecode_version.py +++ b/mimedecode/__version__.py @@ -1,4 +1,4 @@ -__version__ = "2.8.0" +__version__ = "2.9.0" __author__ = "Oleg Broytman " __copyright__ = "Copyright (C) 2001-2017 PhiloSoft Design" __license__ = "GNU GPL" diff --git a/formatparam_27.py b/mimedecode/formatparam_27.py similarity index 100% rename from formatparam_27.py rename to mimedecode/formatparam_27.py diff --git a/mimedecode.py b/mimedecode/mimedecode.py similarity index 99% rename from mimedecode.py rename to mimedecode/mimedecode.py index 9019669..c3d4e0a 100755 --- a/mimedecode.py +++ b/mimedecode/mimedecode.py @@ -5,12 +5,12 @@ import os import subprocess import sys -from mimedecode_version import __version__, __copyright__ +from .__version__ import __version__, __copyright__ if sys.version_info[0] >= 3: # Replace email.message._formatparam with _formatparam from Python 2.7 # to avoid re-encoding non-ascii params. - import formatparam_27 # noqa: F401: Imported for its side effect + from mimedecode import formatparam_27 # noqa: F401: Imported for its side effect me = os.path.basename(sys.argv[0]) @@ -678,7 +678,7 @@ def get_opts(): return arguments -if __name__ == "__main__": +def main(): arguments = get_opts() la = len(arguments) @@ -725,6 +725,7 @@ if __name__ == "__main__": g.host_name = socket.gethostname() g.outfile = outfile + global output if hasattr(outfile, 'buffer'): def output_bytes(s): if not isinstance(s, bytes): @@ -749,3 +750,7 @@ if __name__ == "__main__": finally: infile.close() outfile.close() + + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py index fcfb53e..6d51a56 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,8 @@ #! /usr/bin/env python +from imp import load_source +from os.path import abspath, dirname, join + try: from setuptools import setup is_setuptools = True @@ -7,7 +10,9 @@ except ImportError: from distutils.core import setup is_setuptools = False -from mimedecode_version import __version__, __copyright__, __license__ +versionpath = join(abspath(dirname(__file__)), "mimedecode", "__version__.py") +load_source("mimedecode_version", versionpath) +from mimedecode_version import __version__, __copyright__, __license__ # noqa: ignore flake8 E402 kw = {} if is_setuptools: @@ -43,7 +48,11 @@ setup( 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', ], - py_modules=['formatparam_27', 'mimedecode_version'], - scripts=['mimedecode.py'], + packages=['mimedecode'], + entry_points={ + 'console_scripts': [ + 'mimedecode = mimedecode.__main__:main' + ] + }, **kw ) diff --git a/test/expected-save/msg_07-1.txt b/test/expected-save/msg_07-1.txt index 0ddf15f..e2b1480 100644 --- a/test/expected-save/msg_07-1.txt +++ b/test/expected-save/msg_07-1.txt @@ -1,5 +1,5 @@ Content-Type: image/gif; name="dingusfish.gif" Content-Transfer-Encoding: 8bit content-disposition: attachment; filename="dingusfish.gif" -X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode diff --git a/test/expected-save/msg_07-3.txt b/test/expected-save/msg_07-3.txt index cc8962b..89bed6d 100644 Binary files a/test/expected-save/msg_07-3.txt and b/test/expected-save/msg_07-3.txt differ diff --git a/test/expected-save/msg_07-4.txt b/test/expected-save/msg_07-4.txt index 0471928..90e022b 100644 Binary files a/test/expected-save/msg_07-4.txt and b/test/expected-save/msg_07-4.txt differ diff --git a/test/expected/msg_01-1.txt b/test/expected/msg_01-1.txt index 86498c6..6f99b0d 100644 --- a/test/expected/msg_01-1.txt +++ b/test/expected/msg_01-1.txt @@ -12,7 +12,7 @@ Date: Fri, 4 May 2001 14:05:44 -0400 X-Test: set 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Hi, diff --git a/test/expected/msg_01-2.txt b/test/expected/msg_01-2.txt index 09c4e43..fe68973 100644 --- a/test/expected/msg_01-2.txt +++ b/test/expected/msg_01-2.txt @@ -12,7 +12,7 @@ Date: Fri, 4 May 2001 14:05:44 -0400 X-Test: set; test="set" 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Hi, diff --git a/test/expected/msg_01.txt b/test/expected/msg_01.txt index 4a8565f..8c60f02 100644 --- a/test/expected/msg_01.txt +++ b/test/expected/msg_01.txt @@ -11,7 +11,7 @@ Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Hi, diff --git a/test/expected/msg_02-1.txt b/test/expected/msg_02-1.txt index f854c3e..f686142 100644 --- a/test/expected/msg_02-1.txt +++ b/test/expected/msg_02-1.txt @@ -13,7 +13,7 @@ X-Mailer: Mailman v2.0.4; test="set" Content-description: Masthead (Ppp digest, Vol 1 #2) 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Send Ppp mailing list submissions to ppp@zzz.org @@ -34,7 +34,7 @@ than "Re: Contents of Ppp digest..." Content-description: Today's Topics (5 msgs) 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Today's Topics: @@ -58,7 +58,7 @@ Subject: [Ppp] testing #1 Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -74,7 +74,7 @@ From: barry@digicool.com (Barry A. Warsaw) Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -91,7 +91,7 @@ Subject: [Ppp] testing #3 Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -108,7 +108,7 @@ Subject: [Ppp] testing #4 Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -125,7 +125,7 @@ Subject: [Ppp] testing #5 Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -139,7 +139,7 @@ hello Content-description: Digest Footer 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode _______________________________________________ Ppp mailing list diff --git a/test/expected/msg_02.txt b/test/expected/msg_02.txt index f12dd12..28d33c7 100644 --- a/test/expected/msg_02.txt +++ b/test/expected/msg_02.txt @@ -13,7 +13,7 @@ Content-Type: multipart/mixed; boundary="192.168.1.2.889.32614.987812255.500.218 Content-description: Masthead (Ppp digest, Vol 1 #2) 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Send Ppp mailing list submissions to ppp@zzz.org @@ -34,7 +34,7 @@ than "Re: Contents of Ppp digest..." Content-description: Today's Topics (5 msgs) 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Today's Topics: @@ -58,7 +58,7 @@ Subject: [Ppp] testing #1 Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -74,7 +74,7 @@ From: barry@digicool.com (Barry A. Warsaw) Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -91,7 +91,7 @@ Subject: [Ppp] testing #3 Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -108,7 +108,7 @@ Subject: [Ppp] testing #4 Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -125,7 +125,7 @@ Subject: [Ppp] testing #5 Precedence: bulk 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode hello @@ -139,7 +139,7 @@ hello Content-description: Digest Footer 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode _______________________________________________ Ppp mailing list diff --git a/test/expected/msg_06.txt b/test/expected/msg_06.txt index 67a0c07..e4dd02b 100644 --- a/test/expected/msg_06.txt +++ b/test/expected/msg_06.txt @@ -30,6 +30,6 @@ X-Oblique-Strategy: Spectrum analysis X-Url: http://barry.wooz.org 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode diff --git a/test/expected/msg_07-1.txt b/test/expected/msg_07-1.txt index 9ed3c2f..f54260d 100644 Binary files a/test/expected/msg_07-1.txt and b/test/expected/msg_07-1.txt differ diff --git a/test/expected/msg_07.txt b/test/expected/msg_07.txt index 9cfaa68..6fe903a 100644 Binary files a/test/expected/msg_07.txt and b/test/expected/msg_07.txt differ diff --git a/test/expected/msg_08.txt b/test/expected/msg_08.txt index fd966be..3855827 100644 --- a/test/expected/msg_08.txt +++ b/test/expected/msg_08.txt @@ -9,27 +9,27 @@ Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode --BOUNDARY X-MIME-Autoconverted: from text/html to text/plain by test id ./html2txt.py MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode --BOUNDARY MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-2 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-2 to utf-8 by test id mimedecode --BOUNDARY MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from koi8-r to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from koi8-r to utf-8 by test id mimedecode --BOUNDARY-- diff --git a/test/expected/msg_09.txt b/test/expected/msg_09.txt index 8c8d773..9fb0163 100644 --- a/test/expected/msg_09.txt +++ b/test/expected/msg_09.txt @@ -9,14 +9,14 @@ Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode --BOUNDARY X-MIME-Autoconverted: from text/html to text/plain by test id ./html2txt.py MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode @@ -27,7 +27,7 @@ Content-Type: text/plain --BOUNDARY MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from koi8-r to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from koi8-r to utf-8 by test id mimedecode --BOUNDARY-- diff --git a/test/expected/msg_10.txt b/test/expected/msg_10.txt index e59a81b..b0abcb2 100644 --- a/test/expected/msg_10.txt +++ b/test/expected/msg_10.txt @@ -10,42 +10,42 @@ Content-Type: multipart/mixed; boundary="BOUNDARY" Content-Transfer-Encoding: 7bit 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode This is a 7bit encoded message. --BOUNDARY Content-Transfer-Encoding: 8bit -X-MIME-Autoconverted: from Quoted-Printable to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from Quoted-Printable to 8bit by test id mimedecode X-MIME-Autoconverted: from text/html to text/plain by test id ./html2txt.py MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode ¡This is a Quoted Printable encoded message! --BOUNDARY Content-Transfer-Encoding: 8bit -X-MIME-Autoconverted: from Base64 to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from Base64 to 8bit by test id mimedecode MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode This is a Base64 encoded message. --BOUNDARY Content-Transfer-Encoding: 8bit -X-MIME-Autoconverted: from Base64 to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from Base64 to 8bit by test id mimedecode MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode This is a Base64 encoded message. --BOUNDARY MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode This has no Content-Transfer-Encoding: header. diff --git a/test/expected/msg_12.txt b/test/expected/msg_12.txt index e765d01..2ff11bc 100644 --- a/test/expected/msg_12.txt +++ b/test/expected/msg_12.txt @@ -9,14 +9,14 @@ Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode --BOUNDARY X-MIME-Autoconverted: from text/html to text/plain by test id ./html2txt.py MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode @@ -26,13 +26,13 @@ Content-Type: multipart/mixed; boundary="ANOTHER" --ANOTHER MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-2 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-2 to utf-8 by test id mimedecode --ANOTHER MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-3 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-3 to utf-8 by test id mimedecode --ANOTHER-- @@ -40,13 +40,13 @@ X-MIME-Autoconverted: from iso-8859-3 to utf-8 by test id mimedecode.py --BOUNDARY 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode --BOUNDARY MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from koi8-r to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from koi8-r to utf-8 by test id mimedecode --BOUNDARY-- diff --git a/test/expected/msg_12a.txt b/test/expected/msg_12a.txt index 9d67283..48a2112 100644 --- a/test/expected/msg_12a.txt +++ b/test/expected/msg_12a.txt @@ -9,14 +9,14 @@ Content-Type: multipart/mixed; boundary="BOUNDARY" --BOUNDARY 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode --BOUNDARY X-MIME-Autoconverted: from text/html to text/plain by test id ./html2txt.py MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode @@ -26,13 +26,13 @@ Content-Type: multipart/mixed; boundary="ANOTHER" --ANOTHER MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-2 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-2 to utf-8 by test id mimedecode --ANOTHER MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-3 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-3 to utf-8 by test id mimedecode --ANOTHER-- @@ -41,13 +41,13 @@ X-MIME-Autoconverted: from iso-8859-3 to utf-8 by test id mimedecode.py --BOUNDARY 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode --BOUNDARY MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from koi8-r to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from koi8-r to utf-8 by test id mimedecode --BOUNDARY-- diff --git a/test/expected/msg_13.txt b/test/expected/msg_13.txt index 1e0cdf3..baa4d71 100644 Binary files a/test/expected/msg_13.txt and b/test/expected/msg_13.txt differ diff --git a/test/expected/msg_14.txt b/test/expected/msg_14.txt index 70c0e14..c78e454 100644 --- a/test/expected/msg_14.txt +++ b/test/expected/msg_14.txt @@ -11,7 +11,7 @@ Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Hi, diff --git a/test/expected/msg_15-1.txt b/test/expected/msg_15-1.txt index 272ad45..416e7f6 100644 --- a/test/expected/msg_15-1.txt +++ b/test/expected/msg_15-1.txt @@ -20,17 +20,17 @@ Content-type: multipart/alternative; --MS_Mac_OE_3071477847_720252_MIME_Part Content-transfer-encoding: 8bit -X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode Some removed test. --MS_Mac_OE_3071477847_720252_MIME_Part Content-type: text/html; charset="ISO-8859-1" Content-transfer-encoding: 8bit -X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode diff --git a/test/expected/msg_15-2.txt b/test/expected/msg_15-2.txt index 50d8a05..60e9298 100644 --- a/test/expected/msg_15-2.txt +++ b/test/expected/msg_15-2.txt @@ -20,17 +20,17 @@ Content-type: multipart/alternative; --MS_Mac_OE_3071477847_720252_MIME_Part Content-transfer-encoding: 8bit -X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode Some removed test. --MS_Mac_OE_3071477847_720252_MIME_Part Content-type: text/html; charset="ISO-8859-1" Content-transfer-encoding: 8bit -X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode Message body of type text/html skipped. diff --git a/test/expected/msg_15.txt b/test/expected/msg_15.txt index ae8288f..f846150 100644 --- a/test/expected/msg_15.txt +++ b/test/expected/msg_15.txt @@ -20,20 +20,20 @@ Content-type: multipart/alternative; --MS_Mac_OE_3071477847_720252_MIME_Part Content-transfer-encoding: 8bit -X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode Some removed test. --MS_Mac_OE_3071477847_720252_MIME_Part Content-transfer-encoding: 8bit -X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode X-MIME-Autoconverted: from text/html to text/plain by test id ./html2txt.py MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode diff --git a/test/expected/msg_16-1.txt b/test/expected/msg_16-1.txt index b2e4bb9..b48f54f 100644 --- a/test/expected/msg_16-1.txt +++ b/test/expected/msg_16-1.txt @@ -18,7 +18,7 @@ Content-Type: multipart/report; boundary="Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)" --Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode This report relates to a message you sent with the following header fields: @@ -67,7 +67,7 @@ X-BeenThere: scr@socal-raves.org X-Mailman-Version: 2.1a3 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode I always love to find more Ian's that are over 3 years old!! diff --git a/test/expected/msg_16-2.txt b/test/expected/msg_16-2.txt index 7daa4f5..e060db1 100644 --- a/test/expected/msg_16-2.txt +++ b/test/expected/msg_16-2.txt @@ -6,7 +6,7 @@ Content-Type: multipart/report; boundary="Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)" --Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode This report relates to a message you sent with the following header fields: @@ -33,7 +33,7 @@ Content-type: MESSAGE/RFC822 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode I always love to find more Ian's that are over 3 years old!! diff --git a/test/expected/msg_16.txt b/test/expected/msg_16.txt index e533601..0d593fe 100644 --- a/test/expected/msg_16.txt +++ b/test/expected/msg_16.txt @@ -36,7 +36,7 @@ Content-Type: multipart/report; boundary="Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA)" --Boundary_(ID_PGS2F2a+z+/jL7hupKgRhA) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode This report relates to a message you sent with the following header fields: @@ -114,7 +114,7 @@ List-Unsubscribe: , List-Archive: 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode I always love to find more Ian's that are over 3 years old!! diff --git a/test/expected/msg_18-1.txt b/test/expected/msg_18-1.txt index 28af17d..01898fa 100644 --- a/test/expected/msg_18-1.txt +++ b/test/expected/msg_18-1.txt @@ -3,5 +3,5 @@ Content-Transfer-Encoding: 7bit X-Foobar-Spoink-Defrobnit: wasnipoop 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode diff --git a/test/expected/msg_18.txt b/test/expected/msg_18.txt index b380885..2af15eb 100644 --- a/test/expected/msg_18.txt +++ b/test/expected/msg_18.txt @@ -4,5 +4,5 @@ X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals"; spooge="yummy"; hippos="gargantuan"; marshmallows="gooey" 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode diff --git a/test/expected/msg_20.txt b/test/expected/msg_20.txt index 3ea86f2..45912f4 100644 --- a/test/expected/msg_20.txt +++ b/test/expected/msg_20.txt @@ -14,7 +14,7 @@ Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Hi, diff --git a/test/expected/msg_21.txt b/test/expected/msg_21.txt index 3827163..c69cae7 100644 --- a/test/expected/msg_21.txt +++ b/test/expected/msg_21.txt @@ -9,14 +9,14 @@ MIME message Content-Transfer-Encoding: 7bit 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode One --BOUNDARY Content-Transfer-Encoding: 7bit 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Two --BOUNDARY-- diff --git a/test/expected/msg_22-1.txt b/test/expected/msg_22-1.txt index 1545c73..f16cc48 100644 Binary files a/test/expected/msg_22-1.txt and b/test/expected/msg_22-1.txt differ diff --git a/test/expected/msg_22.txt b/test/expected/msg_22.txt index 0caea80..0335495 100644 Binary files a/test/expected/msg_22.txt and b/test/expected/msg_22.txt differ diff --git a/test/expected/msg_26.txt b/test/expected/msg_26.txt index 16b74b5..1c97140 100644 Binary files a/test/expected/msg_26.txt and b/test/expected/msg_26.txt differ diff --git a/test/expected/msg_26.txt-py3 b/test/expected/msg_26.txt-py3 index bf28802..f07ea92 100644 Binary files a/test/expected/msg_26.txt-py3 and b/test/expected/msg_26.txt-py3 differ diff --git a/test/expected/msg_27.txt b/test/expected/msg_27.txt index 4d29f50..58f87ed 100644 --- a/test/expected/msg_27.txt +++ b/test/expected/msg_27.txt @@ -12,6 +12,6 @@ From: aperson@dom.ain (Anne P. Erson) To: bperson@dom.ain (Barney P. Erson) 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode test diff --git a/test/expected/msg_28.txt b/test/expected/msg_28.txt index 3c6ae18..28c0768 100644 --- a/test/expected/msg_28.txt +++ b/test/expected/msg_28.txt @@ -11,7 +11,7 @@ From: cc@dd.org Subject: ee 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode message 1 @@ -23,7 +23,7 @@ From: cc@dd.org Subject: ee 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode message 2 diff --git a/test/expected/msg_29-1.txt b/test/expected/msg_29-1.txt index 4a8565f..8c60f02 100644 --- a/test/expected/msg_29-1.txt +++ b/test/expected/msg_29-1.txt @@ -11,7 +11,7 @@ Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Hi, diff --git a/test/expected/msg_29.txt b/test/expected/msg_29.txt index 28100c0..95ed31c 100644 --- a/test/expected/msg_29.txt +++ b/test/expected/msg_29.txt @@ -11,7 +11,7 @@ Subject: This is a test message Date: Fri, 4 May 2001 14:05:44 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; title*="us-ascii'en'This%20is%20even%20more%20%2A%2A%2Afun%2A%2A%2A%20isn%27t%20it%21" -X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Hi, diff --git a/test/expected/msg_30.txt b/test/expected/msg_30.txt index d75a444..8981d2f 100644 --- a/test/expected/msg_30.txt +++ b/test/expected/msg_30.txt @@ -10,7 +10,7 @@ From: cc@dd.org Subject: ee 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode message 1 @@ -21,7 +21,7 @@ From: cc@dd.org Subject: ee 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode message 2 diff --git a/test/expected/msg_32.txt b/test/expected/msg_32.txt index 9fdf813..42f4820 100644 --- a/test/expected/msg_32.txt +++ b/test/expected/msg_32.txt @@ -11,6 +11,6 @@ Precedence: bulk X-Loop: FreeBSD.org 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode Some message. diff --git a/test/expected/msg_33.txt b/test/expected/msg_33.txt index b284caa..e178f5a 100644 --- a/test/expected/msg_33.txt +++ b/test/expected/msg_33.txt @@ -17,10 +17,10 @@ X-Loop: FreeBSD.org --EeQfGwPcQSOJBaQU Content-Disposition: inline Content-Transfer-Encoding: 8bit -X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode.py +X-MIME-Autoconverted: from quoted-printable to 8bit by test id mimedecode 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode part 1 diff --git a/test/expected/msg_38.txt b/test/expected/msg_38.txt index a56a754..28a4d63 100644 --- a/test/expected/msg_38.txt +++ b/test/expected/msg_38.txt @@ -102,7 +102,7 @@ XXX 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode -- It's never too late to have a happy childhood. diff --git a/test/expected/msg_39.txt b/test/expected/msg_39.txt index 9c99abd..32bb20d 100644 --- a/test/expected/msg_39.txt +++ b/test/expected/msg_39.txt @@ -16,7 +16,7 @@ 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 +X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode XXX @@ -25,7 +25,7 @@ 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 +X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode XXX @@ -81,7 +81,7 @@ XXX 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode -- It's never too late to have a happy childhood. diff --git a/test/expected/msg_39.txt-py3 b/test/expected/msg_39.txt-py3 index 5866bf7..5dc16d4 100644 --- a/test/expected/msg_39.txt-py3 +++ b/test/expected/msg_39.txt-py3 @@ -16,7 +16,7 @@ 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 +X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode ]u ------- =_aaaaaaaaaa1 @@ -24,7 +24,7 @@ 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 +X-MIME-Autoconverted: from base64 to 8bit by test id mimedecode ]u ------- =_aaaaaaaaaa1-- @@ -79,7 +79,7 @@ XXX 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 +X-MIME-Autoconverted: from us-ascii to utf-8 by test id mimedecode -- It's never too late to have a happy childhood. diff --git a/test/expected/msg_46.txt b/test/expected/msg_46.txt index 0260b99..5f1ae5a 100644 --- a/test/expected/msg_46.txt +++ b/test/expected/msg_46.txt @@ -20,6 +20,6 @@ Subject: GroupwiseForwardingTest Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -X-MIME-Autoconverted: from iso-8859-15 to utf-8 by test id mimedecode.py +X-MIME-Autoconverted: from iso-8859-15 to utf-8 by test id mimedecode Testing email forwarding with Groupwise 1.2.2010 diff --git a/test/test_all b/test/test_all index 1074273..02329d5 100755 --- a/test/test_all +++ b/test/test_all @@ -30,7 +30,7 @@ test1() { fi shift - $PYTHON ../mimedecode.py -H test -f utf-8 "$@" input/"$infile" >tmp/"$expfile" || return 1 + mimedecode -H test -f utf-8 "$@" input/"$infile" >tmp/"$expfile" || return 1 if cmp -s expected/"$expfile" tmp/"$expfile"; then rm tmp/"$expfile" && return 0 || return 1 else