diff options
-rw-r--r-- | var/spack/repos/builtin/packages/dos2unix/package.py | 10 |
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 |