From 341de59fde59189a9fe16bcfb39647d16395652a Mon Sep 17 00:00:00 2001
From: Ricard <ricard.zarco@bsc.es>
Date: Tue, 18 Jul 2023 11:46:52 +0200
Subject: [PATCH] Added unofficial support for python < 3.11 to biobb packages.
 Stability not tested, but enables installation using python 3.10.8.

---
 packages/biobb-analysis/package.py        | 10 ++++++++++
 packages/biobb-chemistry/package.py       | 10 ++++++++++
 packages/biobb-common/package.py          |  4 ++++
 packages/biobb-gromacs/package.py         |  4 ++++
 packages/biobb-io/package.py              | 10 ++++++++++
 packages/biobb-model/package.py           | 10 ++++++++++
 packages/biobb-structure-utils/package.py | 10 ++++++++++
 7 files changed, 58 insertions(+)

diff --git a/packages/biobb-analysis/package.py b/packages/biobb-analysis/package.py
index a392c635..bc47a809 100644
--- a/packages/biobb-analysis/package.py
+++ b/packages/biobb-analysis/package.py
@@ -20,6 +20,16 @@ class BiobbAnalysis(PythonPackage):
     depends_on('gromacs')
     depends_on('ambertools')
 
+    # Patching to enable python 3.10 (not official, might not be stable)
+    def patch(self):
+        filter_file("    python_requires='>=3.7,<3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
+        filter_file(
+            "'Programming Language :: Python :: 3.9'",
+            "'Programming Language :: Python :: 3.9',\r\n        "
+            "'Programming Language :: Python :: 3.10'",
+            "setup.py",
+        )
+
     # Test
     @run_after('install')
     @on_package_attributes(run_tests=True)
diff --git a/packages/biobb-chemistry/package.py b/packages/biobb-chemistry/package.py
index 6b5f23e9..47286633 100644
--- a/packages/biobb-chemistry/package.py
+++ b/packages/biobb-chemistry/package.py
@@ -21,6 +21,16 @@ class BiobbChemistry(PythonPackage):
     depends_on('ambertools')
     depends_on('acpype')
 
+    # Patching to enable python 3.10 (not official, might not be stable)
+    def patch(self):
+        filter_file("    python_requires='>=3.7,<3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
+        filter_file(
+            "'Programming Language :: Python :: 3.9'",
+            "'Programming Language :: Python :: 3.9',\r\n        "
+            "'Programming Language :: Python :: 3.10'",
+            "setup.py",
+        )
+
     # Test
     @run_after('install')
     @on_package_attributes(run_tests=True)
diff --git a/packages/biobb-common/package.py b/packages/biobb-common/package.py
index e093b9db..10e8cc19 100644
--- a/packages/biobb-common/package.py
+++ b/packages/biobb-common/package.py
@@ -20,6 +20,10 @@ class BiobbCommon(PythonPackage):
     depends_on('py-requests', type=('build', 'run'))
     depends_on('py-biopython@1.78:1.80', type=('build', 'run'))
 
+    # Custom patch to enable python 3.10.8 for this package
+    def patch(self):
+        filter_file("    python_requires='>=3.7,<=3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
+
     # Test
     @run_after('install')
     @on_package_attributes(run_tests=True)
diff --git a/packages/biobb-gromacs/package.py b/packages/biobb-gromacs/package.py
index a9eb6c8e..a6822544 100644
--- a/packages/biobb-gromacs/package.py
+++ b/packages/biobb-gromacs/package.py
@@ -16,6 +16,10 @@ class BiobbGromacs(PythonPackage):
     depends_on('biobb-common')
     depends_on('gromacs')
 
+    # Patching to enable python 3.10 (not official, might not be stable)
+    def patch(self):
+        filter_file("    python_requires='>=3.7,<3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
+
     # Test
     @run_after('install')
     @on_package_attributes(run_tests=True)
diff --git a/packages/biobb-io/package.py b/packages/biobb-io/package.py
index 698f2544..6d8e4b07 100644
--- a/packages/biobb-io/package.py
+++ b/packages/biobb-io/package.py
@@ -15,6 +15,16 @@ class BiobbIo(PythonPackage):
     depends_on('biobb-common')
     depends_on('python@3.8:', type=('build', 'run'))
 
+    # Patching to enable python 3.10 (not official, might not be stable)
+    def patch(self):
+        filter_file("    python_requires='>=3.7,<3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
+        filter_file(
+            "'Programming Language :: Python :: 3.9'",
+            "'Programming Language :: Python :: 3.9',\r\n        "
+            "'Programming Language :: Python :: 3.10'",
+            "setup.py",
+        )
+
     # Test
     @run_after('install')
     @on_package_attributes(run_tests=True)
diff --git a/packages/biobb-model/package.py b/packages/biobb-model/package.py
index 0dcf14b1..012732d6 100644
--- a/packages/biobb-model/package.py
+++ b/packages/biobb-model/package.py
@@ -16,6 +16,16 @@ class BiobbModel(PythonPackage):
     depends_on('biobb-common')
     depends_on('biobb-structure-checking')
 
+    # Patching to enable python 3.10 (not official, might not be stable)
+    def patch(self):
+        filter_file("    python_requires='>=3.7,<3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
+        filter_file(
+            "'Programming Language :: Python :: 3.9'",
+            "'Programming Language :: Python :: 3.9',\r\n        "
+            "'Programming Language :: Python :: 3.10'",
+            "setup.py",
+        )
+
     # Test
     @run_after('install')
     @on_package_attributes(run_tests=True)
diff --git a/packages/biobb-structure-utils/package.py b/packages/biobb-structure-utils/package.py
index 1d150a35..9987467d 100644
--- a/packages/biobb-structure-utils/package.py
+++ b/packages/biobb-structure-utils/package.py
@@ -16,6 +16,16 @@ class BiobbStructureUtils(PythonPackage):
     depends_on('biobb-common')
     depends_on('biobb-structure-checking')
 
+    # Patching to enable python 3.10 (not official, might not be stable)
+    def patch(self):
+        filter_file("    python_requires='>=3.7,<3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
+        filter_file(
+            "'Programming Language :: Python :: 3.9'",
+            "'Programming Language :: Python :: 3.9',\r\n        "
+            "'Programming Language :: Python :: 3.10'",
+            "setup.py",
+        )
+
     # Test
     @run_after('install')
     @on_package_attributes(run_tests=True)
-- 
GitLab