Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Lib/test/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,16 @@ def test_underpth_nosite_file(self):
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__))
Expand Down
15 changes: 15 additions & 0 deletions PCbuild/python.props
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down