From: W. Trevor King Date: Tue, 17 Aug 2010 01:47:25 +0000 (-0400) Subject: Make file-format-version=0.5 support explicit in JPKDriver X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=38c7cee99afe427b9c5a2b17b6ab9f92fddb1c1c;p=hooke.git Make file-format-version=0.5 support explicit in JPKDriver --- 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: