mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
16 lines
559 B
Python
Executable File
16 lines
559 B
Python
Executable File
import re
|
|
import subprocess
|
|
|
|
many_versions = [ '1.4.32', '1.5.31', '1.6.0-RC2' ]
|
|
|
|
def get_single_version():
|
|
versionOutput = subprocess.run(['kotlinc', '-version'], capture_output=True, text=True)
|
|
m = re.match(r'.* kotlinc-jvm ([0-9]+\.[0-9]+\.)[0-9]+ .*', versionOutput.stderr)
|
|
if m is None:
|
|
raise Exception('Cannot detect version of kotlinc')
|
|
prefix = m.group(1)
|
|
for version in many_versions:
|
|
if version.startswith(prefix):
|
|
return version
|
|
raise Exception('No suitable kotlinc version found for ' + prefix)
|