changeset 10530:36b75ddac55e

made the primary suite detection logic a little more robust
author Doug Simon <doug.simon@oracle.com>
date Tue, 25 Jun 2013 21:14:47 +0200
parents 254fab64b343
children 74cbc5d6e38f
files mxtool/mx.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Tue Jun 25 13:53:02 2013 +0200
+++ b/mxtool/mx.py	Tue Jun 25 21:14:47 2013 +0200
@@ -3287,17 +3287,20 @@
 _argParser = ArgParser()
 
 def _findPrimarySuite():
+    def is_suite_dir(d):
+        mxDir = join(d, 'mx')
+        if exists(mxDir) and isdir(mxDir) and exists(join(mxDir, 'projects')):
+            return dirname(mxDir)
+
     # try current working directory first
-    mxDir = join(os.getcwd(), 'mx')
-    if exists(mxDir) and isdir(mxDir):
-        return dirname(mxDir)
+    if is_suite_dir(os.getcwd()):
+        return os.getcwd()
 
     # now search path of my executable
     me = sys.argv[0]
     parent = dirname(me)
     while parent:
-        mxDir = join(parent, 'mx')
-        if exists(mxDir) and isdir(mxDir):
+        if is_suite_dir(parent):
             return parent
         parent = dirname(parent)
     return None