diff options
author | Paul Rodger <paul@paulrodger.com> | 2002-05-06 03:06:40 +0000 |
---|---|---|
committer | Paul Rodger <paul@paulrodger.com> | 2002-05-06 03:06:40 +0000 |
commit | e4adb7b2228533cde7936b44b5d61e422c81bb6b (patch) | |
tree | e16ff77acbd4dfd875d605901cf1162a4eecf8b1 | |
parent | 7187dd8f6fc3c798958d3fbbaa842edc8276c873 (diff) | |
download | archivemail-e4adb7b2228533cde7936b44b5d61e422c81bb6b.tar.gz archivemail-e4adb7b2228533cde7936b44b5d61e422c81bb6b.tar.bz2 archivemail-e4adb7b2228533cde7936b44b5d61e422c81bb6b.zip |
Fixed a bug where the os.rename() calls could fail if we are moving files
between partitions.
-rw-r--r-- | CHANGELOG | 4 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rwxr-xr-x | archivemail.py | 17 | ||||
-rwxr-xr-x | setup.py | 2 |
5 files changed, 20 insertions, 7 deletions
@@ -1,4 +1,8 @@ +Version 0.4.6 - 6 May 2002 + * Fixed a bug where the os.rename() calls could fail if we were moving + temporary files across different filesystems/partitions. + Version 0.4.5 - 29 April 2002 * Fixed a bug where if you used the '--delete' option to completely clean an mbox mailbox you would get a python error. @@ -1,5 +1,5 @@ -VERSION=0.4.5 +VERSION=0.4.6 VERSION_TAG=v$(subst .,_,$(VERSION)) TARFILE=archivemail-$(VERSION).tar.gz @@ -1,5 +1,5 @@ -Goals for next minor release (0.4.6): +Goals for next minor release (0.4.7): ------------------------------------- * Think about the best way to specify the names of archives created with possibly an --archive-name option. diff --git a/archivemail.py b/archivemail.py index 182d43a..8020e89 100755 --- a/archivemail.py +++ b/archivemail.py @@ -22,7 +22,7 @@ Website: http://archivemail.sourceforge.net/ """ # global administrivia -__version__ = "archivemail v0.4.5" +__version__ = "archivemail v0.4.6" __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 @@ -392,7 +392,6 @@ class Mbox(mailbox.UnixMailbox): completely deleted.""" assert(os.path.isfile(self.mbox_file_name)) vprint("turning '%s' into a zero-length file" % self.mbox_file_name) - mtime = os.path.getmtime(self.mbox_file_name) blank_file = open(self.mbox_file_name, "w") blank_file.close() @@ -439,7 +438,12 @@ class RetainMbox(Mbox): os.chmod(self.mbox_file_name, mode) vprint("renaming '%s' to '%s'" % (self.mbox_file_name, self.__final_name)) - os.rename(self.mbox_file_name, self.__final_name) + try: + os.rename(self.mbox_file_name, self.__final_name) + except OSError: + # file might be on a different filesystem -- move it manually + shutil.copy2(self.mbox_file_name, self.__final_name) + os.remove(self.mbox_file_name) os.utime(self.__final_name, (atime, mtime)) # reset to original timestamps _stale.retain = None @@ -525,7 +529,12 @@ manually, and try running me again.""" % final_name) final_name = final_name + ".gz" vprint("renaming '%s' to '%s'" % (self.mbox_file_name, final_name)) - os.rename(self.mbox_file_name, final_name) + try: + os.rename(self.mbox_file_name, final_name) + except OSError: + # file might be on a different filesystem -- move it manually + shutil.copy2(self.mbox_file_name, final_name) + os.remove(self.mbox_file_name) _stale.archive = None @@ -19,7 +19,7 @@ check_python_version() # define & run this early - 'distutils.core' is new from distutils.core import setup setup(name="archivemail", - version="0.4.5", + version="0.4.6", description="archive and compress old email", license="GNU GPL", url="http://archivemail.sourceforge.net/", |