From 893ba3a5e55dc3e07bac6407075e3461a24f979f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
 <alexey.pawlow@gmail.com>
Date: Thu, 17 Jun 2021 18:51:50 +0530
Subject: [PATCH 043/N] mingw sysconfig like posix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Алексей <alexey.pawlow@gmail.com>
---
 Lib/distutils/command/build_ext.py |  3 ++-
 Lib/sysconfig.py                   | 28 ++++++++++++++--------------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index 1c9d471..1dbdfe0 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -221,9 +221,10 @@ class build_ext(Command):
         if sys.platform[:6] == 'cygwin':
             if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
                 # building third party extensions
+                config_dir_name = os.path.basename(sysconfig.get_config_var('LIBPL'))
                 self.library_dirs.append(os.path.join(sys.prefix, "lib",
                                                       "python" + get_python_version(),
-                                                      "config"))
+                                                      config_dir_name))
             else:
                 # building python standard extensions
                 self.library_dirs.append('.')
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 5d336d8..c0695e2 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -48,23 +48,23 @@ _INSTALL_SCHEMES = {
         'data': '{base}',
         },
     'nt': {
-        'stdlib': '{installed_base}/Lib',
-        'platstdlib': '{base}/Lib',
-        'purelib': '{base}/Lib/site-packages',
-        'platlib': '{base}/Lib/site-packages',
-        'include': '{installed_base}/Include',
-        'platinclude': '{installed_base}/Include',
-        'scripts': '{base}/Scripts',
+        'stdlib': '{installed_base}/lib/python{py_version_short}',
+        'platstdlib': '{base}/lib/python{py_version_short}',
+        'purelib': '{base}/lib/python{py_version_short}',
+        'platlib': '{base}/lib/python{py_version_short}',
+        'include': '{installed_base}/include/python{py_version_short}',
+        'platinclude': '{installed_base}/include/python{py_version_short}',
+        'scripts': '{base}/bin',
         'data': '{base}',
         },
     # NOTE: When modifying "purelib" scheme, update site._get_path() too.
     'nt_user': {
-        'stdlib': '{userbase}/Python{py_version_nodot}',
-        'platstdlib': '{userbase}/Python{py_version_nodot}',
-        'purelib': '{userbase}/Python{py_version_nodot}/site-packages',
-        'platlib': '{userbase}/Python{py_version_nodot}/site-packages',
-        'include': '{userbase}/Python{py_version_nodot}/Include',
-        'scripts': '{userbase}/Python{py_version_nodot}/Scripts',
+        'stdlib': '{userbase}/lib/python{py_version_short}',
+        'platstdlib': '{userbase}/lib/python{py_version_short}',
+        'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
+        'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
+        'include': '{userbase}/include/python{py_version_short}',
+        'scripts': '{userbase}/bin',
         'data': '{userbase}',
         },
     'posix_user': {
@@ -470,7 +470,7 @@ def _init_non_posix(vars):
     vars['INCLUDEPY'] = get_path('include')
     vars['EXT_SUFFIX'] = _imp.extension_suffixes()[0]
     vars['EXE'] = '.exe'
-    vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
+    vars['VERSION'] = _PY_VERSION_SHORT
     vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
 
 #
-- 
2.32.0

