Skip to content

Commit

Permalink
BLD: fix potential issue with escape sequences in __config__.py
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
charris committed Jan 23, 2024
1 parent 1d50085 commit cb3171c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions numpy/__config__.py.in
Expand Up @@ -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": {
Expand All @@ -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": {
Expand All @@ -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@",
},
},
Expand Down

0 comments on commit cb3171c

Please sign in to comment.