summaryrefslogtreecommitdiffstats
path: root/Lib/sysconfig.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2020-09-04 23:45:54 (GMT)
committerGitHub <noreply@github.com>2020-09-04 23:45:54 (GMT)
commitdd18001c308fb3bb65006c91d95f6639583a3420 (patch)
treeb956b93a0bd9324e864a551956829c42d3629bd7 /Lib/sysconfig.py
parent51b84f8e96a441c498210f827c1297ee4973525f (diff)
downloadcpython-dd18001c308fb3bb65006c91d95f6639583a3420.zip
cpython-dd18001c308fb3bb65006c91d95f6639583a3420.tar.gz
cpython-dd18001c308fb3bb65006c91d95f6639583a3420.tar.bz2
bpo-41627: Distinguish 32 and 64-bit user site packages on Windows (GH-22098)
Also fixes the error message returned when sysconfig fails to interpolate a variable correctly.
Diffstat (limited to 'Lib/sysconfig.py')
-rw-r--r--Lib/sysconfig.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index bf04ac5..6c87b06 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -53,12 +53,12 @@ _INSTALL_SCHEMES = {
},
# 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}/Python{py_version_nodot_plat}',
+ 'platstdlib': '{userbase}/Python{py_version_nodot_plat}',
+ 'purelib': '{userbase}/Python{py_version_nodot_plat}/site-packages',
+ 'platlib': '{userbase}/Python{py_version_nodot_plat}/site-packages',
+ 'include': '{userbase}/Python{py_version_nodot_plat}/Include',
+ 'scripts': '{userbase}/Python{py_version_nodot_plat}/Scripts',
'data': '{userbase}',
},
'posix_user': {
@@ -149,10 +149,10 @@ if _PYTHON_BUILD:
def _subst_vars(s, local_vars):
try:
return s.format(**local_vars)
- except KeyError:
+ except KeyError as var:
try:
return s.format(**os.environ)
- except KeyError as var:
+ except KeyError:
raise AttributeError('{%s}' % var) from None
def _extend_dict(target_dict, other_dict):
@@ -431,6 +431,7 @@ def _init_non_posix(vars):
vars['EXE'] = '.exe'
vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
+ vars['TZPATH'] = ''
#
# public APIs
@@ -543,10 +544,13 @@ def get_config_vars(*args):
except AttributeError:
# sys.abiflags may not be defined on all platforms.
_CONFIG_VARS['abiflags'] = ''
+ try:
+ _CONFIG_VARS['py_version_nodot_plat'] = sys.winver.replace('.', '')
+ except AttributeError:
+ _CONFIG_VARS['py_version_nodot_plat'] = ''
if os.name == 'nt':
_init_non_posix(_CONFIG_VARS)
- _CONFIG_VARS['TZPATH'] = ''
if os.name == 'posix':
_init_posix(_CONFIG_VARS)
# For backward compatibility, see issue19555