[Piglit] [PATCH 2/2] framework/backends/abstract: Fix doubling compression suffixes
Dylan Baker
baker.dylan.c at gmail.com
Fri Aug 21 13:08:04 PDT 2015
This patch fixes the write_compressed method to not add an additional
compression suffix to files that already have a compression suffix.
This fixes the tests from the previous patch.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/backends/abstract.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/framework/backends/abstract.py b/framework/backends/abstract.py
index c892995..97d2d07 100644
--- a/framework/backends/abstract.py
+++ b/framework/backends/abstract.py
@@ -49,7 +49,13 @@ def write_compressed(filename):
"""
mode = compression.get_mode()
if mode != 'none':
- filename = '{}.{}'.format(filename, mode)
+ suffix = os.path.splitext(filename)[1]
+ if suffix[1:] == mode:
+ pass
+ elif 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
--
2.5.0
More information about the Piglit
mailing list