summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Cessenat <cessenat@gmail.com>2022-03-04 10:34:37 +0100
committerGitHub <noreply@github.com>2022-03-04 02:34:37 -0700
commit6bc2e660e88c7f0b0db54572d73231eaa6542a05 (patch)
treed7390aa33f63ab9b03778b06008b42c81cba60f6
parent8665ccb6611d40720270d2d6566ead176a399537 (diff)
downloadspack-6bc2e660e88c7f0b0db54572d73231eaa6542a05.tar.gz
spack-6bc2e660e88c7f0b0db54572d73231eaa6542a05.tar.bz2
spack-6bc2e660e88c7f0b0db54572d73231eaa6542a05.tar.xz
spack-6bc2e660e88c7f0b0db54572d73231eaa6542a05.zip
dos2unix: add the external find feature (#29335)
-rw-r--r--var/spack/repos/builtin/packages/dos2unix/package.py10
1 files changed, 10 insertions, 0 deletions
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