swc-installation-test-2.py: Don't parse missing versions
authorW. Trevor King <wking@tremily.us>
Sun, 30 Dec 2012 17:54:24 +0000 (12:54 -0500)
committerW. Trevor King <wking@tremily.us>
Tue, 1 Jan 2013 14:49:46 +0000 (09:49 -0500)
swc-installation-test-2.py

index 857385ca31be233e6541eec4bd1dc758f2b7aeac..69ef169bc20b3a3de20100f5214fa2ac9279d49c 100755 (executable)
@@ -188,7 +188,7 @@ class Dependency (object):
     def _check_version(self, version, parsed_version=None):
         if not parsed_version:
             parsed_version = self._parse_version(version=version)
-        if parsed_version < self.minimum_version:
+        if not parsed_version or parsed_version < self.minimum_version:
             raise DependencyError(
                 checker=self,
                 message='outdated version of {0}: {1} (need >= {2})'.format(
@@ -197,6 +197,8 @@ class Dependency (object):
                         str(part) for part in self.minimum_version)))
 
     def _parse_version(self, version):
+        if not version:
+            return None
         parsed_version = []
         for part in version.split(self.version_delimiter):
             try:
@@ -328,7 +330,7 @@ class PythonPackageDependency (Dependency):
         try:
             version = package.__version__
         except AttributeError:
-            version = 'unknown'
+            version = None
         return version