From 07cdbad1ce1a7b127dcff8d9616a90e10682fcce Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Apr 24 2022 15:02:57 +0000 Subject: [PATCH 1/4] feat: enable all tests --- diff --git a/python-NEAT.spec b/python-NEAT.spec index b017363..89017a9 100644 --- a/python-NEAT.spec +++ b/python-NEAT.spec @@ -1,5 +1,3 @@ -%bcond_with network - Name: python-NEAT Version: 0.9.2 Release: %autorelease @@ -13,6 +11,7 @@ BuildRequires: python3-devel BuildRequires: python3-pytest BuildRequires: gcc gcc-c++ BuildRequires: python3-neuron +BuildRequires: neuron-devel %global _description %{expand: NEAT is a python library for the study, @@ -49,12 +48,17 @@ sed -i 's/^sympy~=1.7.1/sympy>=1.7.1/' requirements/requirements.txt %pyproject_save_files neat %check -%if %{with network} -%pytest -%else -# requires network access -%pytest -k "not testChannel and not testPassiveFit and not testRecalcImpedanceMatrix and not testFitModel and not testParallel and not testActive and not testIOFunctions and not testSolver and not testIntegration and not testInversion" -%endif +# we need to run these in a different directory to ensure that the module isn't +# imported from the source directory +mkdir testdir && pushd testdir +# Python path must be defined so that compilechannels uses the installed module +PYTHONPATH=$RPM_BUILD_ROOT/%{python3_sitelib}:$RPM_BUILD_ROOT/%{python3_sitearch} $RPM_BUILD_ROOT/%{_bindir}/compilechannels default +%pytest ../ +popd + +# remove files generated for the tests +rm -rf find $RPM_BUILD_ROOT/%{python3_sitearch}/neat/tools/simtools/neuron/mech/*.mod +rm -rf find $RPM_BUILD_ROOT/%{python3_sitearch}/neat/tools/simtools/neuron/%{_arch} %files -n python3-NEAT -f %{pyproject_files} %doc README.rst CODE_OF_CONDUCT.rst CONTRIBUTING.rst CONTRIBUTORS.rst From fbd15dcb199ddef0d351601ea08e39c5e1a162b2 Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Apr 24 2022 15:13:43 +0000 Subject: [PATCH 2/4] feat: expand tabs --- diff --git a/python-NEAT.spec b/python-NEAT.spec index 89017a9..33ee62b 100644 --- a/python-NEAT.spec +++ b/python-NEAT.spec @@ -1,17 +1,17 @@ -Name: python-NEAT -Version: 0.9.2 -Release: %autorelease -Summary: NEAT (NEural Analysis Toolkit) - -License: GPLv3 -URL: https://github.com/unibe-cns/NEAT -Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz - -BuildRequires: python3-devel -BuildRequires: python3-pytest -BuildRequires: gcc gcc-c++ -BuildRequires: python3-neuron -BuildRequires: neuron-devel +Name: python-NEAT +Version: 0.9.2 +Release: %autorelease +Summary: NEAT (NEural Analysis Toolkit) + +License: GPLv3 +URL: https://github.com/unibe-cns/NEAT +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +BuildRequires: python3-devel +BuildRequires: python3-pytest +BuildRequires: gcc gcc-c++ +BuildRequires: python3-neuron +BuildRequires: neuron-devel %global _description %{expand: NEAT is a python library for the study, From be39e14cc2228386197f66aaf4e806899a0ef722 Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Apr 24 2022 15:15:19 +0000 Subject: [PATCH 3/4] Remove traling spaces --- diff --git a/python-NEAT.spec b/python-NEAT.spec index 33ee62b..af89fa1 100644 --- a/python-NEAT.spec +++ b/python-NEAT.spec @@ -1,7 +1,7 @@ Name: python-NEAT Version: 0.9.2 Release: %autorelease -Summary: NEAT (NEural Analysis Toolkit) +Summary: NEAT (NEural Analysis Toolkit) License: GPLv3 URL: https://github.com/unibe-cns/NEAT @@ -14,7 +14,7 @@ BuildRequires: python3-neuron BuildRequires: neuron-devel %global _description %{expand: -NEAT is a python library for the study, +NEAT is a python library for the study, simulation and simplification of morphological neuron models.} %description %_description From 48a99cb97a1de9704f76e79035fbb894fc10247b Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Apr 24 2022 16:34:44 +0000 Subject: [PATCH 4/4] feat: fix build on all arches --- diff --git a/0001-feat-support-all-arches.patch b/0001-feat-support-all-arches.patch new file mode 100644 index 0000000..fe3191b --- /dev/null +++ b/0001-feat-support-all-arches.patch @@ -0,0 +1,33 @@ +From 2c0591d9255a958ec0a44041926685232dfcb7e2 Mon Sep 17 00:00:00 2001 +From: "Ankur Sinha (Ankur Sinha Gmail)" +Date: Sun, 24 Apr 2022 16:37:45 +0100 +Subject: [PATCH 1/2] feat: support all arches + +--- + neat/tools/simtools/neuron/neuronmodel.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/neat/tools/simtools/neuron/neuronmodel.py b/neat/tools/simtools/neuron/neuronmodel.py +index cc044ae..d4b126f 100644 +--- a/neat/tools/simtools/neuron/neuronmodel.py ++++ b/neat/tools/simtools/neuron/neuronmodel.py +@@ -2,6 +2,7 @@ import os + import time + import copy + import warnings ++import platform + + import numpy as np + +@@ -56,7 +57,7 @@ except ModuleNotFoundError: + + h.load_file("stdlib.hoc") # contains the lambda rule + h.nrn_load_dll(os.path.join(os.path.dirname(__file__), +- 'x86_64/.libs/libnrnmech.so')) # load all mechanisms ++ platform.machine() + '/.libs/libnrnmech.so')) # load all mechanisms + + + class MechName(object): +-- +2.35.1 + diff --git a/python-NEAT.spec b/python-NEAT.spec index af89fa1..317b2e4 100644 --- a/python-NEAT.spec +++ b/python-NEAT.spec @@ -6,10 +6,15 @@ Summary: NEAT (NEural Analysis Toolkit) License: GPLv3 URL: https://github.com/unibe-cns/NEAT Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +# Patches: https://github.com/sanjayankur31/NEAT/tree/fedora-v0.9.2 +# Support all arches for Neuron libs +# issue filed: https://github.com/unibe-cns/NEAT/issues/142 +Patch0: 0001-feat-support-all-arches.patch BuildRequires: python3-devel BuildRequires: python3-pytest BuildRequires: gcc gcc-c++ +BuildRequires: git-core BuildRequires: python3-neuron BuildRequires: neuron-devel @@ -26,7 +31,7 @@ Summary: %{summary} %prep -%autosetup -n NEAT-%{version} +%autosetup -n NEAT-%{version} -S git sed -i 's/^numpy~=1.20.2/numpy>=1.20.2/' requirements/requirements.txt sed -i 's/^matplotlib~=3.4.1/matplotlib>=3.4.1/' requirements/requirements.txt @@ -48,6 +53,9 @@ sed -i 's/^sympy~=1.7.1/sympy>=1.7.1/' requirements/requirements.txt %pyproject_save_files neat %check +# a few tests fail on i686. +# Upstream report: https://github.com/unibe-cns/NEAT/issues/142#issuecomment-1107874903 +%ifnarch %{ix86} # we need to run these in a different directory to ensure that the module isn't # imported from the source directory mkdir testdir && pushd testdir @@ -55,6 +63,7 @@ mkdir testdir && pushd testdir PYTHONPATH=$RPM_BUILD_ROOT/%{python3_sitelib}:$RPM_BUILD_ROOT/%{python3_sitearch} $RPM_BUILD_ROOT/%{_bindir}/compilechannels default %pytest ../ popd +%endif # remove files generated for the tests rm -rf find $RPM_BUILD_ROOT/%{python3_sitearch}/neat/tools/simtools/neuron/mech/*.mod