From a963f6bcc09ae0e7e29c05d679c840c28bfdd408 Mon Sep 17 00:00:00 2001
From: Henri Menke <henri@henrimenke.de>
Date: Thu, 4 Jan 2024 17:40:54 +0100
Subject: [PATCH] Add OpenSUSE pipeline with Python 3.6

---
 .gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++++++++
 setup.cfg      | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)
 create mode 100644 setup.cfg

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9bcd94b..c65878b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -66,6 +66,35 @@ stages:
   - echo "Which version of Debian are we running?"
   - cat /etc/issue
 
+.prepare_opensuse: &prepare_opensuse
+  - echo -e "\e[0Ksection_start:`date +%s`:deps[collapsed=true]\r\e[0KInstall dependencies"
+  - |
+    zypper -n refresh
+    zypper -n install --no-recommends python3 patterns-devel-base-devel_basis git gzip rsync
+    python3 -m ensurepip
+    pip3 install --upgrade pip setuptools
+  - |
+    python3 -m venv venv
+    source venv/bin/activate
+    type python3
+    python3 --version
+  - |
+    pip3 install --upgrade pip setuptools
+    pip3 install .[dev]
+    pytest --version
+  - echo -e "\e[0Ksection_end:`date +%s`:deps\r\e[0K"
+
+  # https://gitlab.gwdg.de/mpsd-cs/spack-environments/-/merge_requests/56
+  - echo -e "\e[0Ksection_start:`date +%s`:patch[collapsed=true]\r\e[0KBinary patching /bin/bash"
+  - |
+    cd "$(mktemp -d)"
+    cp "$(readlink -e /bin/bash)" bash.patched
+    printf '5.4' > dist_version
+    dd if=dist_version of=bash.patched obs=1 seek=866776 conv=notrunc
+    [ 5 -eq $(./bash.patched -c 'echo "${BASH_VERSINFO[0]}"') ] || { echo "Binary patching unsuccessful"; false; }
+    mv bash.patched "$(readlink -e /bin/bash)"
+    cd -
+  - echo -e "\e[0Ksection_end:`date +%s`:patch\r\e[0K"
 
 style:
   stage: test
@@ -96,3 +125,10 @@ test-bookworm:
   script:
     - *prepare_debian
     - pytest -v -l
+test-opensuse:
+  stage: test
+  image: opensuse/leap:15.4
+  before_script:
+    *prepare_opensuse
+  script:
+    - pytest -v -l
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..e90a857
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,37 @@
+# This file is only needed for setuptools<61.0.0 (Python 3.6) support
+# It duplicates the information present in pyproject.toml
+# With setuptools>=61.0.0 this file is ignored
+# https://gitlab.gwdg.de/mpsd-cs/mpsd-software-manager/-/merge_requests/132
+
+[metadata]
+name = mpsd_software_manager
+version = 2023.12.18
+author = SSU-Computational Science (Fangohr et al)
+author_email = ssu-cs@mpsd.mpg.de
+long_description = file: README.rst
+license = MIT
+classifiers =
+    License :: OSI Approved :: MIT License
+
+[options]
+package_dir=
+    =src
+packages=find:
+install_requires =
+    archspec
+    importlib-metadata
+    rich
+
+[options.packages.find]
+where=src
+
+[options.entry_points]
+console_script =
+    mpsd-software = mpsd_software_manager.mpsd_software:main
+
+[options.extras_require]
+dev =
+    pre-commit
+    pytest
+    pytest-mock
+    pytest-cov
-- 
GitLab