diff options
author | Nikolaus Schulz <microschulz@web.de> | 2010-07-29 21:35:58 +0200 |
---|---|---|
committer | Nikolaus Schulz <microschulz@web.de> | 2010-07-29 21:35:58 +0200 |
commit | a102b5baf93cfc7882fdf60406c5046b6f8d2ba9 (patch) | |
tree | b9e0b9a182edbc26c12b0ff7a1c43a871d86df89 /test_archivemail | |
parent | b47cc46fbf9f70b69e2ae168647b5e0379920d3e (diff) | |
download | archivemail-a102b5baf93cfc7882fdf60406c5046b6f8d2ba9.tar.gz archivemail-a102b5baf93cfc7882fdf60406c5046b6f8d2ba9.tar.bz2 archivemail-a102b5baf93cfc7882fdf60406c5046b6f8d2ba9.zip |
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.
Diffstat (limited to 'test_archivemail')
-rwxr-xr-x | test_archivemail | 14 |
1 files changed, 7 insertions, 7 deletions
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 |