Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 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 | b6dfe12478ff |
children | 070b4a3c56f3 |
comparison
equal
deleted
inserted
replaced
10529:254fab64b343 | 10530:36b75ddac55e |
---|---|
3285 } | 3285 } |
3286 | 3286 |
3287 _argParser = ArgParser() | 3287 _argParser = ArgParser() |
3288 | 3288 |
3289 def _findPrimarySuite(): | 3289 def _findPrimarySuite(): |
3290 def is_suite_dir(d): | |
3291 mxDir = join(d, 'mx') | |
3292 if exists(mxDir) and isdir(mxDir) and exists(join(mxDir, 'projects')): | |
3293 return dirname(mxDir) | |
3294 | |
3290 # try current working directory first | 3295 # try current working directory first |
3291 mxDir = join(os.getcwd(), 'mx') | 3296 if is_suite_dir(os.getcwd()): |
3292 if exists(mxDir) and isdir(mxDir): | 3297 return os.getcwd() |
3293 return dirname(mxDir) | |
3294 | 3298 |
3295 # now search path of my executable | 3299 # now search path of my executable |
3296 me = sys.argv[0] | 3300 me = sys.argv[0] |
3297 parent = dirname(me) | 3301 parent = dirname(me) |
3298 while parent: | 3302 while parent: |
3299 mxDir = join(parent, 'mx') | 3303 if is_suite_dir(parent): |
3300 if exists(mxDir) and isdir(mxDir): | |
3301 return parent | 3304 return parent |
3302 parent = dirname(parent) | 3305 parent = dirname(parent) |
3303 return None | 3306 return None |
3304 | 3307 |
3305 def main(): | 3308 def main(): |