summaryrefslogtreecommitdiff
path: root/framework/backends
diff options
context:
space:
mode:
Diffstat (limited to 'framework/backends')
-rw-r--r--framework/backends/abstract.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py
index c892995e3..4a87857d7 100644
--- a/framework/backends/abstract.py
+++ b/framework/backends/abstract.py
@@ -49,7 +49,12 @@ def write_compressed(filename):
"""
mode = compression.get_mode()
if mode != 'none':
- filename = '{}.{}'.format(filename, mode)
+ # if the suffix (final .xxx) is a knwon compression suffix
+ suffix = os.path.splitext(filename)[1]
+ if suffix in compression.COMPRESSION_SUFFIXES:
+ filename = '{}.{}'.format(os.path.splitext(filename)[0], mode)
+ else:
+ filename = '{}.{}'.format(filename, mode)
with compression.COMPRESSORS[mode](filename) as f:
yield f