From a102b5baf93cfc7882fdf60406c5046b6f8d2ba9 Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Thu, 29 Jul 2010 21:35:58 +0200 Subject: 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. --- test_archivemail | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test_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 -- cgit v1.2.3