mirror of https://github.com/python/cpython
Improves test_underpth_nosite_file to reveal why it fails. (#1763)
* Improves test_underpth_nosite_file to reveal why it fails. * Enable building with Windows 10 SDK. * Fix WinSDK detection * Fix initialization on Windows when a ._pth file exists. * Fix tabs * Adds comment about Py_GetPath call.
This commit is contained in:
parent
66dc33b682
commit
9b33bf50da
|
@ -547,12 +547,16 @@ class _pthFileTests(unittest.TestCase):
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['PYTHONPATH'] = 'from-env'
|
env['PYTHONPATH'] = 'from-env'
|
||||||
env['PATH'] = '{};{}'.format(exe_prefix, os.getenv('PATH'))
|
env['PATH'] = '{};{}'.format(exe_prefix, os.getenv('PATH'))
|
||||||
rc = subprocess.call([exe_file, '-c',
|
output = subprocess.check_output([exe_file, '-c',
|
||||||
'import sys; sys.exit(sys.flags.no_site and '
|
'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")'
|
||||||
'len(sys.path) > 200 and '
|
], env=env, encoding='ansi')
|
||||||
'sys.path == %r)' % sys_path,
|
actual_sys_path = output.rstrip().split('\n')
|
||||||
], env=env)
|
self.assert_(actual_sys_path, "sys.flags.no_site was False")
|
||||||
self.assertTrue(rc, "sys.path is incorrect")
|
self.assertEqual(
|
||||||
|
actual_sys_path,
|
||||||
|
sys_path,
|
||||||
|
"sys.path is incorrect"
|
||||||
|
)
|
||||||
|
|
||||||
def test_underpth_file(self):
|
def test_underpth_file(self):
|
||||||
libpath = os.path.dirname(os.path.dirname(encodings.__file__))
|
libpath = os.path.dirname(os.path.dirname(encodings.__file__))
|
||||||
|
|
|
@ -63,6 +63,21 @@
|
||||||
<PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
|
<PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="$(DefaultWindowsSDKVersion) == ''">
|
||||||
|
<!--
|
||||||
|
Attempt to select the latest installed WinSDK. If we don't find any, then we will
|
||||||
|
let the MSBuild targets determine which one it wants to use (typically the earliest
|
||||||
|
possible version). Since we limit WINVER to Windows 7 anyway, it doesn't really
|
||||||
|
matter which WinSDK version we use.
|
||||||
|
-->
|
||||||
|
<DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.15063'">10.0.15063.0</DefaultWindowsSDKVersion>
|
||||||
|
<DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.15063'">10.0.15063.0</DefaultWindowsSDKVersion>
|
||||||
|
<DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10586'">10.0.10586.0</DefaultWindowsSDKVersion>
|
||||||
|
<DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10586'">10.0.10586.0</DefaultWindowsSDKVersion>
|
||||||
|
<DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10240'">10.0.10240.0</DefaultWindowsSDKVersion>
|
||||||
|
<DefaultWindowsSDKVersion Condition="$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0@ProductVersion) == '10.0.10240'">10.0.10240.0</DefaultWindowsSDKVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(OverrideVersion)' == ''">
|
<PropertyGroup Condition="'$(OverrideVersion)' == ''">
|
||||||
<!--
|
<!--
|
||||||
Read version information from Include\patchlevel.h. The following properties are set:
|
Read version information from Include\patchlevel.h. The following properties are set:
|
||||||
|
|
|
@ -412,10 +412,15 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib)
|
||||||
if (interp->sysdict == NULL)
|
if (interp->sysdict == NULL)
|
||||||
Py_FatalError("Py_Initialize: can't initialize sys dict");
|
Py_FatalError("Py_Initialize: can't initialize sys dict");
|
||||||
Py_INCREF(interp->sysdict);
|
Py_INCREF(interp->sysdict);
|
||||||
|
|
||||||
|
/* GetPath may initialize state that _PySys_EndInit locks
|
||||||
|
in, and so has to be called first.
|
||||||
|
|
||||||
|
Hopefully one day Eric Snow will fix this. */
|
||||||
|
PySys_SetPath(Py_GetPath());
|
||||||
if (_PySys_EndInit(interp->sysdict) < 0)
|
if (_PySys_EndInit(interp->sysdict) < 0)
|
||||||
Py_FatalError("Py_Initialize: can't initialize sys");
|
Py_FatalError("Py_Initialize: can't initialize sys");
|
||||||
_PyImport_FixupBuiltin(sysmod, "sys");
|
_PyImport_FixupBuiltin(sysmod, "sys");
|
||||||
PySys_SetPath(Py_GetPath());
|
|
||||||
PyDict_SetItemString(interp->sysdict, "modules",
|
PyDict_SetItemString(interp->sysdict, "modules",
|
||||||
interp->modules);
|
interp->modules);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue