aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2010-07-29 21:35:58 +0200
committerNikolaus Schulz <microschulz@web.de>2010-07-29 21:35:58 +0200
commita102b5baf93cfc7882fdf60406c5046b6f8d2ba9 (patch)
treeb9e0b9a182edbc26c12b0ff7a1c43a871d86df89
parentb47cc46fbf9f70b69e2ae168647b5e0379920d3e (diff)
downloadarchivemail-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.
-rw-r--r--Makefile6
-rw-r--r--README1
-rw-r--r--TODO4
-rwxr-xr-xarchivemail (renamed from archivemail.py)0
-rwxr-xr-xtest_archivemail14
5 files changed, 8 insertions, 17 deletions
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
index be90413..be90413 100755
--- a/archivemail.py
+++ b/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