Skip to content
4 changes: 3 additions & 1 deletion repos/spack_repo/builtin/packages/py_psycopg2/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class PyPsycopg2(PythonPackage):
homepage = "https://psycopg.org/"
pypi = "psycopg2/psycopg2-2.8.6.tar.gz"

version("2.9.11", sha256="964d31caf728e217c697ff77ea69c2ba0865fa41ec20bb00f0977e62fdcc52e3")
version("2.9.10", sha256="12ec0b40b0273f95296233e8750441339298e6a572f7039da5b260e3c8b60e11")
version("2.9.6", sha256="f15158418fd826831b28585e2ab48ed8df2d0d98f502a2b4fe619e7d5ca29011")
version("2.9.1", sha256="de5303a6f1d0a7a34b9d40e4d3bef684ccc44a49bbe3eb85e3c0bffb4a131b7c")
Expand All @@ -24,7 +25,8 @@ class PyPsycopg2(PythonPackage):
# https://github.com/psycopg/psycopg2/blob/master/doc/src/install.rst
# https://www.psycopg.org/docs/news.html#news
# https://pypi.org/project/psycopg2/#history
depends_on("python@:3.13", when="@2.9.10:", type=("build", "link", "run"))
depends_on("python@:3.14", when="@2.9.11:", type=("build", "link", "run"))
depends_on("python@:3.13", when="@2.9.10", type=("build", "link", "run"))
depends_on("python@:3.11", when="@2.9.5:2.9.9", type=("build", "link", "run"))
depends_on("python@:3.10", when="@2.9.1:2.9.4", type=("build", "link", "run"))
depends_on("python@:3.9", when="@2.8.6:2.9.0", type=("build", "link", "run"))
Expand Down
40 changes: 36 additions & 4 deletions repos/spack_repo/builtin/packages/qgis/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from pathlib import Path

from spack_repo.builtin.build_systems.cmake import CMakePackage

from spack.package import *
Expand All @@ -14,12 +16,13 @@ class Qgis(CMakePackage):
"""

homepage = "https://qgis.org"
url = "https://qgis.org/downloads/qgis-3.8.1.tar.bz2"
url = "https://qgis.org/downloads/qgis-3.44.7.tar.bz2"

maintainers("adamjstewart", "Sinan81", "Chrismarsh")

license("GPL-2.0-or-later")

version("3.44.7", sha256="1ab06f40600c84e928b4fe22a66997d80973201b10769e7a636e5be83459b814")
# Prefer latest LTR
version(
"3.40.6",
Expand Down Expand Up @@ -122,7 +125,9 @@ class Qgis(CMakePackage):
depends_on("gdal@2.1.0: +python", type=("build", "link", "run"))
depends_on("gdal@3.2.0: +python", type=("build", "link", "run"), when="@3.28:")
depends_on("geos@3.4.0:")
depends_on("libspatialindex")

# https://github.com/libspatialindex/libspatialindex/issues/276
depends_on("libspatialindex@:2.0.0")
depends_on("libspatialite@4.2.0:")
depends_on("libzip")
depends_on("libtasn1")
Expand Down Expand Up @@ -163,6 +168,7 @@ class Qgis(CMakePackage):
depends_on("py-owslib", type="run")
depends_on("py-jinja2", type="run")
depends_on("py-pygments", type="run")
depends_on("py-packaging", type="run", when="@3.44:")

# optionals
depends_on("postgresql@8:", when="+postgresql") # for PostGIS support
Expand Down Expand Up @@ -223,9 +229,35 @@ def fix_qsci_sip(self):
elif "^py-pyqt6" in self.spec:
pyqtx = "PyQt6"

pp = Path("python/gui/pyproject.toml.in")
txt = pp.read_text(encoding="utf-8")

sip_inc_dir = join_path(self["qscintilla"].module.python_platlib, pyqtx, "bindings")
with open(join_path("python", "gui", "pyproject.toml.in"), "a") as tomlfile:
tomlfile.write(f'\n[tool.sip.project]\nsip-include-dirs = ["{sip_inc_dir}"]\n')
sip_line = f'sip-include-dirs = ["{sip_inc_dir}"]'

# QGis 3.42.0 added a @sipabi@ that expands to the [tool.sip.project] header.
# The simple patch append approach results in a duplicate header which causes a
# build failure. The middle case is probably overkill but it is kept as a just
# in (edge) case

# if it's already there, do nothing
if sip_line not in txt:
if "@sipabi@" in txt:
# @sipabi@ expands to the [tool.sip.project] table + abi-version,
# add just the key immediately after it
txt = txt.replace("@sipabi@", "@sipabi@\n" + sip_line, 1)

elif "[tool.sip.project]" in txt:
# insert right after the first header occurrence
txt = txt.replace("[tool.sip.project]", "[tool.sip.project]\n" + sip_line, 1)

else:
# no macro + no table, append a new table
if not txt.endswith("\n"):
txt += "\n"
txt += "\n[tool.sip.project]\n" + sip_line + "\n"

pp.write_text(txt, encoding="utf-8")

def cmake_args(self):
spec = self.spec
Expand Down
Loading