blob: 2a82fad9b552ae5a34cc00cae7112f6f8adfcf1f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import re
import spack.package_base
from spack.package import *
class FindExternals1(AutotoolsPackage):
executables = ["find-externals1-exe"]
url = "http://www.example.com/find-externals-1.0.tar.gz"
version("1.0", md5="abcdef1234567890abcdef1234567890")
@classmethod
def determine_spec_details(cls, prefix, exes_in_prefix):
exe_to_path = dict((os.path.basename(p), p) for p in exes_in_prefix)
exes = [x for x in exe_to_path.keys() if "find-externals1-exe" in x]
if not exes:
return
exe = spack.util.executable.Executable(exe_to_path[exes[0]])
output = exe("--version", output=str)
if output:
match = re.search(r"find-externals1.*version\s+(\S+)", output)
if match:
version_str = match.group(1)
return Spec.from_detection("find-externals1@{0}".format(version_str))
|