Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions avaframeConnector_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,39 @@ def find_python():
raise Exception("Python executable not found")


# Pin: the connector is only compatible with avaframe < 2.0
avaFrameSpec = "avaframe<2.0"

def installAvaframe():
pythonExe = find_python()
subprocess.call(
[pythonExe, "-m", "pip", "install", "--user", avaFrameSpec]
)


def avaframeMajor():
from avaframe.version import getVersion

try:
return int(getVersion().split(".")[0])
except (ValueError, AttributeError):
return None


try:
import avaframe

_major = avaframeMajor()
if _major is not None and _major >= 2:
QMessageBox.information(
None,
"INFO",
"AvaFrame >=2.0 detected; the connector requires <2.0. "
"Downgrading now — please restart QGIS afterwards.",
)
installAvaframe()
except ModuleNotFoundError:
# subprocess.call(["pip3", "install", "--upgrade", "--user", "pandas", "numpy"])
subprocess.call(["pip3", "install", "avaframe", "--user"])
installAvaframe()
try:
import avaframe
except ModuleNotFoundError:
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ platforms = ["linux-64"]

[tool.pixi.dependencies]
python = "<3.14"
numpy = "<2"
setuptools = "*"
setuptools-scm = "*"

Expand All @@ -60,7 +61,8 @@ pixi-pycharm = "*"
black = "*"

[tool.pixi.feature.dev.pypi-dependencies]
avaframe = { path = "../AvaFrame/", editable = true }
#avaframe = { path = "../AvaFrame/", editable = true }
avaframe = ">=1.13.2, <2"

# Feature qgis
[tool.pixi.feature.qgis.dependencies]
Expand All @@ -70,4 +72,4 @@ qgis = ">=3.22"
[tool.pixi.environments]
default = { features = ["dev"], solve-group = "default" }
dev = ["dev"]
qgis = ["qgis", "dev"]
qgis = ["qgis", "dev"]
Loading