From 78f349c635e477bb846b24e55912b0df80070f6c Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 16 Oct 2020 20:13:39 +0200 Subject: [PATCH] ghostscript: add external package detection (#19346) Co-authored-by: Massimiliano Culpo --- var/spack/repos/builtin/packages/ghostscript/package.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/var/spack/repos/builtin/packages/ghostscript/package.py b/var/spack/repos/builtin/packages/ghostscript/package.py index ee14758dd1..d69a10e007 100644 --- a/var/spack/repos/builtin/packages/ghostscript/package.py +++ b/var/spack/repos/builtin/packages/ghostscript/package.py @@ -5,6 +5,7 @@ from spack import * import shutil +import re class Ghostscript(AutotoolsPackage): @@ -13,6 +14,8 @@ class Ghostscript(AutotoolsPackage): homepage = "http://ghostscript.com/" url = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs926/ghostscript-9.26.tar.gz" + executables = [r'^gs$'] + version('9.50', sha256='0f53e89fd647815828fc5171613e860e8535b68f7afbc91bf89aee886769ce89') version('9.27', sha256='9760e8bdd07a08dbd445188a6557cb70e60ccb6a5601f7dbfba0d225e28ce285') version('9.26', sha256='831fc019bd477f7cc2d481dc5395ebfa4a593a95eb2fe1eb231a97e450d7540d') @@ -71,3 +74,9 @@ def build(self, spec, prefix): def install(self, spec, prefix): make('install') make('soinstall') + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)('--help', output=str, error=str) + match = re.search(r'GPL Ghostscript (\S+)', output) + return match.group(1) if match else None