summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorBrian Van Essen <vanessen1@llnl.gov>2024-06-20 22:40:23 +0200
committerGitHub <noreply@github.com>2024-06-20 13:40:23 -0700
commit9c31ff74c45816eb95a96a35a1c9a248038d9645 (patch)
tree3dfc1944d3256861adc047421a567d29979bc69b /var
parent90c8fe0182cc2ff1217f0ce14f6d63b2d31eaea9 (diff)
downloadspack-9c31ff74c45816eb95a96a35a1c9a248038d9645.tar.gz
spack-9c31ff74c45816eb95a96a35a1c9a248038d9645.tar.bz2
spack-9c31ff74c45816eb95a96a35a1c9a248038d9645.tar.xz
spack-9c31ff74c45816eb95a96a35a1c9a248038d9645.zip
Allow zlib to find external installations. (#44694)
* Allow zlib to find external installations. * Apply suggestions from code review * Fixed the determine_version function to loop over all of the potential libraries that could be installed by zlib. --------- Co-authored-by: John W. Parent <45471568+johnwparent@users.noreply.github.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/zlib/package.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/zlib/package.py b/var/spack/repos/builtin/packages/zlib/package.py
index 0e6813e255..4d08ddd45d 100644
--- a/var/spack/repos/builtin/packages/zlib/package.py
+++ b/var/spack/repos/builtin/packages/zlib/package.py
@@ -8,6 +8,7 @@
# The AutotoolsPackage causes zlib to fail to build with PGI
import glob
import os
+import re
import spack.build_systems.generic
import spack.build_systems.makefile
@@ -24,6 +25,9 @@ class Zlib(MakefilePackage, Package):
url = "http://zlib.net/fossils/zlib-1.2.11.tar.gz"
git = "https://github.com/madler/zlib.git"
+ tags = ["core-packages"]
+ libraries = ["libz", "zlib", "zlibstatic", "zlibd", "zlibstaticd"]
+
version("1.3.1", sha256="9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23")
version("1.3", sha256="ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e")
version("1.2.13", sha256="b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30")
@@ -63,6 +67,18 @@ class Zlib(MakefilePackage, Package):
license("Zlib")
+ @classmethod
+ def determine_version(cls, lib):
+ for library in cls.libraries:
+ for ext in library_extensions:
+ if ext == "dylib":
+ pattern = re.compile(rf"{library}\.(\d+\.\d+\.\d+)\.{ext}")
+ else:
+ pattern = re.compile(rf"{library}\.{ext}\.(\d+\.\d+\.\d+)")
+ match = re.search(pattern, lib)
+ if match:
+ return match.group(1)
+
@property
def libs(self):
shared = "+shared" in self.spec