summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Thies <16190001+jthies@users.noreply.github.com>2023-09-21 20:21:35 +0200
committerGitHub <noreply@github.com>2023-09-21 20:21:35 +0200
commit56df8b61a228b82e42de7554b1838979210be23c (patch)
tree8422589a7602fe327e154aa8aa1cebf24d85c5cb
parent170867e38a8b4bbc30af7bf12ad023d51e52b921 (diff)
downloadspack-56df8b61a228b82e42de7554b1838979210be23c.tar.gz
spack-56df8b61a228b82e42de7554b1838979210be23c.tar.bz2
spack-56df8b61a228b82e42de7554b1838979210be23c.tar.xz
spack-56df8b61a228b82e42de7554b1838979210be23c.zip
phist: fix compatibility with python@3.11: (#40082)
-rw-r--r--var/spack/repos/builtin/packages/phist/package.py2
-rw-r--r--var/spack/repos/builtin/packages/phist/remove_rU_mode_in_python_script.patch28
2 files changed, 30 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/phist/package.py b/var/spack/repos/builtin/packages/phist/package.py
index ea0ee682d7..6d7d61c0e5 100644
--- a/var/spack/repos/builtin/packages/phist/package.py
+++ b/var/spack/repos/builtin/packages/phist/package.py
@@ -153,6 +153,8 @@ class Phist(CMakePackage):
# ###################### Patches ##########################
+ # remove 'rU' file mode in a python script
+ patch("remove_rU_mode_in_python_script.patch", when="@:1.12.0 +fortran ^python@3.11:")
# Avoid trying to compile some SSE code if SSE is not available
# This patch will be part of phist 1.11.3 and greater and only affects
# the 'builtin' kernel_lib.
diff --git a/var/spack/repos/builtin/packages/phist/remove_rU_mode_in_python_script.patch b/var/spack/repos/builtin/packages/phist/remove_rU_mode_in_python_script.patch
new file mode 100644
index 0000000000..8076fd8189
--- /dev/null
+++ b/var/spack/repos/builtin/packages/phist/remove_rU_mode_in_python_script.patch
@@ -0,0 +1,28 @@
+commit abef54185d43c0900bcde289a4436fea0790b9a7
+Author: Jonas Thies <16190001+jthies@users.noreply.github.com>
+Date: Tue Sep 19 17:42:57 2023 +0200
+
+ cfwrapper script: do not use 'rU' mode when opening a file (fixes #246)
+
+diff --git a/fortran_bindings/cfwrapper.py.in b/fortran_bindings/cfwrapper.py.in
+index 9a2539d3..60808a5d 100755
+--- a/fortran_bindings/cfwrapper.py.in
++++ b/fortran_bindings/cfwrapper.py.in
+@@ -264,7 +264,7 @@ for library_path in PATH_DICT:
+ for c_file_name in directory[2]:
+ if (c_file_name.find(".CFWRAPPER_SKIP.") != -1):
+ continue
+- whole_file = open(directory[0] + "/" + c_file_name, 'rU',
++ whole_file = open(directory[0] + "/" + c_file_name, 'r',
+ errors='replace').read()
+ enum_types = re.findall("(?ms)^typedef enum.*?}\s?(\w+);", whole_file)
+ phist_enums += enum_types
+@@ -338,7 +338,7 @@ for library_path in PATH_DICT:
+ if c_file_name in ["gstdio.h", "giochannel.h"]:
+ continue # Go to next file
+
+- whole_file_original = open(directory[0] + "/" + c_file_name, 'rU',
++ whole_file_original = open(directory[0] + "/" + c_file_name, 'r',
+ errors='replace').read()
+ whole_file = whole_file_original
+ nb_files += 1