# HG changeset patch # User Steve Dower # Date 1417933179 28800 # Sat Dec 06 22:19:39 2014 -0800 # Branch Projects # Node ID 93db016982a220793e129ed66939f985616283f4 # Parent 43fd6f01854a5a8f6bb00a7c1ad35ecded6466a8 Fixes sysconfig path resolution when running within build directory. diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -9,6 +9,7 @@ Email: """ +import _imp import os import re import sys @@ -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 @@ -52,10 +45,8 @@ 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) + _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) @@ -468,7 +459,7 @@ # 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)) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -109,13 +109,8 @@ # 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 @@ -130,10 +125,8 @@ _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) + _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) # HG changeset patch # User Steve Dower # Date 1418010782 28800 # Sun Dec 07 19:53:02 2014 -0800 # Branch Projects # Node ID 9d48bd7e04ae4fb4f2dd7a2cac6b3eb742cdffa5 # Parent 93db016982a220793e129ed66939f985616283f4 Fixes build_ext when running within build directory. diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -209,7 +209,7 @@ 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:] # HG changeset patch # User Steve Dower # Date 1418102056 28800 # Mon Dec 08 21:14:16 2014 -0800 # Branch Projects # Node ID e262098211bab63927a1044aeb5d5adedc600de0 # Parent 9d48bd7e04ae4fb4f2dd7a2cac6b3eb742cdffa5 Review feedback diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -1,10 +1,9 @@ /* - IMPORTANT NOTE: IF THIS FILE IS CHANGED, WININST-6.EXE MUST BE RECOMPILED - WITH THE MSVC6 WININST.DSW WORKSPACE FILE MANUALLY, AND WININST-7.1.EXE MUST - BE RECOMPILED WITH THE MSVC 2003.NET WININST-7.1.VCPROJ FILE MANUALLY. + IMPORTANT NOTE: IF THIS FILE IS CHANGED, PCBUILD\BDIST_WININST.VCXPROJ MUST + BE REBUILT AS WELL. - IF CHANGES TO THIS FILE ARE CHECKED INTO PYTHON CVS, THE RECOMPILED BINARIES - MUST BE CHECKED IN AS WELL! + IF CHANGES TO THIS FILE ARE CHECKED IN, THE RECOMPILED BINARIES MUST BE + CHECKED IN AS WELL! */ /* diff --git a/PCbuild/env.bat b/PCbuild/env.bat --- a/PCbuild/env.bat +++ b/PCbuild/env.bat @@ -1,4 +1,11 @@ @echo off +rem This script adds the latest available tools to the path for the current +rem command window. However, most builds of Python will ignore the version +rem of the tools on PATH and use PlatformToolset instead. Ideally, both sets of +rem tools should be the same version to avoid potential conflicts. +rem +rem To build Python with an earlier toolset, pass "/p:PlatformToolset=v100" (or +rem 'v110', 'v120' or 'v140') to the build script. echo Build environments: x86, amd64, x86_amd64 echo. diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -92,12 +92,11 @@ @rem rebuild. @rem This is only meant as a convenience for developing CPython @rem and using it outside of that context is ill-advised. -@echo Running $(Configuration)^^^|$(Platform) interpreter... +@echo Running $(Configuration)^|$(Platform) interpreter... @"$(OutDir)python$(PyDebugExt).exe" %* - <_ExistingContent Condition="Exists('$(PySourcePath)python.bat')">$([System.IO.File]::ReadAllText('$(PySourcePath)python.bat')) + <_ExistingContent Condition="Exists('$(PySourcePath)python.bat')">$([System.IO.File]::ReadAllText('$(PySourcePath)python.bat')) - - + \ No newline at end of file diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -410,4 +410,8 @@ + + + + \ No newline at end of file diff --git a/PCbuild/rt.bat b/PCbuild/rt.bat --- a/PCbuild/rt.bat +++ b/PCbuild/rt.bat @@ -39,8 +39,8 @@ if "%1"=="-d" (set suffix=_d) & shift & goto CheckOpts if "%1"=="-x64" (set prefix=%pcbuild%amd64\) & shift & goto CheckOpts -set exe=%prefix%python%suffix% -set cmd=%exe% %dashO% -Wd -E -bb ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 +set exe=%prefix%python%suffix%.exe +set cmd="%exe%" %dashO% -Wd -E -bb "%pcbuild%..\lib\test\regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 if defined qmode goto Qmode echo Deleting .pyc/.pyo files ... diff --git a/Tools/buildbot/build-amd64.bat b/Tools/buildbot/build-amd64.bat --- a/Tools/buildbot/build-amd64.bat +++ b/Tools/buildbot/build-amd64.bat @@ -1,17 +1,2 @@ @rem Used by the buildbot "compile" step. - -@rem Clean up -call "%~dp0clean-amd64.bat" - -@rem If you need the buildbots to start fresh (such as when upgrading to -@rem a new version of an external library, especially Tcl/Tk): -@rem 1) uncomment the following line: - -@rem call "%~dp0..\..\PCbuild\get_externals.bat" --clean-only - -@rem 2) commit and push -@rem 3) wait for all Windows bots to start a build with that changeset -@rem 4) re-comment, commit and push again - -@rem Do the build -call "%~dp0..\..\PCbuild\build.bat" -p x64 -e -d %* +call "%~dp0build.bat" -p x64 %* diff --git a/Tools/buildbot/build.bat b/Tools/buildbot/build.bat --- a/Tools/buildbot/build.bat +++ b/Tools/buildbot/build.bat @@ -1,7 +1,10 @@ @rem Used by the buildbot "compile" step. @rem Clean up -call "%~dp0clean.bat" +set PLAT= +if '%1' EQU '-p' if '%2' EQU 'x64' (set PLAT=-amd64) + +call "%~dp0clean%PLAT%.bat" @rem If you need the buildbots to start fresh (such as when upgrading to @rem a new version of an external library, especially Tcl/Tk): @@ -14,4 +17,4 @@ @rem 4) re-comment, commit and push again @rem Do the build -call "%~dp0..\..\PCbuild\build.bat" -e -d %* +call "%~dp0..\..\PCbuild\build.bat" -e -d -v %*