Skip to content

Commit

Permalink
Issue python#22919: Windows build updated to support VC 14.0 (Visual …
Browse files Browse the repository at this point in the history
…Studio 2015), which will be used for the official 3.5 release.
  • Loading branch information
zooba committed Nov 22, 2014
1 parent 9271677 commit 65e4cb1
Show file tree
Hide file tree
Showing 144 changed files with 2,494 additions and 26,822 deletions.
28 changes: 17 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
.gdb_history
Doc/build/
Doc/venv/
Lib/distutils/command/*.pdb
Lib/lib2to3/*.pickle
Lib/test/data/*
Lib/_sysconfigdata.py
Expand All @@ -27,23 +28,26 @@ Programs/_freeze_importlib
Programs/_testembed
PC/python_nt*.h
PC/pythonnt_rc*.h
PCbuild/*.bsc
PCbuild/*.dll
PCbuild/*.exe
PCbuild/*.exp
PCbuild/*.lib
PCbuild/*.ncb
PCbuild/*.o
PCbuild/*.pdb
PC/*/*.exe
PC/*/*.exp
PC/*/*.lib
PC/*/*.bsc
PC/*/*.dll
PC/*/*.pdb
PC/*/*.user
PC/*/*.ncb
PC/*/*.suo
PC/*/Win32-temp-*
PC/*/x64-temp-*
PC/*/amd64
PCbuild/*.user
PCbuild/*.suo
PCbuild/*.*sdf
PCbuild/Win32-temp-*
PCbuild/x64-temp-*
PCbuild/*-pgi
PCbuild/*-pgo
PCbuild/amd64/
PCbuild/ipch
PCbuild/obj
PCBuild/win32
.purify
Parser/pgen
__pycache__
Expand Down Expand Up @@ -78,3 +82,5 @@ TAGS
coverage/
externals/
htmlcov/
Tools/ssl/amd64
Tools/ssl/win32
18 changes: 5 additions & 13 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ libpython*.so*
*.pyd
*.cover
*~
Lib/distutils/command/*.pdb
Lib/lib2to3/*.pickle
Lib/test/data/*
Misc/*.wpu
PC/python_nt*.h
PC/pythonnt_rc*.h
PC/*.obj
PC/*.exe
PC/*/*.exe
PC/*/*.exp
PC/*/*.lib
Expand All @@ -69,23 +68,14 @@ PC/*/*.suo
PC/*/Win32-temp-*
PC/*/x64-temp-*
PC/*/amd64
PCbuild/*.exe
PCbuild/*.dll
PCbuild/*.pdb
PCbuild/*.lib
PCbuild/*.exp
PCbuild/*.o
PCbuild/*.ncb
PCbuild/*.bsc
PCbuild/*.user
PCbuild/*.suo
PCbuild/*.*sdf
PCbuild/Win32-temp-*
PCbuild/x64-temp-*
PCbuild/*-pgi
PCbuild/*-pgo
PCbuild/amd64
PCbuild/ipch
PCbuild/obj
PCbuild/win32
Tools/unicode/build/
Tools/unicode/MAPPINGS/
BuildLog.htm
Expand All @@ -100,3 +90,5 @@ htmlcov/
*.gcno
*.gcov
coverage.info
Tools/ssl/amd64
Tools/ssl/win32
6 changes: 5 additions & 1 deletion Lib/ctypes/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def _get_build_version():
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
majorVersion = int(s[:-2]) - 6
if majorVersion >= 13:
majorVersion += 1
minorVersion = int(s[2:3]) / 10.0
# I don't think paths are affected by minor version in version 6
if majorVersion == 6:
Expand All @@ -36,8 +38,10 @@ def find_msvcrt():
return None
if version <= 6:
clibname = 'msvcrt'
else:
elif version <= 13:
clibname = 'msvcr%d' % (version * 10)
else:
clibname = 'appcrt%d' % (version * 10)

# If python was built with in debug mode
import importlib.machinery
Expand Down
2 changes: 1 addition & 1 deletion Lib/distutils/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def finalize_options(self):
if MSVC_VERSION >= 9:
# Use the .lib files for the correct architecture
if self.plat_name == 'win32':
suffix = ''
suffix = 'win32'
else:
# win-amd64 or win-ia64
suffix = self.plat_name[4:]
Expand Down
Binary file added Lib/distutils/command/wininst-14.0-amd64.exe
Binary file not shown.
Binary file added Lib/distutils/command/wininst-14.0.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions Lib/distutils/msvc9compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ def get_build_version():
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
majorVersion = int(s[:-2]) - 6
if majorVersion >= 13:
# v13 was skipped and should be v14
majorVersion += 1
minorVersion = int(s[2:3]) / 10.0
# I don't think paths are affected by minor version in version 6
if majorVersion == 6:
Expand Down
3 changes: 3 additions & 0 deletions Lib/distutils/msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def get_build_version():
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
majorVersion = int(s[:-2]) - 6
if majorVersion >= 13:
# v13 was skipped and should be v14
majorVersion += 1
minorVersion = int(s[2:3]) / 10.0
# I don't think paths are affected by minor version in version 6
if majorVersion == 6:
Expand Down
27 changes: 9 additions & 18 deletions Lib/distutils/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Email: <[email protected]>
"""

import _imp
import os
import re
import sys
Expand All @@ -22,23 +23,15 @@
BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)

# Path to the base directory of the project. On Windows the binary may
# live in project/PCBuild9. If we're dealing with an x64 Windows build,
# it'll live in project/PCbuild/amd64.
# live in project/PCBuild/win32 or project/PCBuild/amd64.
# set for cross builds
if "_PYTHON_PROJECT_BASE" in os.environ:
project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
else:
project_base = os.path.dirname(os.path.abspath(sys.executable))
if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
# PC/VS7.1
if os.name == "nt" and "\\pc\\v" in project_base[-10:].lower():
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
os.path.pardir))
# PC/AMD64
if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower():
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
os.path.pardir))
if (os.name == 'nt' and
project_base.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))):
project_base = os.path.dirname(os.path.dirname(project_base))

# python_build: (Boolean) if true, we're either building Python or
# building an extension with an un-installed Python, so we use
Expand All @@ -51,11 +44,9 @@ def _is_python_source_dir(d):
return True
return False
_sys_home = getattr(sys, '_home', None)
if _sys_home and os.name == 'nt' and \
_sys_home.lower().endswith(('pcbuild', 'pcbuild\\amd64')):
_sys_home = os.path.dirname(_sys_home)
if _sys_home.endswith('pcbuild'): # must be amd64
_sys_home = os.path.dirname(_sys_home)
if (_sys_home and os.name == 'nt' and
_sys_home.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))):
_sys_home = os.path.dirname(os.path.dirname(_sys_home))
def _python_build():
if _sys_home:
return _is_python_source_dir(_sys_home)
Expand Down Expand Up @@ -468,7 +459,7 @@ def _init_nt():
# XXX hmmm.. a normal install puts include files here
g['INCLUDEPY'] = get_python_inc(plat_specific=0)

g['EXT_SUFFIX'] = '.pyd'
g['EXT_SUFFIX'] = _imp.extension_suffixes()[0]
g['EXE'] = ".exe"
g['VERSION'] = get_python_version().replace(".", "")
g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
Expand Down
17 changes: 5 additions & 12 deletions Lib/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,8 @@ def _safe_realpath(path):
# unable to retrieve the real program name
_PROJECT_BASE = _safe_realpath(os.getcwd())

if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower():
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir))
# PC/VS7.1
if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
# PC/AMD64
if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():
if (os.name == 'nt' and
_PROJECT_BASE.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))):
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))

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

_sys_home = getattr(sys, '_home', None)
if _sys_home and os.name == 'nt' and \
_sys_home.lower().endswith(('pcbuild', 'pcbuild\\amd64')):
_sys_home = os.path.dirname(_sys_home)
if _sys_home.endswith('pcbuild'): # must be amd64
_sys_home = os.path.dirname(_sys_home)
if (_sys_home and os.name == 'nt' and
_sys_home.lower().endswith(('\\pcbuild\\win32', '\\pcbuild\\amd64'))):
_sys_home = os.path.dirname(os.path.dirname(_sys_home))
def is_python_build(check_home=False):
if check_home and _sys_home:
return _is_python_source_dir(_sys_home)
Expand Down
5 changes: 5 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,11 @@ Build

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

- Issue #22919: Windows build updated to support VC 14.0 (Visual Studio 2015),
which will be used for the official release.

- Issue #21236: Build _msi.pyd with cabinet.lib instead of fci.lib

C API
-----

Expand Down
22 changes: 20 additions & 2 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,15 +1046,33 @@ PyLong_FromPy_off_t(Py_off_t offset)
/* The actual size of the structure is determined at runtime.
* Only the first items must be present.
*/

#if _MSC_VER >= 1900

typedef struct {
CRITICAL_SECTION lock;
intptr_t osfhnd;
__int64 startpos;
char osfile;
} my_ioinfo;

#define IOINFO_L2E 6
#define IOINFO_ARRAYS 128

#else

typedef struct {
intptr_t osfhnd;
char osfile;
} my_ioinfo;

extern __declspec(dllimport) char * __pioinfo[];
#define IOINFO_L2E 5
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
#define IOINFO_ARRAYS 64

#endif

extern __declspec(dllimport) char * __pioinfo[];
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
#define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS)
#define FOPEN 0x01
#define _NO_CONSOLE_FILENO (intptr_t)-2
Expand Down
11 changes: 10 additions & 1 deletion Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ if_indextoname(index) -- return the corresponding interface name\n\
# include <fcntl.h>
# endif

#if defined(_MSC_VER) && _MSC_VER >= 1800
/* Provides the IsWindows7SP1OrGreater() function */
#include <VersionHelpers.h>
#endif

#endif

#include <stddef.h>
Expand Down Expand Up @@ -5845,11 +5850,15 @@ PyInit__socket(void)

#ifdef MS_WINDOWS
if (support_wsa_no_inherit == -1) {
#if defined(_MSC_VER) && _MSC_VER >= 1800
support_wsa_no_inherit = IsWindows7SP1OrGreater();
#else
DWORD version = GetVersion();
DWORD major = (DWORD)LOBYTE(LOWORD(version));
DWORD minor = (DWORD)HIBYTE(LOWORD(version));
/* need Windows 7 SP1, 2008 R2 SP1 or later */
support_wsa_no_inherit = (major >= 6 && minor >= 1);
support_wsa_no_inherit = major > 6 || (major == 6 && minor >= 1);
#endif
}
#endif

Expand Down
13 changes: 0 additions & 13 deletions Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
static int floatsleep(double);
static PyObject* floattime(_Py_clock_info_t *info);

#ifdef MS_WINDOWS
static OSVERSIONINFOEX winver;
#endif

static PyObject *
time_time(PyObject *self, PyObject *unused)
{
Expand Down Expand Up @@ -1359,15 +1355,6 @@ PyInit_time(void)
if (PyStructSequence_InitType2(&StructTimeType,
&struct_time_type_desc) < 0)
return NULL;

#ifdef MS_WINDOWS
winver.dwOSVersionInfoSize = sizeof(winver);
if (!GetVersionEx((OSVERSIONINFO*)&winver)) {
Py_DECREF(m);
PyErr_SetFromWindowsErr(0);
return NULL;
}
#endif
}
Py_INCREF(&StructTimeType);
#ifdef HAVE_STRUCT_TM_TM_ZONE
Expand Down
Loading

0 comments on commit 65e4cb1

Please sign in to comment.