From 10d6d93f89f6801857be6067dddc09480e65166b Mon Sep 17 00:00:00 2001
From: Andrew Davison <andrew.davison@cnrs.fr>
Date: Thu, 22 Feb 2024 13:27:51 +0100
Subject: [PATCH] patch to work with Arbor 0.9.0

---
 packages/py-pynn/package.py                    |  1 +
 packages/py-pynn/pynn-0.12.2-arbor-0.9.0.patch | 13 +++++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 packages/py-pynn/pynn-0.12.2-arbor-0.9.0.patch

diff --git a/packages/py-pynn/package.py b/packages/py-pynn/package.py
index 2e050512..ff55a190 100644
--- a/packages/py-pynn/package.py
+++ b/packages/py-pynn/package.py
@@ -69,6 +69,7 @@ class PyPynn(PythonPackage):
     depends_on("py-pytest",             type='test', when="@0.11.0:")
 
     patch('pynn-0.9.6-python3.patch', when='@0.9.6 ^python@3:')
+    patch('pynn-0.12.2-arbor-0.9.0.patch', when='@0.12.2')
 
     # neuroml and nineml are optional dependencies. Leave out of import_modules to avoid errors in tests
     skip_modules = ['pyNN.neuroml', 'pyNN.nineml', 'pyNN.hardware']
diff --git a/packages/py-pynn/pynn-0.12.2-arbor-0.9.0.patch b/packages/py-pynn/pynn-0.12.2-arbor-0.9.0.patch
new file mode 100644
index 00000000..4a6d1757
--- /dev/null
+++ b/packages/py-pynn/pynn-0.12.2-arbor-0.9.0.patch
@@ -0,0 +1,13 @@
+diff --git a/pyNN/arbor/simulator.py b/pyNN/arbor/simulator.py
+index 69c7eab9..528e8d4d 100644
+--- a/pyNN/arbor/simulator.py
++++ b/pyNN/arbor/simulator.py
+@@ -186,7 +186,7 @@ class State(common.control.BaseState):
+             comm = arbor.mpi_comm(MPI.COMM_WORLD)
+         else:
+             comm = None
+-        self.arbor_context = arbor.context(alloc, comm)
++        self.arbor_context = arbor.context(alloc, mpi=comm)
+         # unclear if we can create the recipe now, or if we have to
+         # construct it only when we've assembled the whole network
+         self.network = NetworkRecipe()
-- 
GitLab