From 38c7cee99afe427b9c5a2b17b6ab9f92fddb1c1c Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 16 Aug 2010 21:47:25 -0400 Subject: [PATCH] Make file-format-version=0.5 support explicit in JPKDriver --- hooke/driver/jpk.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/hooke/driver/jpk.py b/hooke/driver/jpk.py index ed7f6c4..bc13761 100644 --- a/hooke/driver/jpk.py +++ b/hooke/driver/jpk.py @@ -74,14 +74,18 @@ class JPKDriver (Driver): for i in range(len([p for p in f.namelist() if p.endswith('segment-header.properties')])): segments.append(self._zip_segment(f, path, info, zip_info, i)) - for name in ['approach', 'retract']: - if len([s for s in segments if s.info['name'] == name]) == 0: - raise ValueError( - 'No segment for %s in %s, only %s' - % (name, path, [s.info['name'] for s in segments])) - return (segments, - self._zip_translate_params(zip_info, - segments[0].info['raw info'])) + if zip_info['file-format-version'] not in ['0.5']: + raise NotImplementedError( + 'JPK file version %s not supported (yet).' + % zip_info['file-format-version']) + for name in ['approach', 'retract']: + if len([s for s in segments if s.info['name'] == name]) == 0: + raise ValueError( + 'No segment for %s in %s, only %s' + % (name, path, [s.info['name'] for s in segments])) + return (segments, + self._zip_translate_params(zip_info, + segments[0].info['raw info'])) def _zip_info(self, zipfile): with Closing(zipfile.open('header.properties')) as f: -- 2.26.2