Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 13471:020099961eb4
renamed JavaVersion to VersionSpec
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 21 Dec 2013 13:33:05 +0100 |
parents | eb7bc1fd38de |
children | 69f3251332c9 |
comparison
equal
deleted
inserted
replaced
13470:eb7bc1fd38de | 13471:020099961eb4 |
---|---|
718 if parts[0] == 'suite': | 718 if parts[0] == 'suite': |
719 if self.name != value: | 719 if self.name != value: |
720 abort('suite name in project file does not match ' + _suitename(self.mxDir)) | 720 abort('suite name in project file does not match ' + _suitename(self.mxDir)) |
721 elif parts[0] == 'mxversion': | 721 elif parts[0] == 'mxversion': |
722 try: | 722 try: |
723 self.requiredMxVersion = JavaVersion(value) | 723 self.requiredMxVersion = VersionSpec(value) |
724 except AssertionError as ae: | 724 except AssertionError as ae: |
725 abort('Exception while parsing "mxversion" in project file: ' + str(ae)) | 725 abort('Exception while parsing "mxversion" in project file: ' + str(ae)) |
726 else: | 726 else: |
727 abort('Single part property must be "suite": ' + key) | 727 abort('Single part property must be "suite": ' + key) |
728 | 728 |
1556 other = JavaCompliance(other) | 1556 other = JavaCompliance(other) |
1557 | 1557 |
1558 return cmp(self.value, other.value) | 1558 return cmp(self.value, other.value) |
1559 | 1559 |
1560 """ | 1560 """ |
1561 A Java version as defined in JSR-56 | 1561 A version specification as defined in JSR-56 |
1562 """ | 1562 """ |
1563 class JavaVersion: | 1563 class VersionSpec: |
1564 def __init__(self, versionString): | 1564 def __init__(self, versionString): |
1565 validChar = r'[\x21-\x25\x27-\x29\x2c\x2f-\x5e\x60-\x7f]' | 1565 validChar = r'[\x21-\x25\x27-\x29\x2c\x2f-\x5e\x60-\x7f]' |
1566 separator = r'[.\-_]' | 1566 separator = r'[.\-_]' |
1567 m = re.match("^" + validChar + '+(' + separator + validChar + '+)*$', versionString) | 1567 m = re.match("^" + validChar + '+(' + separator + validChar + '+)*$', versionString) |
1568 assert m is not None, 'not a recognized version string: ' + versionString | 1568 assert m is not None, 'not a recognized version string: ' + versionString |
1610 print e.output | 1610 print e.output |
1611 abort(e.returncode) | 1611 abort(e.returncode) |
1612 | 1612 |
1613 output = output.split() | 1613 output = output.split() |
1614 assert output[1] == 'version' | 1614 assert output[1] == 'version' |
1615 self.version = JavaVersion(output[2].strip('"')) | 1615 self.version = VersionSpec(output[2].strip('"')) |
1616 self.javaCompliance = JavaCompliance(self.version.versionString) | 1616 self.javaCompliance = JavaCompliance(self.version.versionString) |
1617 | 1617 |
1618 if self.debug_port is not None: | 1618 if self.debug_port is not None: |
1619 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] | 1619 self.java_args += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(self.debug_port)] |
1620 | 1620 |
4526 abort(retcode) | 4526 abort(retcode) |
4527 except KeyboardInterrupt: | 4527 except KeyboardInterrupt: |
4528 # no need to show the stack trace when the user presses CTRL-C | 4528 # no need to show the stack trace when the user presses CTRL-C |
4529 abort(1) | 4529 abort(1) |
4530 | 4530 |
4531 version = JavaVersion("1.0") | 4531 version = VersionSpec("1.0") |
4532 | 4532 |
4533 if __name__ == '__main__': | 4533 if __name__ == '__main__': |
4534 # rename this module as 'mx' so it is not imported twice by the commands.py modules | 4534 # rename this module as 'mx' so it is not imported twice by the commands.py modules |
4535 sys.modules['mx'] = sys.modules.pop('__main__') | 4535 sys.modules['mx'] = sys.modules.pop('__main__') |
4536 | 4536 |