Skip to content

Commit c105220

Browse files
committed
Factor out constant
1 parent efce04b commit c105220

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎download_lt.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
PACKAGE_PATH = 'language_check'
2929
JAVA_6_COMPATIBLE_VERSION = '2.2'
3030
LATEST_VERSION = '2.7'
31+
JAVA_VERSION_REGEX = re.compile(
32+
r'^(?:java|openjdk) version "(?P<major1>\d+)\.(?P<major2>\d+)\.[^"]+"$',
33+
re.MULTILINE)
3134

3235

3336
def parse_java_version(version_text):
@@ -47,10 +50,7 @@ def parse_java_version(version_text):
4750
(1, 8)
4851
4952
"""
50-
match = re.search(
51-
r'^(?:java|openjdk) version "(?P<major1>\d+)\.(?P<major2>\d+)\.[^"]+"$',
52-
version_text,
53-
re.MULTILINE)
53+
match = re.search(JAVA_VERSION_REGEX, version_text)
5454
if not match:
5555
raise SystemExit(
5656
'Could not parse Java version from """{}""".'.format(version_text))

0 commit comments

Comments
 (0)