From bc41b683898797b07db49a929656ed644cfefd53 Mon Sep 17 00:00:00 2001 From: Paul Rodger Date: Sat, 27 Apr 2002 06:08:45 +0000 Subject: [PATCH] Fixed a bug where the long --suffix option was not working (although the short option, '-s' was). Added time-based format directives to the --suffix option, so that you can do things like specify --suffix='%B%Y' to create archives named after the current month and year. Added some more tests to test_archivemail.py --- CHANGELOG | 8 + Makefile | 2 +- README | 2 +- TODO | 5 +- archivemail.py | 10 +- archivemail.sgml | 71 ++++++- setup.py | 2 +- test_archivemail.py | 452 ++++++++++++++++++++++++-------------------- 8 files changed, 339 insertions(+), 213 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2747fd9..2d9b8df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,12 @@ +Version 0.4.4 - 27 April 2002 + * Fixed a bug where the long --suffix option was not working (although the + short option, '-s' was). + * Added time-based format directives to the --suffix option, so that you + can do things like specify --suffix='%B%Y' to create archives named + after the current month and year + * Added some more tests to test_archivemail.py + Version 0.4.3 - 26 April 2002 * Fixed a couple of bugs where I was using python version 2.2 syntax that was giving errors in python v2.0 and v2.1. diff --git a/Makefile b/Makefile index af24e19..a4df24f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -VERSION=0.4.3 +VERSION=0.4.4 VERSION_TAG=v$(subst .,_,$(VERSION)) TARFILE=archivemail-$(VERSION).tar.gz diff --git a/README b/README index 1f33d5f..495cc27 100644 --- a/README +++ b/README @@ -30,7 +30,7 @@ module, although the zlib module comes with most python installations. If you are compiling your own version of python < version 2.2, make sure you uncomment the 'zlib' moduile in Modules/Setup in the python source directory. -You can check to see if you version of python has the 'zlib' module by +You can check to see if your version of python has the 'zlib' module by trying this: flare:~$ python diff --git a/TODO b/TODO index 25112ad..66a7cef 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ -Goals for next minor release (0.4.4): +Goals for next minor release (0.4.5): ------------------------------------- * Think about the best way to specify the names of archives created with possibly an --archive-name option. @@ -9,12 +9,15 @@ Goals for next minor release (0.4.4): Goals for next major release (0.5.0): ------------------------------------- +* Add a --size option to only archive messages greater than a certain byte + size. * Lock any original .gz files - is this necessary? * Check for symlink attacks for tempfiles (although we don't use /var/tmp) Longer Term goals: ------------------ +* Add an option to not cut threads. * Add MMDF mailbox support * Add Babyl mailbox support * Add option to archive depending on mailbox size threshold diff --git a/archivemail.py b/archivemail.py index 7aa2424..30c06f5 100755 --- a/archivemail.py +++ b/archivemail.py @@ -22,7 +22,7 @@ Website: http://archivemail.sourceforge.net/ """ # global administrivia -__version__ = "archivemail v0.4.3" +__version__ = "archivemail v0.4.4" __cvs_id__ = "$Id$" __copyright__ = """Copyright (C) 2002 Paul Rodger This is free software; see the source for copying conditions. There is NO @@ -165,7 +165,7 @@ class Options: opts, args = getopt.getopt(args, '?D:Vd:hno:qs:uv', ["date=", "days=", "delete", "dry-run", "help", "include-flagged", "no-compress", "output-dir=", - "preserve-unread", "quiet", "suffix", "verbose", + "preserve-unread", "quiet", "suffix=", "verbose", "version", "warn-duplicate"]) except getopt.error, msg: user_error(msg) @@ -858,7 +858,11 @@ def archive(mailbox_name): set_signal_handlers() os.umask(077) # saves setting permissions on mailboxes/tempfiles - final_archive_name = mailbox_name + options.archive_suffix + # allow the user to embed time formats such as '%B' in the suffix string + parsed_suffix = time.strftime(options.archive_suffix, + time.localtime(time.time())) + + final_archive_name = mailbox_name + parsed_suffix if options.output_dir: final_archive_name = os.path.join(options.output_dir, os.path.basename(final_archive_name)) diff --git a/archivemail.sgml b/archivemail.sgml index c20f0cd..ad40248 100644 --- a/archivemail.sgml +++ b/archivemail.sgml @@ -125,11 +125,66 @@ read.