From a5e8f8ede83073f32156d0a58f0756d728142362 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 15 Mar 2012 20:22:46 +0100 Subject: [PATCH] Allow supybot.directories.backup to be /dev/null. --- src/conf.py | 3 ++- src/utils/file.py | 3 ++- src/version.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/conf.py b/src/conf.py index f631de351..ecbfd1fd4 100644 --- a/src/conf.py +++ b/src/conf.py @@ -763,7 +763,8 @@ registerGlobalValue(supybot.directories, 'data', Directory('data', _("""Determines what directory data is put into."""))) registerGlobalValue(supybot.directories, 'backup', Directory('backup', _("""Determines what directory backup data is put - into."""))) + into. Set it to /dev/null (this is a special value; it is a special value, + so it also works on Windows and systems without /dev/null)."""))) registerGlobalValue(supybot.directories.data, 'tmp', DataFilenameDirectory('tmp', _("""Determines what directory temporary files are put into."""))) diff --git a/src/utils/file.py b/src/utils/file.py index 3043079e5..50ab27c97 100644 --- a/src/utils/file.py +++ b/src/utils/file.py @@ -171,7 +171,8 @@ class AtomicFile(file): if newSize or self.allowEmptyOverwrite or not originalExists: if originalExists: oldSize = os.path.getsize(self.filename) - if self.makeBackupIfSmaller and newSize < oldSize: + if self.makeBackupIfSmaller and newSize < oldSize and \ + self.backupDir != '/dev/null': now = int(time.time()) backupFilename = '%s.backup.%s' % (self.filename, now) if self.backupDir is not None: diff --git a/src/version.py b/src/version.py index 278e7c68b..14234d53e 100644 --- a/src/version.py +++ b/src/version.py @@ -1,3 +1,3 @@ """stick the various versioning attributes in here, so we only have to change them once.""" -version = '0.83.4.1+limnoria (2012-03-15T12:44:43+0000)' +version = '0.83.4.1+limnoria (2012-03-15T19:22:46+0000)'