From 6bc2e660e88c7f0b0db54572d73231eaa6542a05 Mon Sep 17 00:00:00 2001 From: Olivier Cessenat Date: Fri, 4 Mar 2022 10:34:37 +0100 Subject: dos2unix: add the external find feature (#29335) --- var/spack/repos/builtin/packages/dos2unix/package.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/dos2unix/package.py b/var/spack/repos/builtin/packages/dos2unix/package.py index c222a6cbbb..2e53c6a9a3 100644 --- a/var/spack/repos/builtin/packages/dos2unix/package.py +++ b/var/spack/repos/builtin/packages/dos2unix/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import re + from spack import * @@ -19,6 +21,8 @@ class Dos2unix(MakefilePackage): depends_on('gettext') + executables = [r'^dos2unix$'] + @property def build_targets(self): targets = [ @@ -29,3 +33,9 @@ class Dos2unix(MakefilePackage): def install(self, spec, prefix): make('prefix={0}'.format(prefix), 'install') + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)('--version', output=str, error=str) + match = re.search(r'^dos2unix\s+([\d\.]+)', output) + return match.group(1) if match else None -- cgit v1.2.3-60-g2f50