Java: add spack external find support (#18006)
This commit is contained in:
parent
1ed70d0e2c
commit
00e9e1b3c7
@ -3,11 +3,11 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
from spack.util.prefix import Prefix
|
import os
|
||||||
from spack import *
|
import re
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
import os
|
from spack.util.prefix import Prefix
|
||||||
|
|
||||||
|
|
||||||
class Jdk(Package):
|
class Jdk(Package):
|
||||||
@ -79,6 +79,19 @@ class Jdk(Package):
|
|||||||
# can symlink all *.jar files to `prefix.lib.ext`
|
# can symlink all *.jar files to `prefix.lib.ext`
|
||||||
extendable = True
|
extendable = True
|
||||||
|
|
||||||
|
executables = ['^java$']
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def determine_version(cls, exe):
|
||||||
|
output = Executable(exe)('-version', output=str, error=str)
|
||||||
|
|
||||||
|
# Make sure this is actually Oracle JDK, not OpenJDK
|
||||||
|
if 'openjdk' in output:
|
||||||
|
return None
|
||||||
|
|
||||||
|
match = re.search(r'\(build (\S+)\)', output)
|
||||||
|
return match.group(1).replace('+', '_') if match else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def home(self):
|
def home(self):
|
||||||
"""Most of the time, ``JAVA_HOME`` is simply ``spec['java'].prefix``.
|
"""Most of the time, ``JAVA_HOME`` is simply ``spec['java'].prefix``.
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
from spack import *
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
# If you need to add a new version, please be aware that:
|
# If you need to add a new version, please be aware that:
|
||||||
@ -60,6 +60,19 @@ class Openjdk(Package):
|
|||||||
# can symlink all *.jar files to `prefix.lib.ext`
|
# can symlink all *.jar files to `prefix.lib.ext`
|
||||||
extendable = True
|
extendable = True
|
||||||
|
|
||||||
|
executables = ['^java$']
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def determine_version(cls, exe):
|
||||||
|
output = Executable(exe)('-version', output=str, error=str)
|
||||||
|
|
||||||
|
# Make sure this is actually OpenJDK, not Oracle JDK
|
||||||
|
if 'openjdk' not in output:
|
||||||
|
return None
|
||||||
|
|
||||||
|
match = re.search(r'\(build (\S+)\)', output)
|
||||||
|
return match.group(1).replace('+', '_') if match else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def home(self):
|
def home(self):
|
||||||
"""Most of the time, ``JAVA_HOME`` is simply ``spec['java'].prefix``.
|
"""Most of the time, ``JAVA_HOME`` is simply ``spec['java'].prefix``.
|
||||||
|
Loading…
Reference in New Issue
Block a user