bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605) (GH-20725)
(cherry picked from commit 8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae)
Co-authored-by: Sandro Mani <manisandro@gmail.com>
diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst
index abf8b3d..b7298ba 100644
--- a/Doc/c-api/init_config.rst
+++ b/Doc/c-api/init_config.rst
@@ -437,6 +437,14 @@
:data:`sys.base_prefix`.
+ .. c:member:: wchar_t* platlibdir
+
+ :data:`sys.platlibdir`: platform library directory name, set at configure time
+ by ``--with-platlibdir``, overrideable by the ``PYTHONPLATLIBDIR``
+ environment variable.
+
+ .. versionadded:: 3.9
+
.. c:member:: int buffered_stdio
If equals to 0, enable unbuffered mode, making the stdout and stderr
@@ -885,6 +893,7 @@
* Path configuration inputs:
* :c:member:`PyConfig.home`
+ * :c:member:`PyConfig.platlibdir`
* :c:member:`PyConfig.pathconfig_warnings`
* :c:member:`PyConfig.program_name`
* :c:member:`PyConfig.pythonpath_env`
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index b091195..f91ab02 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -538,6 +538,14 @@
within a Python program as the variable :data:`sys.path`.
+.. envvar:: PYTHONPLATLIBDIR
+
+ If this is set to a non-empty string, it overrides the :data:`sys.platlibdir`
+ value.
+
+ .. versionadded:: 3.9
+
+
.. envvar:: PYTHONSTARTUP
If this is the name of a readable file, the Python commands in that file are