Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify NEST version detection #924

Merged
merged 15 commits into from
Aug 8, 2023
Merged
2 changes: 1 addition & 1 deletion .github/workflows/nestml-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
nest_branch: ["v2.20.2", "v3.0", "v3.1", "v3.2", "v3.3", "v3.4", "master"]
nest_branch: ["v2.20.2", "v3.0", "v3.1", "v3.2", "v3.3", "v3.4", "v3.5", "master"]
fail-fast: false
steps:
# Checkout the repository contents
Expand Down
29 changes: 16 additions & 13 deletions pynestml/codegeneration/nest_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,23 @@ def detect_nest_version(cls) -> str:
pass

if "DataConnect" in dir(nest):
nest_version = "v2.20.2"
elif "kernel_status" not in dir(nest): # added in v3.1
nest_version = "v3.0"
elif "Kplus" in syn.get().keys(): # "Kplus" trace variable is made accessible via get_status() in master
nest_version = "master"
elif "prepared" in nest.GetKernelStatus().keys(): # "prepared" key was added after v3.3 release
nest_version = "v3.4"
elif "tau_u_bar_minus" in neuron.get().keys(): # added in v3.3
nest_version = "v3.3"
elif "tau_Ca" in vt.get().keys(): # removed in v3.2
nest_version = "v3.1"
nest_version = "v2.20.2"
else:
nest_version = "v3.2"

nest_version = "v" + nest.__version__
if nest_version.startswith("v3.5"):
if "post0.dev0" in nest_version:
nest_version = "master"
else:
if "kernel_status" not in dir(nest): # added in v3.1
nest_version = "v3.0"
elif "prepared" in nest.GetKernelStatus().keys(): # "prepared" key was added after v3.3 release
nest_version = "v3.4"
elif "tau_u_bar_minus" in neuron.get().keys(): # added in v3.3
nest_version = "v3.3"
elif "tau_Ca" in vt.get().keys(): # removed in v3.2
nest_version = "v3.1"
else:
nest_version = "v3.2"
except ModuleNotFoundError:
nest_version = ""

Expand Down