Rename archivemail.py to archivemail

On Unix, most scripts don't come with a file extension, it's not needed, and
we distribute the script as "archivemail" anyway.  And most importantly, I
like it better without the extension. :)

With a little trick we can still load the script as a module from the test
suite.
This commit is contained in:
Nikolaus Schulz 2010-07-29 21:35:58 +02:00
parent b47cc46fbf
commit a102b5baf9
5 changed files with 8 additions and 17 deletions

View File

@ -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)

1
README
View File

@ -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:

4
TODO
View File

@ -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?

View File

@ -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