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 273edc7
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions numpy/__config__.py.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is generated by numpy's build process
# It contains system_info results at the time of building this package.
from enum import Enum
from numpy.core._multiarray_umath import (
from numpy._core._multiarray_umath import (
__cpu_features__,
__cpu_baseline__,
__cpu_dispatch__,
Expand Down 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 273edc7

Please sign in to comment.