Maybe this is a typical "you're doing it wrong" situation - in this case please let me know.
Currently I'm re-using a pre-built Python among different installations located in different directories, and to make this work I need to modify the generated _sysconfigdata.py
to contain a certain installation path, which is also available as an environment variable (here SOME_ENV
).
This can be done by search/replace a __PLACEHOLDER__
(configured with --prefix
) inside _sysconfigdata.py
, like this:
'INCLUDEPY': '__PLACEHOLDER__/include/python3.10',
.. with something dynamic like this:
'INCLUDEPY': f"{os.environ['SOME_ENV']}/include/python3.10",
Direct references of environment variables like
'INCLUDEPY': "${SOME_ENV}/include/python3.10",
seem to not work.
This of course feels like an ugly workaround for the built-in way to say "please take this pre-built Python and re-configure the prefix
I've provided with configure
.
Is there a way to "reconfigure" a readily built Python to be located in a different path?
(Background: I need those values in order to be able to build Python packages from source inside a delivered Python installation)