comparison mxtool/mx.py @ 17184:1cc8b62b4d37

mx: added 'suites' command
author Doug Simon <doug.simon@oracle.com>
date Tue, 23 Sep 2014 13:09:06 +0200
parents 4046e014f29f
children ca13853abf0d
comparison
equal deleted inserted replaced
17183:4046e014f29f 17184:1cc8b62b4d37
5018 log('no matches') 5018 log('no matches')
5019 selection = select_items(candidates) 5019 selection = select_items(candidates)
5020 run([javapExe, '-private', '-verbose', '-classpath', classpath()] + selection) 5020 run([javapExe, '-private', '-verbose', '-classpath', classpath()] + selection)
5021 5021
5022 def show_projects(args): 5022 def show_projects(args):
5023 """show all loaded projects""" 5023 """show all projects"""
5024 for s in suites(): 5024 for s in suites():
5025 if len(s.projects) != 0: 5025 if len(s.projects) != 0:
5026 log(join(s.mxDir, 'projects*.py')) 5026 log(join(s.mxDir, 'suite*.py'))
5027 for p in s.projects: 5027 for p in s.projects:
5028 log('\t' + p.name) 5028 log('\t' + p.name)
5029
5030 def show_suites(args):
5031 """show all suites"""
5032 def _show_section(name, section):
5033 if len(section) != 0:
5034 log(' ' + name + ':')
5035 for e in section:
5036 log(' ' + e.name)
5037
5038 for s in suites():
5039 log(join(s.mxDir, 'suite*.py'))
5040 _show_section('libraries', s.libs)
5041 _show_section('jrelibraries', s.jreLibs)
5042 _show_section('projects', s.projects)
5043 _show_section('distributions', s.dists)
5029 5044
5030 def ask_yes_no(question, default=None): 5045 def ask_yes_no(question, default=None):
5031 """""" 5046 """"""
5032 assert not default or default == 'y' or default == 'n' 5047 assert not default or default == 'y' or default == 'n'
5033 if not sys.stdout.isatty(): 5048 if not sys.stdout.isatty():
5085 'pylint': [pylint, ''], 5100 'pylint': [pylint, ''],
5086 'javap': [javap, '<class name patterns>'], 5101 'javap': [javap, '<class name patterns>'],
5087 'javadoc': [javadoc, '[options]'], 5102 'javadoc': [javadoc, '[options]'],
5088 'site': [site, '[options]'], 5103 'site': [site, '[options]'],
5089 'netbeansinit': [netbeansinit, ''], 5104 'netbeansinit': [netbeansinit, ''],
5105 'suites': [show_suites, ''],
5090 'projects': [show_projects, ''], 5106 'projects': [show_projects, ''],
5091 } 5107 }
5092 5108
5093 _argParser = ArgParser() 5109 _argParser = ArgParser()
5094 5110
5108 """ 5124 """
5109 if os.path.isdir(d): 5125 if os.path.isdir(d):
5110 for f in os.listdir(d): 5126 for f in os.listdir(d):
5111 if (mxDirName == None and (f == 'mx' or fnmatch.fnmatch(f, 'mx.*'))) or f == mxDirName: 5127 if (mxDirName == None and (f == 'mx' or fnmatch.fnmatch(f, 'mx.*'))) or f == mxDirName:
5112 mxDir = join(d, f) 5128 mxDir = join(d, f)
5113 if exists(mxDir) and isdir(mxDir) and (exists(join(mxDir, 'suite.py')) or exists(join(mxDir, 'projects'))): 5129 if exists(mxDir) and isdir(mxDir) and (exists(join(mxDir, 'suite.py'))):
5114 return mxDir 5130 return mxDir
5115 5131
5116 def _check_primary_suite(): 5132 def _check_primary_suite():
5117 if _primary_suite is None: 5133 if _primary_suite is None:
5118 abort('no primary suite found') 5134 abort('no primary suite found')