comparison mxtool/mx.py @ 10585:be8b942f448f

made parsing of mx/env more robust
author Doug Simon <doug.simon@oracle.com>
date Mon, 01 Jul 2013 10:52:24 +0200
parents aee899c96b0b
children 8ce168d68d49 8ab76b7c6ff6
comparison
equal deleted inserted replaced
10584:ace9e84cc773 10585:be8b942f448f
604 604
605 def _load_env(self, mxDir): 605 def _load_env(self, mxDir):
606 e = join(mxDir, 'env') 606 e = join(mxDir, 'env')
607 if exists(e): 607 if exists(e):
608 with open(e) as f: 608 with open(e) as f:
609 lineNum = 0
609 for line in f: 610 for line in f:
611 lineNum = lineNum + 1
610 line = line.strip() 612 line = line.strip()
611 if len(line) != 0 and line[0] != '#': 613 if len(line) != 0 and line[0] != '#':
614 if not '=' in line:
615 abort(e + ':' + str(lineNum) + ': line does not match pattern "key=value"')
612 key, value = line.split('=', 1) 616 key, value = line.split('=', 1)
613 os.environ[key.strip()] = expandvars_in_property(value.strip()) 617 os.environ[key.strip()] = expandvars_in_property(value.strip())
614
615 def _post_init(self, opts): 618 def _post_init(self, opts):
616 mxDir = join(self.dir, 'mx') 619 mxDir = join(self.dir, 'mx')
617 self._load_projects(mxDir) 620 self._load_projects(mxDir)
618 for p in self.projects: 621 for p in self.projects:
619 existing = _projects.get(p.name) 622 existing = _projects.get(p.name)