Author: reebalazs
Date: Mon Nov  5 19:20:28 2007
New Revision: 48324

Modified:
   
kukit/kss.buildout/trunk/src/kss.recipe.checkjavaversion/src/kss/recipe/checkjavaversion/__init__.py
Log:
Fix borken recipee at two points:

- version must be checked against none, obj <= None comparision throws 
exception.
- when runnning java --version, stdout must be checked
(for compatibility I also still check stderr, but I have no idea
what evil app may have outputted to stderr its version string,
originally.)

Modified: 
kukit/kss.buildout/trunk/src/kss.recipe.checkjavaversion/src/kss/recipe/checkjavaversion/__init__.py
==============================================================================
--- 
kukit/kss.buildout/trunk/src/kss.recipe.checkjavaversion/src/kss/recipe/checkjavaversion/__init__.py
        (original)
+++ 
kukit/kss.buildout/trunk/src/kss.recipe.checkjavaversion/src/kss/recipe/checkjavaversion/__init__.py
        Mon Nov  5 19:20:28 2007
@@ -16,12 +16,17 @@
         location = options['location']
         required = LooseVersion(options.get('javaversion', '0'))
         installed = self.getInstalledJavaVersion()
-        assert (required <= installed), "Installed Java version (%s) less than 
required (%s)" % (installed, required)
+        # We have to check for installed = None, because otherwise we'd get an 
error.
+        assert (installed is not None and required <= installed), "Installed 
Java version (%s) less than required (%s)" % (installed, required)
         return location
 
     def getInstalledJavaVersion(self):
         stdin, stdout, stderr = os.popen3('java -version')
+        # XXX, is there any java version that outputs to stderr instead of 
stdout???
         line = stderr.readline()
+        # We have to check stdout too
+        if not line:
+            line = stdout.readline()
         results = re.search('"([._0-9]+)"', line)
         if results:
            version = LooseVersion(results.group(1))
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to