Skip to content

Commit 65e4cb1

Browse files
committed
Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015), which will be used for the official 3.5 release.
1 parent 9271677 commit 65e4cb1

File tree

144 files changed

+2494
-26822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+2494
-26822
lines changed

.gitignore

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
.gdb_history
1111
Doc/build/
1212
Doc/venv/
13+
Lib/distutils/command/*.pdb
1314
Lib/lib2to3/*.pickle
1415
Lib/test/data/*
1516
Lib/_sysconfigdata.py
@@ -27,23 +28,26 @@ Programs/_freeze_importlib
2728
Programs/_testembed
2829
PC/python_nt*.h
2930
PC/pythonnt_rc*.h
30-
PCbuild/*.bsc
31-
PCbuild/*.dll
32-
PCbuild/*.exe
33-
PCbuild/*.exp
34-
PCbuild/*.lib
35-
PCbuild/*.ncb
36-
PCbuild/*.o
37-
PCbuild/*.pdb
31+
PC/*/*.exe
32+
PC/*/*.exp
33+
PC/*/*.lib
34+
PC/*/*.bsc
35+
PC/*/*.dll
36+
PC/*/*.pdb
37+
PC/*/*.user
38+
PC/*/*.ncb
39+
PC/*/*.suo
40+
PC/*/Win32-temp-*
41+
PC/*/x64-temp-*
42+
PC/*/amd64
3843
PCbuild/*.user
3944
PCbuild/*.suo
4045
PCbuild/*.*sdf
41-
PCbuild/Win32-temp-*
42-
PCbuild/x64-temp-*
4346
PCbuild/*-pgi
4447
PCbuild/*-pgo
4548
PCbuild/amd64/
46-
PCbuild/ipch
49+
PCbuild/obj
50+
PCBuild/win32
4751
.purify
4852
Parser/pgen
4953
__pycache__
@@ -78,3 +82,5 @@ TAGS
7882
coverage/
7983
externals/
8084
htmlcov/
85+
Tools/ssl/amd64
86+
Tools/ssl/win32

.hgignore

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,12 @@ libpython*.so*
5050
*.pyd
5151
*.cover
5252
*~
53+
Lib/distutils/command/*.pdb
5354
Lib/lib2to3/*.pickle
5455
Lib/test/data/*
5556
Misc/*.wpu
5657
PC/python_nt*.h
5758
PC/pythonnt_rc*.h
58-
PC/*.obj
59-
PC/*.exe
6059
PC/*/*.exe
6160
PC/*/*.exp
6261
PC/*/*.lib
@@ -69,23 +68,14 @@ PC/*/*.suo
6968
PC/*/Win32-temp-*
7069
PC/*/x64-temp-*
7170
PC/*/amd64
72-
PCbuild/*.exe
73-
PCbuild/*.dll
74-
PCbuild/*.pdb
75-
PCbuild/*.lib
76-
PCbuild/*.exp
77-
PCbuild/*.o
78-
PCbuild/*.ncb
79-
PCbuild/*.bsc
8071
PCbuild/*.user
8172
PCbuild/*.suo
8273
PCbuild/*.*sdf
83-
PCbuild/Win32-temp-*
84-
PCbuild/x64-temp-*
8574
PCbuild/*-pgi
8675
PCbuild/*-pgo
8776
PCbuild/amd64
88-
PCbuild/ipch
77+
PCbuild/obj
78+
PCbuild/win32
8979
Tools/unicode/build/
9080
Tools/unicode/MAPPINGS/
9181
BuildLog.htm
@@ -100,3 +90,5 @@ htmlcov/
10090
*.gcno
10191
*.gcov
10292
coverage.info
93+
Tools/ssl/amd64
94+
Tools/ssl/win32

Lib/ctypes/util.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def _get_build_version():
1919
i = i + len(prefix)
2020
s, rest = sys.version[i:].split(" ", 1)
2121
majorVersion = int(s[:-2]) - 6
22+
if majorVersion >= 13:
23+
majorVersion += 1
2224
minorVersion = int(s[2:3]) / 10.0
2325
# I don't think paths are affected by minor version in version 6
2426
if majorVersion == 6:
@@ -36,8 +38,10 @@ def find_msvcrt():
3638
return None
3739
if version <= 6:
3840
clibname = 'msvcrt'
39-
else:
41+
elif version <= 13:
4042
clibname = 'msvcr%d' % (version * 10)
43+
else:
44+
clibname = 'appcrt%d' % (version * 10)
4145

4246
# If python was built with in debug mode
4347
import importlib.machinery

Lib/distutils/command/build_ext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def finalize_options(self):
209209
if MSVC_VERSION >= 9:
210210
# Use the .lib files for the correct architecture
211211
if self.plat_name == 'win32':
212-
suffix = ''
212+
suffix = 'win32'
213213
else:
214214
# win-amd64 or win-ia64
215215
suffix = self.plat_name[4:]
82.5 KB
Binary file not shown.
73.5 KB
Binary file not shown.

Lib/distutils/msvc9compiler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ def get_build_version():
179179
i = i + len(prefix)
180180
s, rest = sys.version[i:].split(" ", 1)
181181
majorVersion = int(s[:-2]) - 6
182+
if majorVersion >= 13:
183+
# v13 was skipped and should be v14
184+
majorVersion += 1
182185
minorVersion = int(s[2:3]) / 10.0
183186
# I don't think paths are affected by minor version in version 6
184187
if majorVersion == 6:

Lib/distutils/msvccompiler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ def get_build_version():
157157
i = i + len(prefix)
158158
s, rest = sys.version[i:].split(" ", 1)
159159
majorVersion = int(s[:-2]) - 6
160+
if majorVersion >= 13:
161+
# v13 was skipped and should be v14
162+
majorVersion += 1
160163
minorVersion = int(s[2:3]) / 10.0
161164
# I don't think paths are affected by minor version in version 6
162165
if majorVersion == 6:

Lib/distutils/sysconfig.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Email: <fdrake@acm.org>
1010
"""
1111

12+
import _imp
1213
import os
1314
import re
1415
import sys
@@ -22,23 +23,15 @@
2223
BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
2324

2425
# Path to the base directory of the project. On Windows the binary may
25-
# live in project/PCBuild9. If we're dealing with an x64 Windows build,
26-
# it'll live in project/PCbuild/amd64.
26+
# live in project/PCBuild/win32 or project/PCBuild/amd64.
2727
# set for cross builds
2828
if "_PYTHON_PROJECT_BASE" in os.environ:
2929
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
3030
else:
3131
project_base = os.path.dirname(os.path.abspath(sys.executable))
32-
if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
33-
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
34-
# PC/VS7.1
35-
if os.name == "nt" and "\\pc\\v" in project_base[-10:].lower():
36-
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
37-
os.path.pardir))
38-
# PC/AMD64
39-
if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower():
40-
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
41-
os.path.pardir))
32+
if (os.name == 'nt' and
33+
project_base.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))):
34+
project_base = os.path.dirname(os.path.dirname(project_base))
4235

4336
# python_build: (Boolean) if true, we're either building Python or
4437
# building an extension with an un-installed Python, so we use
@@ -51,11 +44,9 @@ def _is_python_source_dir(d):
5144
return True
5245
return False
5346
_sys_home = getattr(sys, '_home', None)
54-
if _sys_home and os.name == 'nt' and \
55-
_sys_home.lower().endswith(('pcbuild', 'pcbuild\\amd64')):
56-
_sys_home = os.path.dirname(_sys_home)
57-
if _sys_home.endswith('pcbuild'): # must be amd64
58-
_sys_home = os.path.dirname(_sys_home)
47+
if (_sys_home and os.name == 'nt' and
48+
_sys_home.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))):
49+
_sys_home = os.path.dirname(os.path.dirname(_sys_home))
5950
def _python_build():
6051
if _sys_home:
6152
return _is_python_source_dir(_sys_home)
@@ -468,7 +459,7 @@ def _init_nt():
468459
# XXX hmmm.. a normal install puts include files here
469460
g['INCLUDEPY'] = get_python_inc(plat_specific=0)
470461

471-
g['EXT_SUFFIX'] = '.pyd'
462+
g['EXT_SUFFIX'] = _imp.extension_suffixes()[0]
472463
g['EXE'] = ".exe"
473464
g['VERSION'] = get_python_version().replace(".", "")
474465
g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))

Lib/sysconfig.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,8 @@ def _safe_realpath(path):
109109
# unable to retrieve the real program name
110110
_PROJECT_BASE = _safe_realpath(os.getcwd())
111111

112-
if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower():
113-
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir))
114-
# PC/VS7.1
115-
if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():
116-
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
117-
# PC/AMD64
118-
if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():
112+
if (os.name == 'nt' and
113+
_PROJECT_BASE.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))):
119114
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
120115

121116
# set for cross builds
@@ -129,11 +124,9 @@ def _is_python_source_dir(d):
129124
return False
130125

131126
_sys_home = getattr(sys, '_home', None)
132-
if _sys_home and os.name == 'nt' and \
133-
_sys_home.lower().endswith(('pcbuild', 'pcbuild\\amd64')):
134-
_sys_home = os.path.dirname(_sys_home)
135-
if _sys_home.endswith('pcbuild'): # must be amd64
136-
_sys_home = os.path.dirname(_sys_home)
127+
if (_sys_home and os.name == 'nt' and
128+
_sys_home.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))):
129+
_sys_home = os.path.dirname(os.path.dirname(_sys_home))
137130
def is_python_build(check_home=False):
138131
if check_home and _sys_home:
139132
return _is_python_source_dir(_sys_home)

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,11 @@ Build
13621362

13631363
- Issue #17219: Add library build dir for Python extension cross-builds.
13641364

1365+
- Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015),
1366+
which will be used for the official release.
1367+
1368+
- Issue #21236: Build _msi.pyd with cabinet.lib instead of fci.lib
1369+
13651370
C API
13661371
-----
13671372

Modules/posixmodule.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,15 +1046,33 @@ PyLong_FromPy_off_t(Py_off_t offset)
10461046
/* The actual size of the structure is determined at runtime.
10471047
* Only the first items must be present.
10481048
*/
1049+
1050+
#if _MSC_VER >= 1900
1051+
1052+
typedef struct {
1053+
CRITICAL_SECTION lock;
1054+
intptr_t osfhnd;
1055+
__int64 startpos;
1056+
char osfile;
1057+
} my_ioinfo;
1058+
1059+
#define IOINFO_L2E 6
1060+
#define IOINFO_ARRAYS 128
1061+
1062+
#else
1063+
10491064
typedef struct {
10501065
intptr_t osfhnd;
10511066
char osfile;
10521067
} my_ioinfo;
10531068

1054-
extern __declspec(dllimport) char * __pioinfo[];
10551069
#define IOINFO_L2E 5
1056-
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
10571070
#define IOINFO_ARRAYS 64
1071+
1072+
#endif
1073+
1074+
extern __declspec(dllimport) char * __pioinfo[];
1075+
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
10581076
#define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS)
10591077
#define FOPEN 0x01
10601078
#define _NO_CONSOLE_FILENO (intptr_t)-2

Modules/socketmodule.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ if_indextoname(index) -- return the corresponding interface name\n\
284284
# include <fcntl.h>
285285
# endif
286286

287+
#if defined(_MSC_VER) && _MSC_VER >= 1800
288+
/* Provides the IsWindows7SP1OrGreater() function */
289+
#include <VersionHelpers.h>
290+
#endif
291+
287292
#endif
288293

289294
#include <stddef.h>
@@ -5845,11 +5850,15 @@ PyInit__socket(void)
58455850

58465851
#ifdef MS_WINDOWS
58475852
if (support_wsa_no_inherit == -1) {
5853+
#if defined(_MSC_VER) && _MSC_VER >= 1800
5854+
support_wsa_no_inherit = IsWindows7SP1OrGreater();
5855+
#else
58485856
DWORD version = GetVersion();
58495857
DWORD major = (DWORD)LOBYTE(LOWORD(version));
58505858
DWORD minor = (DWORD)HIBYTE(LOWORD(version));
58515859
/* need Windows 7 SP1, 2008 R2 SP1 or later */
5852-
support_wsa_no_inherit = (major >= 6 && minor >= 1);
5860+
support_wsa_no_inherit = major > 6 || (major == 6 && minor >= 1);
5861+
#endif
58535862
}
58545863
#endif
58555864

Modules/timemodule.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
static int floatsleep(double);
3535
static PyObject* floattime(_Py_clock_info_t *info);
3636

37-
#ifdef MS_WINDOWS
38-
static OSVERSIONINFOEX winver;
39-
#endif
40-
4137
static PyObject *
4238
time_time(PyObject *self, PyObject *unused)
4339
{
@@ -1359,15 +1355,6 @@ PyInit_time(void)
13591355
if (PyStructSequence_InitType2(&StructTimeType,
13601356
&struct_time_type_desc) < 0)
13611357
return NULL;
1362-
1363-
#ifdef MS_WINDOWS
1364-
winver.dwOSVersionInfoSize = sizeof(winver);
1365-
if (!GetVersionEx((OSVERSIONINFO*)&winver)) {
1366-
Py_DECREF(m);
1367-
PyErr_SetFromWindowsErr(0);
1368-
return NULL;
1369-
}
1370-
#endif
13711358
}
13721359
Py_INCREF(&StructTimeType);
13731360
#ifdef HAVE_STRUCT_TM_TM_ZONE

0 commit comments

Comments
 (0)