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['PYTHONPATH'] = 'from-env'
|
||||
env['PATH'] = '{};{}'.format(exe_prefix, os.getenv('PATH'))
|
||||
rc = subprocess.call([exe_file, '-c',
|
||||
'import sys; sys.exit(sys.flags.no_site and '
|
||||
'len(sys.path) > 200 and '
|
||||
'sys.path == %r)' % sys_path,
|
||||
], env=env)
|
||||
self.assertTrue(rc, "sys.path is incorrect")
|
||||
output = subprocess.check_output([exe_file, '-c',
|
||||
'import sys; print("\\n".join(sys.path) if sys.flags.no_site else "")'
|
||||
], env=env, encoding='ansi')
|
||||
actual_sys_path = output.rstrip().split('\n')
|
||||
self.assert_(actual_sys_path, "sys.flags.no_site was False")
|
||||
self.assertEqual(
|
||||
actual_sys_path,
|
||||
sys_path,
|
||||
"sys.path is incorrect"
|
||||
)
|
||||
|
||||
def test_underpth_file(self):
|
||||
libpath = os.path.dirname(os.path.dirname(encodings.__file__))
|
||||
|
|
|
@ -63,6 +63,21 @@
|
|||
<PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)python$(PyDebugExt).exe</PythonExe>
|
||||
</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)' == ''">
|
||||
<!--
|
||||
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)
|
||||
Py_FatalError("Py_Initialize: can't initialize sys dict");
|
||||
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)
|
||||
Py_FatalError("Py_Initialize: can't initialize sys");
|
||||
_PyImport_FixupBuiltin(sysmod, "sys");
|
||||
PySys_SetPath(Py_GetPath());
|
||||
PyDict_SetItemString(interp->sysdict, "modules",
|
||||
interp->modules);
|
||||
|
||||
|
|
Loading…
Reference in New Issue