swc-installation-test-2.py: Add TornadoPythonPackage for version extraction
authorW. Trevor King <wking@tremily.us>
Mon, 28 Jan 2013 15:31:18 +0000 (10:31 -0500)
committerW. Trevor King <wking@tremily.us>
Mon, 28 Jan 2013 15:31:18 +0000 (10:31 -0500)
Tornado follows Python's example with tornado.version and
tornado.version_info instead of using tornado.__version__.  While we
could parse tornado.version with our usual machinery, take advantage
of the pre-parsed version_info by defining a new class.

setup/swc-installation-test-2.py

index 882e43cc4302807afbfd8967bb0d8a431951b601..6650e67b2aa8006fb559a04c9fe556afe69030e2 100755 (executable)
@@ -492,7 +492,6 @@ for package,name,long_name,minimum_version,and_dependencies in [
         ('nose', None, 'Nose Python package',
          CHECKER['nosetests'].minimum_version, None),
         ('jinja2', 'jinja', 'Jinja', (2, 6), None),
-        ('tornado', None, 'Tornado', (2, 0), None),
         ('zmq', 'pyzmq', 'PyZMQ', (2, 1, 4), None),
         ('IPython', None, 'IPython Python package',
          CHECKER['ipython'].minimum_version, ['jinja', 'tornado', 'pyzmq']),
@@ -537,6 +536,19 @@ CHECKER['mercurial'] = MercurialPythonPackage(
     minimum_version=CHECKER['hg'].minimum_version)
 
 
+class TornadoPythonPackage (PythonPackageDependency):
+    def _get_version_from_package(self, package):
+        return package.version
+
+    def _get_parsed_version(self):
+        package = self._get_package(self.package)
+        return package.version_info
+
+
+CHECKER['tornado'] = TornadoPythonPackage(
+    package='tornado', name='tornado', long_name='Tornado', minimum_version=(2, 0))
+
+
 class SQLitePythonPackage (PythonPackageDependency):
     def _get_version_from_package(self, package):
         return _sys.version