From 223e5b8ca21b98f87444ae3f708963617b9ce4a8 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Sat, 18 Nov 2023 14:43:35 +0100 Subject: Fix invalid escape sequences (#41130) Using Python 3.12 in a freshly cloned Spack repository results in warnings such as this: ``` ==> Warning: invalid escape sequence '\$' ==> Warning: invalid escape sequence '\(' ==> Warning: invalid escape sequence '\.' ==> Warning: invalid escape sequence '\.' ``` These will turn into errors in 3.13, so fix them. All of them actually do not need to be regexes, so convert them into normal strings. --- var/spack/repos/builtin/packages/ecmwf-atlas/package.py | 4 ++-- var/spack/repos/builtin/packages/ncview/package.py | 3 ++- var/spack/repos/builtin/packages/py-imagecodecs/package.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/ecmwf-atlas/package.py b/var/spack/repos/builtin/packages/ecmwf-atlas/package.py index 00fce1ec78..d764f8e1bd 100644 --- a/var/spack/repos/builtin/packages/ecmwf-atlas/package.py +++ b/var/spack/repos/builtin/packages/ecmwf-atlas/package.py @@ -76,8 +76,8 @@ class EcmwfAtlas(CMakePackage): @when("+fismahigh") def patch(self): - filter_file("http://www\.ecmwf\.int", "", "cmake/atlas-import.cmake.in") # noqa: W605 - filter_file("int\.ecmwf", "", "cmake/atlas-import.cmake.in") # noqa: W605 + filter_file("http://www.ecmwf.int", "", "cmake/atlas-import.cmake.in", string=True) + filter_file("int.ecmwf", "", "cmake/atlas-import.cmake.in", string=True) filter_file('http[^"]+', "", "cmake/atlas_export.cmake") patterns = [".travis.yml", "tools/install*.sh", "tools/github-sha.sh"] for pattern in patterns: diff --git a/var/spack/repos/builtin/packages/ncview/package.py b/var/spack/repos/builtin/packages/ncview/package.py index 8526b78070..c706245e94 100644 --- a/var/spack/repos/builtin/packages/ncview/package.py +++ b/var/spack/repos/builtin/packages/ncview/package.py @@ -26,9 +26,10 @@ class Ncview(AutotoolsPackage): patched_file = "configure" with keep_modification_time(patched_file): filter_file( - "if test x\$CC_TEST_SAME != x\$NETCDF_CC_TEST_SAME; then", # noqa: W605 + "if test x$CC_TEST_SAME != x$NETCDF_CC_TEST_SAME; then", "if false; then", patched_file, + string=True, ) def url_for_version(self, version): diff --git a/var/spack/repos/builtin/packages/py-imagecodecs/package.py b/var/spack/repos/builtin/packages/py-imagecodecs/package.py index 03195578b6..e156b28e77 100644 --- a/var/spack/repos/builtin/packages/py-imagecodecs/package.py +++ b/var/spack/repos/builtin/packages/py-imagecodecs/package.py @@ -66,11 +66,12 @@ class PyImagecodecs(PythonPackage): ) # 239 filter_file( - "append\('/usr/include/jxrlib'\)", # noqa: W605 + "append('/usr/include/jxrlib')", "extend(('{0}/libjxr/image', '{0}/libjxr/common', '{0}/libjxr/glue'))".format( # noqa: E501 spec["jxrlib-debian"].prefix.include ), "setup.py", + string=True, ) # 367 -- cgit v1.2.3-60-g2f50