Skip to content

Commit 0bc4199

Browse files
committed
Simplify
1 parent 6b211ac commit 0bc4199

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎download_lt.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,18 @@ def get_newest_possible_languagetool_version():
7070
stderr=subprocess.STDOUT,
7171
universal_newlines=True)
7272
# http://www.oracle.com/technetwork/java/javase/versioning-naming-139433.html
73-
regex = r'^java version "(?P<major1>\d+)\.(?P<major2>\d+)\.[^"]+"$'
74-
match = re.search(regex, output, re.MULTILINE)
73+
match = re.search(
74+
r'^java version "(?P<major1>\d+)\.(?P<major2>\d+)\.[^"]+"$',
75+
output,
76+
re.MULTILINE)
7577
if not match:
7678
raise InstallationError(
7779
'Could not parse Java version from """{}""".'.format(output))
7880

79-
java_version = int(match.group('major1')) * 1000 + \
80-
int(match.group('major2'))
81-
if java_version >= 1007:
81+
java_version = (int(match.group('major1')), int(match.group('major2')))
82+
if java_version >= (1, 7):
8283
return '2.7'
83-
elif java_version >= 1006:
84+
elif java_version >= (1, 6):
8485
warn('language-check would be able to use a newer version of '
8586
'LanguageTool if you had Java 7 or newer installed')
8687
return '2.2'

0 commit comments

Comments
 (0)