Fix test failure in Repository/Java.py on OS X
authorgregnoel <gregnoel@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 18 Sep 2009 06:49:35 +0000 (06:49 +0000)
committergregnoel <gregnoel@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 18 Sep 2009 06:49:35 +0000 (06:49 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4366 fdb21ef1-2011-0410-befe-b5e4ea1792b1

QMTest/TestSCons.py
test/Repository/Java.py

index f50f6aaf48789281bea778d7296008a263cf2a8a..a2bf8fc93c8f9a59526aa6c5957761868e60456d 100644 (file)
@@ -17,7 +17,6 @@ attributes defined in this subclass.
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 import os
-import os.path
 import re
 import string
 import sys
@@ -547,10 +546,18 @@ class TestSCons(TestCommon):
 
 
     def java_where_java_home(self,version=None):
-        import os.path
-        jar=self.java_where_jar(version)
-        home=os.path.normpath('%s/..'%jar)
-        return home
+        if sys.platform[:6] == 'darwin':
+            if version is None:
+                home = '/System/Library/Frameworks/JavaVM.framework/Home'
+            else:
+                home = '/System/Library/Frameworks/JavaVM.framework/Versions/%s/Home' % version
+        else:
+            jar = self.java_where_jar(version)
+            home = os.path.normpath('%s/..'%jar)
+        if os.path.isdir(home):
+            return home
+        print("Could not determine JAVA_HOME: %s is not a directory" % home)
+        self.fail_test()
 
     def java_where_jar(self, version=None):
         ENV = self.java_ENV(version)
index 5ad18555e6f445d83dbc8edd61b81cf10b459957..dc6f2021f392466b3f0bbc8f0d2e7a6ecd69802b 100644 (file)
@@ -36,16 +36,11 @@ python = TestSCons.python
 
 test = TestSCons.TestSCons()
 
-where_javac, java_version = test.java_where_javac()
-where_java = test.java_where_java()
+javac, java_version = test.java_where_javac()
+java = test.java_where_java()
 
-# where_java_home=test.java_where_java_home()
-os.environ['JAVA_HOME'] = test.java_where_java_home()
-
-
-
-java = where_java
-javac = where_javac
+# where_java_home=test.java_where_java_home(java_version)
+os.environ['JAVA_HOME'] = test.java_where_java_home(java_version)
 
 ###############################################################################