dos2unix: add the external find feature (#29335)

This commit is contained in:
Olivier Cessenat 2022-03-04 10:34:37 +01:00 committed by GitHub
parent 8665ccb661
commit 6bc2e660e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 @@ def build_targets(self):
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