diff --git a/Makefile b/Makefile index a43097c..cbf8651 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ default: @echo "no default target" clean: - rm -f *.pyc manpage.links manpage.refs manpage.log + rm -f manpage.links manpage.refs manpage.log rm -rf $(HTDOCS) test: @@ -20,16 +20,12 @@ clobber: clean sdist: clobber doc - cp archivemail.py archivemail python setup.py sdist - rm archivemail # FIXME: bdist_rpm chokes on the manpage. # This is python/distutils bug #644744 #bdist_rpm: clobber doc -# cp archivemail.py archivemail # python setup.py bdist_rpm -# rm archivemail tag: git tag -a $(VERSION_TAG) diff --git a/README b/README index 81b9d77..cbb3fb4 100644 --- a/README +++ b/README @@ -35,7 +35,6 @@ Python is available from http://www.python.org/ INSTALLATION: If you want to test archivemail: - cp archivemail archivemail.py python test_archivemail To install archivemail, run: diff --git a/TODO b/TODO index aafd4a5..4f5e8ce 100644 --- a/TODO +++ b/TODO @@ -54,10 +54,6 @@ Implement a fallback if an IMAP server doesn't support SEARCH. (Ouch!) Add IMAP tests to the testsuite (upload test messages with IMAP "APPEND date-string"). This should be done without any real network I/O. -The *.py filename extension is only needed to load archivemail as a module for -for the test suite. There are more elegant ways to do this without adding the -extension. Of course this is only cosmetic. - Try to port archivemail to email.message and the new mailboxes in Python 2.5. Is these flexible enough for our needs? diff --git a/archivemail.py b/archivemail similarity index 100% rename from archivemail.py rename to archivemail diff --git a/test_archivemail b/test_archivemail index 4a11734..3f9f127 100755 --- a/test_archivemail +++ b/test_archivemail @@ -60,15 +60,15 @@ import cStringIO import rfc822 import mailbox +from types import ModuleType +archivemail = ModuleType("archivemail") try: - import archivemail -except ImportError: - print "The archivemail script needs to be called 'archivemail.py'" - print "and should be in the current directory in order to be imported" - print "and tested. Sorry." - if os.path.isfile("archivemail"): - print "Try renaming it from 'archivemail' to 'archivemail.py'." + module_fp = open("archivemail", "r") +except IOError: + print "The archivemail script should be in the current directory in order" + print "to be imported and tested. Sorry." sys.exit(1) +exec module_fp in archivemail.__dict__ # We want to iterate over messages in a compressed archive mbox and verify # them. This involves seeking in the mbox. The gzip.Gzipfile.seek() in