From 5e595586a77dd7a8de25169dfc6cd45cb4cd3a5d Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 17 Jan 2022 02:39:17 -0600 Subject: [PATCH] zip: add external detection (#28434) --- var/spack/repos/builtin/packages/zip/package.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/var/spack/repos/builtin/packages/zip/package.py b/var/spack/repos/builtin/packages/zip/package.py index b2a3ed161c..514d666c2f 100644 --- a/var/spack/repos/builtin/packages/zip/package.py +++ b/var/spack/repos/builtin/packages/zip/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import re + class Zip(MakefilePackage): """Zip is a compression and file packaging/archive utility.""" @@ -27,6 +29,14 @@ class Zip(MakefilePackage): patch('09-hardening-build-fix-2.patch') patch('10-remove-build-date.patch') + executables = ['^zip$'] + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)('--version', output=str, error=str) + match = re.search(r'This is Zip (\S+)', output) + return match.group(1) if match else None + def url_for_version(self, version): return 'http://downloads.sourceforge.net/infozip/zip{0}.tar.gz'.format(version.joined)