aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG13
-rw-r--r--README6
-rwxr-xr-xarchivemail.py2
-rwxr-xr-xarchivemail_test.py41
4 files changed, 58 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 1b24531..c19ebba 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,15 @@
-Version 0.2.1 - 3 April 2002
+Version 0.2.1 - 4 April 2002
* Since we might not have a parse-able 'Date-Received' or 'Date' field,
- use 5 different ways to guess the date of a message.
+ use 5 different ways to guess the date of a message.
+ * Removed the '--use-mtime' option since it is obsolete -- we will always
+ use the file modification time for the message if other date-parsing
+ methods fail.
+ * Check to see if we are running as root -- if so, change our
+ effective userid and groupid to that of the original mailbox. This will
+ make sure any archives or tempfiles we write have the same ownership and
+ will allow the root user to do "archivemail /var/spool/mail/*"
+ * Fixed a bug where if you ran 'archivemail.py foo/mbox' it would create
+ the archive file in the current directory instead of the directory 'foo'.
Version 0.2.0 - 3 April 2002
* Added support for reading from MH mailboxes
diff --git a/README b/README
index 9f679be..b455df7 100644
--- a/README
+++ b/README
@@ -17,7 +17,7 @@ overhead on your mail reader. The number of days before mail is considered
'old' is up to you, but the default is 180 days. To see the options
archivemail supports, try running 'archivemail --help'.
-'archivemail' currently works on mbox-format and maildir-format mailboxes,
+'archivemail' currently works on mbox, maildir and MH format mailboxes
and requires python v2.0 or greater. It also supports deleting old mail
instead of archiving it with the '--delete' option.
@@ -25,6 +25,10 @@ The best way to run archivemail is from cron. Giving the '-q' option to
archivemail will make it quiet, only printing messages if something went
wrong.
+Another good option to remember is the '--dry-run' or '-n' option, which will
+just show you how many messages it would have archived without actually
+writing to the disk.
+
archivemail is not exactly blazingly quick at the moment, but if you run it
from cron you won't mind. Archiving from maildir mailboxes instead of 'mbox'
is a lot quicker too, since we don't have to do to as much effort to delete
diff --git a/archivemail.py b/archivemail.py
index 34649b3..3eabe4e 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -52,7 +52,7 @@ import tempfile
import time
# global administrivia
-__version__ = "archivemail v0.2.0"
+__version__ = "archivemail v0.2.1"
__cvs_id__ = "$Id$"
__copyright__ = """Copyright (C) 2002 Paul Rodger <paul@paulrodger.com>
This is free software; see the source for copying conditions. There is NO
diff --git a/archivemail_test.py b/archivemail_test.py
new file mode 100755
index 0000000..a412dae
--- /dev/null
+++ b/archivemail_test.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+import archivemail
+import os
+import tempfile
+import unittest
+
+class TempfileTestCase(unittest.TestCase):
+ def setUp(self):
+ self.output_dir = tempfile.mktemp()
+ os.mkdir(self.output_dir)
+ self.sub_dir = tempfile.mktemp()
+ os.mkdir(self.sub_dir)
+
+ def testCurrentDir(self):
+ archivemail._options.output_dir = None
+ dir = archivemail.choose_temp_dir("dummy")
+ self.assertEqual(dir, os.curdir)
+
+ def testSubDir(self):
+ archivemail._options.output_dir = None
+ dir = archivemail.choose_temp_dir(os.path.join(self.sub_dir, "dummy"))
+ self.assertEqual(dir, self.sub_dir)
+
+ def testOutputDir(self):
+ archivemail._options.output_dir = self.output_dir
+ dir = archivemail.choose_temp_dir("dummy")
+ self.assertEqual(dir, self.output_dir)
+
+ def testSubDirOutputDir(self):
+ archivemail._options.output_dir = self.output_dir
+ dir = archivemail.choose_temp_dir(os.path.join(self.sub_dir, "dummy"))
+ self.assertEqual(dir, self.output_dir)
+
+ def tearDown(self):
+ os.rmdir(self.output_dir)
+ os.rmdir(self.sub_dir)
+
+
+if __name__ == "__main__":
+ unittest.main()