comparison mxtool/mx.py @ 22018:11ed27b2abe8

remove hard-coded use of 'mx' to refer to the mxDir for the graal suite
author Doug Simon <doug.simon@oracle.com>
date Wed, 17 Jun 2015 15:28:45 +0200
parents f2cf8824040b
children 36a7ec14279d
comparison
equal deleted inserted replaced
22017:66dd063eb6a0 22018:11ed27b2abe8
1011 self.dists = [] 1011 self.dists = []
1012 self.commands = None 1012 self.commands = None
1013 self.primary = primary 1013 self.primary = primary
1014 self.requiredMxVersion = None 1014 self.requiredMxVersion = None
1015 self.name = _suitename(mxDir) # validated in _load_projects 1015 self.name = _suitename(mxDir) # validated in _load_projects
1016 _suites[self.name] = self
1016 if load: 1017 if load:
1017 # just check that there are no imports 1018 # just check that there are no imports
1018 self._load_imports() 1019 self._load_imports()
1019 self._load_env() 1020 self._load_env()
1020 self._load_commands() 1021 self._load_commands()
1021 _suites[self.name] = self
1022 1022
1023 def __str__(self): 1023 def __str__(self):
1024 return self.name 1024 return self.name
1025 1025
1026 def _load_projects(self): 1026 def _load_projects(self):
3845 if not exists(eclipseLaunches): 3845 if not exists(eclipseLaunches):
3846 os.makedirs(eclipseLaunches) 3846 os.makedirs(eclipseLaunches)
3847 launchFile = join(eclipseLaunches, name + '.launch') 3847 launchFile = join(eclipseLaunches, name + '.launch')
3848 return update_file(launchFile, launch), launchFile 3848 return update_file(launchFile, launch), launchFile
3849 3849
3850 def make_eclipse_launch(javaArgs, jre, name=None, deps=None): 3850 def make_eclipse_launch(suite, javaArgs, jre, name=None, deps=None):
3851 """ 3851 """
3852 Creates an Eclipse launch configuration file for running/debugging a Java command. 3852 Creates an Eclipse launch configuration file for running/debugging a Java command.
3853 """ 3853 """
3854 if deps is None: 3854 if deps is None:
3855 deps = [] 3855 deps = []
3907 launch.element('stringAttribute', {'key' : 'org.eclipse.jdt.launching.PROJECT_ATTR', 'value' : ''}) 3907 launch.element('stringAttribute', {'key' : 'org.eclipse.jdt.launching.PROJECT_ATTR', 'value' : ''})
3908 launch.element('stringAttribute', {'key' : 'org.eclipse.jdt.launching.VM_ARGUMENTS', 'value' : ' '.join(vmArgs)}) 3908 launch.element('stringAttribute', {'key' : 'org.eclipse.jdt.launching.VM_ARGUMENTS', 'value' : ' '.join(vmArgs)})
3909 launch.close('launchConfiguration') 3909 launch.close('launchConfiguration')
3910 launch = launch.xml(newl='\n', standalone='no') % slm.xml(escape=True, standalone='no') 3910 launch = launch.xml(newl='\n', standalone='no') % slm.xml(escape=True, standalone='no')
3911 3911
3912 eclipseLaunches = join('mx', 'eclipse-launches') 3912 eclipseLaunches = join(suite.mxDir, 'eclipse-launches')
3913 if not exists(eclipseLaunches): 3913 if not exists(eclipseLaunches):
3914 os.makedirs(eclipseLaunches) 3914 os.makedirs(eclipseLaunches)
3915 return update_file(join(eclipseLaunches, name + '.launch'), launch) 3915 return update_file(join(eclipseLaunches, name + '.launch'), launch)
3916 3916
3917 def eclipseinit(args, buildProcessorJars=True, refreshOnly=False): 3917 def eclipseinit(args, buildProcessorJars=True, refreshOnly=False):
5674 _argParser = ArgParser() 5674 _argParser = ArgParser()
5675 5675
5676 def _suitename(mxDir): 5676 def _suitename(mxDir):
5677 base = os.path.basename(mxDir) 5677 base = os.path.basename(mxDir)
5678 parts = base.split('.') 5678 parts = base.split('.')
5679 # temporary workaround until mx.graal exists 5679 assert len(parts) == 2
5680 if len(parts) == 1: 5680 assert parts[0] == 'mx'
5681 return 'graal' 5681 return parts[1]
5682 else:
5683 return parts[1]
5684 5682
5685 def _is_suite_dir(d, mxDirName=None): 5683 def _is_suite_dir(d, mxDirName=None):
5686 """ 5684 """
5687 Checks if d contains a suite. 5685 Checks if d contains a suite.
5688 If mxDirName is None, matches any suite name, otherwise checks for exactly that suite. 5686 If mxDirName is None, matches any suite name, otherwise checks for exactly that suite.
5689 """ 5687 """
5690 if os.path.isdir(d): 5688 if os.path.isdir(d):
5691 for f in os.listdir(d): 5689 for f in [mxDirName] if mxDirName else [e for e in os.listdir(d) if e.startswith('mx.')]:
5692 if (mxDirName == None and (f == 'mx' or fnmatch.fnmatch(f, 'mx.*'))) or f == mxDirName: 5690 mxDir = join(d, f)
5693 mxDir = join(d, f) 5691 if exists(mxDir) and isdir(mxDir) and (exists(join(mxDir, 'suite.py'))):
5694 if exists(mxDir) and isdir(mxDir) and (exists(join(mxDir, 'suite.py'))): 5692 return mxDir
5695 return mxDir
5696 5693
5697 def _check_primary_suite(): 5694 def _check_primary_suite():
5698 if _primary_suite is None: 5695 if _primary_suite is None:
5699 abort('no primary suite found') 5696 abort('no primary suite found')
5700 else: 5697 else: