[SPARK-8558] [BUILD] Script /dev/run-tests fails when _JAVA_OPTIONS env var set

Author: fe2s <aka.fe2s@gmail.com>
Author: Oleksiy Dyagilev <oleksiy_dyagilev@epam.com>

Closes #6956 from fe2s/fix-run-tests and squashes the following commits:

31b6edc [fe2s] str is a built-in function, so using it as a variable name will lead to spurious warnings in some Python linters
7d781a0 [fe2s] fixing for openjdk/IBM, seems like they have slightly different wording, but all have 'version' word. Surrounding with spaces for the case if version word appears in _JAVA_OPTIONS
cd455ef [fe2s] address comment, looking for java version string rather than expecting to have on a certain line number
ad577d7 [Oleksiy Dyagilev] [SPARK-8558][BUILD] Script /dev/run-tests fails when _JAVA_OPTIONS env var set
This commit is contained in:
fe2s 2015-06-24 15:12:23 -07:00 committed by Josh Rosen
parent 8ab50765cd
commit dca21a83ac

View file

@ -477,7 +477,12 @@ def determine_java_version(java_exe):
raw_output = subprocess.check_output([java_exe, "-version"],
stderr=subprocess.STDOUT)
raw_version_str = raw_output.split('\n')[0] # eg 'java version "1.8.0_25"'
raw_output_lines = raw_output.split('\n')
# find raw version string, eg 'java version "1.8.0_25"'
raw_version_str = next(x for x in raw_output_lines if " version " in x)
version_str = raw_version_str.split()[-1].strip('"') # eg '1.8.0_25'
version, update = version_str.split('_') # eg ['1.8.0', '25']