changeset 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 ace9e84cc773
children 110434bc2913
files mxtool/mx.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Sun Jun 30 11:24:38 2013 -0400
+++ b/mxtool/mx.py	Mon Jul 01 10:52:24 2013 +0200
@@ -606,12 +606,15 @@
         e = join(mxDir, 'env')
         if exists(e):
             with open(e) as f:
+                lineNum = 0
                 for line in f:
+                    lineNum = lineNum + 1
                     line = line.strip()
                     if len(line) != 0 and line[0] != '#':
+                        if not '=' in line:
+                            abort(e + ':' + str(lineNum) + ': line does not match pattern "key=value"')
                         key, value = line.split('=', 1)
                         os.environ[key.strip()] = expandvars_in_property(value.strip())
-
     def _post_init(self, opts):
         mxDir = join(self.dir, 'mx')
         self._load_projects(mxDir)