From cb3171c087b522c4e55657824a9e2c2698b11949 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Tue, 23 Jan 2024 08:56:48 -0700 Subject: [PATCH] BLD: fix potential issue with escape sequences in ``__config__.py`` Backport of #25669. The current code isn't robust to backslashes (from path segments on Windows) in linker flags. No bug report for NumPy, but the same problem did show up in SciPy already. Fix is the same as scipy/scipy#19945. This actually pulls in all of `__config__.py` from main because there have been a number of other changes. [skip cirrus] [skip circle] --- numpy/__config__.py.in | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/numpy/__config__.py.in b/numpy/__config__.py.in index 6c6c21cb85d4..f3b32c28c100 100644 --- a/numpy/__config__.py.in +++ b/numpy/__config__.py.in @@ -32,21 +32,27 @@ CONFIG = _cleanup( "Compilers": { "c": { "name": "@C_COMP@", - "linker": "@C_COMP_LINKER_ID@", + "linker": r"@C_COMP_LINKER_ID@", "version": "@C_COMP_VERSION@", - "commands": "@C_COMP_CMD_ARRAY@", + "commands": r"@C_COMP_CMD_ARRAY@", + "args": r"@C_COMP_ARGS@", + "linker args": r"@C_COMP_LINK_ARGS@", }, "cython": { "name": "@CYTHON_COMP@", - "linker": "@CYTHON_COMP_LINKER_ID@", + "linker": r"@CYTHON_COMP_LINKER_ID@", "version": "@CYTHON_COMP_VERSION@", - "commands": "@CYTHON_COMP_CMD_ARRAY@", + "commands": r"@CYTHON_COMP_CMD_ARRAY@", + "args": r"@CYTHON_COMP_ARGS@", + "linker args": r"@CYTHON_COMP_LINK_ARGS@", }, "c++": { "name": "@CPP_COMP@", - "linker": "@CPP_COMP_LINKER_ID@", + "linker": r"@CPP_COMP_LINKER_ID@", "version": "@CPP_COMP_VERSION@", - "commands": "@CPP_COMP_CMD_ARRAY@", + "commands": r"@CPP_COMP_CMD_ARRAY@", + "args": r"@CPP_COMP_ARGS@", + "linker args": r"@CPP_COMP_LINK_ARGS@", }, }, "Machine Information": { @@ -72,7 +78,7 @@ CONFIG = _cleanup( "detection method": "@BLAS_TYPE_NAME@", "include directory": r"@BLAS_INCLUDEDIR@", "lib directory": r"@BLAS_LIBDIR@", - "openblas configuration": "@BLAS_OPENBLAS_CONFIG@", + "openblas configuration": r"@BLAS_OPENBLAS_CONFIG@", "pc file directory": r"@BLAS_PCFILEDIR@", }, "lapack": { @@ -82,7 +88,7 @@ CONFIG = _cleanup( "detection method": "@LAPACK_TYPE_NAME@", "include directory": r"@LAPACK_INCLUDEDIR@", "lib directory": r"@LAPACK_LIBDIR@", - "openblas configuration": "@LAPACK_OPENBLAS_CONFIG@", + "openblas configuration": r"@LAPACK_OPENBLAS_CONFIG@", "pc file directory": r"@LAPACK_PCFILEDIR@", }, },