From ec908081c4c1e14dd57dc0f13958822cdccaa339 Mon Sep 17 00:00:00 2001
From: JCGoran <JCGoran@users.noreply.github.com>
Date: Wed, 24 Jul 2024 09:55:15 +0200
Subject: [PATCH] Remove CentOS 7 and pin NumPy version (#70)

* Remove CentOS 7

* Pin NumPy to version <2

* Update README.md
---
 .github/workflows/build-neuron.yml     |  2 --
 README.md                              | 16 ++++++---------
 scripts/buildNeuron.sh                 |  2 ++
 scripts/environment_redhat_centos_7.sh |  4 ----
 scripts/install_redhat_centos_7.sh     | 27 --------------------------
 5 files changed, 8 insertions(+), 43 deletions(-)
 delete mode 100644 scripts/environment_redhat_centos_7.sh
 delete mode 100755 scripts/install_redhat_centos_7.sh

diff --git a/.github/workflows/build-neuron.yml b/.github/workflows/build-neuron.yml
index a384446..b0e68b0 100644
--- a/.github/workflows/build-neuron.yml
+++ b/.github/workflows/build-neuron.yml
@@ -82,8 +82,6 @@ jobs:
         - { vm: macos-13, flavour: macOS }
         # GitHub Actions MacOS 12 runner
         - { vm: macos-12, flavour: macOS }
-        # CentOS7 Docker image
-        - { vm: ubuntu-latest, container: "centos:7", flavour: redhat }
         # Alma Linux 8 Docker image
         - { vm: ubuntu-latest, container: "almalinux:8.10", flavour: redhat }
         # CentOS Stream 9 Docker image
diff --git a/README.md b/README.md
index 4614876..31a3781 100644
--- a/README.md
+++ b/README.md
@@ -5,18 +5,14 @@ This repository hosts [scheduled GitHub Actions workflows](.github/workflows/neu
 The default branch of NEURON (and `neuron-nightly` wheel) is tested every night,
 and the latest tagged release (and corresponding `neuron` wheel) is tested once
 a week.
-At present Ubuntu 20.04, Ubuntu 22.04, Fedora 37, Fedora 38, CentOS7, CentOS
-Stream 8, CentOS Stream 9, Debian Bullseye (11), Debian Bookworm (12), macOS 11
-and macOS 12 are tested.
+At present, Ubuntu 20.04, Ubuntu 24.04, Fedora 37, Fedora 40, CentOS Stream
+9, Alma Linux 8, Debian Bullseye (11), Debian Bookworm (12), macOS 12 and
+macOS 13 are tested.
 
 The tested distributions are generally configured with the explicit
 name/version of the second-newest version of the distribution at the time,
 while a generic "latest" tag is used for the latest version (where available).
 
-There is currently an exception for the CentOS family, where three versions are
-retained because the third-newest, CentOS7, is still in use on the BlueBrain5
-system.
-
 This means that when a new version of a distribution is released, we
 automatically start testing it.
 When this happens, the old second-newest version generally becomes the
@@ -35,7 +31,7 @@ The system packages needed on each platform are listed in the pair of scripts:
 scripts/install_{flavour}_{container}.sh [this file may be missing if no container-specific setup is needed]
 scripts/install_{flavour}.sh
 ```
-Taking CentOS7 (a RedHat based distribution) as an example, the scripts [install_redhat_centos:7.sh](scripts/install_redhat_centos:7.sh) and [install_redhat.sh](scripts/install_redhat.sh) install the required system packages that are not already included in the [centos:7](https://hub.docker.com/_/centos) image on Docker Hub.
+Taking Alma Linux 8 (a RedHat based distribution) as an example, the scripts [install_redhat_almalinux_8_10.sh](scripts/install_redhat_almalinux_8_10.sh) and [install_redhat.sh](scripts/install_redhat.sh) install the required system packages that are not already included in the [almalinux:8.10](https://hub.docker.com/_/almalinux) image on Docker Hub.
 
 Some of the content of these scripts is specific to the GitHub Actions environment in which they are regularly tested; this is commented in the following way:
 ```sh
@@ -58,14 +54,14 @@ scripts/environment.sh
 ```
 In a local installation, you might prefer to place these commands in a `~/.bashrc` or `~/.zshrc` file.
 
-When using RedHat-derived Linux distributions, such as Fedora and CentOS, some dependencies may be made available using [Software Collections](https://www.softwarecollections.org/en/).
+When using RedHat-derived Linux distributions, such as Fedora and CentOS Stream, some dependencies may be made available using [Software Collections](https://www.softwarecollections.org/en/).
 These are enabled using the `scl enable collection_name command`, which launches a subshell and cannot trivially be included in the `environmentXXX.sh` scripts above.
 For interactive use, one can simply run
 ```
 scl enable collection_name bash
 ```
 to get a shell with the given collection enabled.
-> When running in GitHub Actions, the `scl enable ...` command is injected in the [runUnprivileged.sh](wrappers/runUnprivileged.sh) wrapper, based on `SOFTWARE_COLLECTIONS_*` environment modules set in the [top-level YAML configuration](.github/workflows/neuron-ci.yaml). This is, for example, used to install a modern compiler toolchain on CentOS7.
+> When running in GitHub Actions, the `scl enable ...` command is injected in the [runUnprivileged.sh](wrappers/runUnprivileged.sh) wrapper, based on `SOFTWARE_COLLECTIONS_*` environment modules set in the [top-level YAML configuration](.github/workflows/neuron-ci.yaml).
 
 ## Extra dependencies and NEURON installation
 The installation of extra packages (via `pip`) and the installation of NEURON itself is steered by the [buildNeuron.sh](scripts/buildNeuron.sh) script.
diff --git a/scripts/buildNeuron.sh b/scripts/buildNeuron.sh
index 77e96b5..9b5ee2c 100755
--- a/scripts/buildNeuron.sh
+++ b/scripts/buildNeuron.sh
@@ -36,6 +36,8 @@ if [[ -f external/nmodl/requirements.txt ]]; then
 fi
 # Needed for installation of older NEURON versions with Python 12
 pip install --upgrade setuptools
+# NumPy 2 support is currently not there yet
+pip install 'numpy<2'
 
 # Set default compilers, but don't override preset values
 export CC=${CC:-gcc}
diff --git a/scripts/environment_redhat_centos_7.sh b/scripts/environment_redhat_centos_7.sh
deleted file mode 100644
index 46dc3b0..0000000
--- a/scripts/environment_redhat_centos_7.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-# Ensure that the newer CMake version that was installed on CentOS7 is
-# preferred over the original system version.
-export PATH=/usr/local/sbin:/usr/local/bin:${PATH}
diff --git a/scripts/install_redhat_centos_7.sh b/scripts/install_redhat_centos_7.sh
deleted file mode 100755
index 65e645b..0000000
--- a/scripts/install_redhat_centos_7.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-# Use MPICH instead of OpenMPI on CentOS7, see #51.
-# This variable will be read by install_redhat.sh
-mpi_lib=mpich-devel
-# EPEL is needed to get CMake 3 in CentOS7
-# SCL is needed to get a modern toolchain in CentOS7
-yum install -y epel-release centos-release-scl centos-release-scl-rh
-
-# Install a newer toolchain for CentOS7
-yum install -y cmake3 ${SOFTWARE_COLLECTIONS_centos_7} rh-python38-python-devel
-
-# Make sure `cmake` and `ctest` see the 3.x versions, instead of the ancient
-# CMake 2 included in CentOS7
-alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
-  --slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
-  --slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
-  --slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3
-
-# Install a newer version of Flex; this logic is copied from that in the
-# Dockerfile that is used to build the NEURON Python wheels.
-curl -L -o flex-2.6.4-9.el9.src.rpm http://mirror.stream.centos.org/9-stream/AppStream/source/tree/Packages/flex-2.6.4-9.el9.src.rpm
-yum-builddep -y flex-2.6.4-9.el9.src.rpm
-yum install -y rpm-build
-rpmbuild --rebuild flex-2.6.4-9.el9.src.rpm
-ls -R ${HOME}/rpmbuild
-yum install -y ${HOME}/rpmbuild/RPMS/x86_64/*.rpm
-flex --version