Make file-format-version=0.5 support explicit in JPKDriver
authorW. Trevor King <wking@drexel.edu>
Tue, 17 Aug 2010 01:47:25 +0000 (21:47 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 17 Aug 2010 01:47:25 +0000 (21:47 -0400)
hooke/driver/jpk.py

index ed7f6c4..bc13761 100644 (file)
@@ -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: