Skip to content

Commit 9ae1742

Browse files
authored
[3.7] bpo-42336: Improve PCbuild batch files (pythonGH-23325) (pythonGH-23373)
* bpo-42336: Improve PCbuild batch files (pythonGH-23325) * Remove ARM platforms
1 parent 225e365 commit 9ae1742

File tree

7 files changed

+47
-14
lines changed

7 files changed

+47
-14
lines changed

.azure-pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
matrix:
140140
win32:
141141
arch: win32
142-
buildOpt:
142+
buildOpt: '-p Win32'
143143
testRunTitle: '$(Build.SourceBranchName)-win32'
144144
testRunPlatform: win32
145145
win64:

.azure-pipelines/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ jobs:
139139
matrix:
140140
win32:
141141
arch: win32
142-
buildOpt:
142+
buildOpt: '-p Win32'
143143
testRunTitle: '$(System.PullRequest.TargetBranch)-win32'
144144
testRunPlatform: win32
145145
win64:

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Display build info
4040
run: .\python.bat -m test.pythoninfo
4141
- name: Tests
42-
run: .\PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
42+
run: .\PCbuild\rt.bat -p Win32 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
4343

4444
build_win_amd64:
4545
name: 'Windows (x64)'
@@ -53,7 +53,7 @@ jobs:
5353
- name: Display build info
5454
run: .\python.bat -m test.pythoninfo
5555
- name: Tests
56-
run: .\PCbuild\rt.bat -x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
56+
run: .\PCbuild\rt.bat -p x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
5757

5858
build_macos:
5959
name: 'macOS'

PCbuild/env.bat

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,19 @@ rem 'v110', 'v120' or 'v140') to the build script.
99

1010
echo Build environments: x86, amd64, x86_amd64
1111
echo.
12-
set VSTOOLS=%VS140COMNTOOLS%
13-
if "%VSTOOLS%"=="" set VSTOOLS=%VS120COMNTOOLS%
14-
if "%VSTOOLS%"=="" set VSTOOLS=%VS110COMNTOOLS%
15-
if "%VSTOOLS%"=="" set VSTOOLS=%VS100COMNTOOLS%
16-
call "%VSTOOLS%..\..\VC\vcvarsall.bat" %*
12+
set _ARGS=%*
13+
if NOT DEFINED _ARGS set _ARGS=x86
14+
15+
if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" goto :skip_vswhere
16+
set VSTOOLS=
17+
for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64') DO @(set VSTOOLS=%%i\VC\Auxiliary\Build\vcvarsall.bat)
18+
if not defined VSTOOLS goto :skip_vswhere
19+
call "%VSTOOLS%" %_ARGS%
20+
exit /B 0
21+
22+
:skip_vswhere
23+
if not defined VSTOOLS set VSTOOLS=%VS140COMNTOOLS%
24+
if not defined VSTOOLS set VSTOOLS=%VS120COMNTOOLS%
25+
if not defined VSTOOLS set VSTOOLS=%VS110COMNTOOLS%
26+
if not defined VSTOOLS set VSTOOLS=%VS100COMNTOOLS%
27+
call "%VSTOOLS%..\..\VC\vcvarsall.bat" %_ARGS%

PCbuild/env.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$pcbuild = $script:MyInvocation.MyCommand.Path | Split-Path -parent;
2+
& cmd /K "$pcbuild\env.bat" $args

PCbuild/idle.bat

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@ rem Usage: idle [-d]
44
rem -d Run Debug build (python_d.exe). Else release build.
55

66
setlocal
7-
set exe=win32\python
7+
set PCBUILD=%~dp0
8+
set exedir=%PCBUILD%\win32
9+
set exe=python
810
PATH %PATH%;..\externals\tcltk\bin
911

10-
if "%1"=="-d" (set exe=%exe%_d) & shift
12+
:CheckOpts
13+
if "%1"=="-d" (set exe=%exe%_d) & shift & goto :CheckOpts
14+
if "%1"=="-p" (call :SetExeDir %2) & shift & shift & goto :CheckOpts
1115

12-
set cmd=%exe% ../Lib/idlelib/idle.py %1 %2 %3 %4 %5 %6 %7 %8 %9
16+
set cmd=%exedir%\%exe% %PCBUILD%\..\Lib\idlelib\idle.py %1 %2 %3 %4 %5 %6 %7 %8 %9
1317

1418
echo on
1519
%cmd%
20+
exit /B %LASTERRORCODE%
21+
22+
:SetExeDir
23+
if /I %1 EQU Win32 (set exedir=%PCBUILD%\win32)
24+
if /I %1 EQU x64 (set exedir=%PCBUILD%\amd64)
25+
exit /B 0

PCbuild/rt.bat

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ rem -O Run python.exe or python_d.exe (see -d) with -O.
66
rem -q "quick" -- normally the tests are run twice, the first time
77
rem after deleting all the .pyc files reachable from Lib/.
88
rem -q runs the tests just once, and without deleting .pyc files.
9-
rem -x64 Run the 64-bit build of python (or python_d if -d was specified)
10-
rem When omitted, uses %PREFIX% if set or the 32-bit build
9+
rem -p <Win32|x64> or -win32, -x64
10+
rem Run the specified architecture of python (or python_d if -d
11+
rem was specified). If omitted, uses %PREFIX% if set or 32-bit.
1112
rem All leading instances of these switches are shifted off, and
1213
rem whatever remains (up to 9 arguments) is passed to regrtest.py.
1314
rem For example,
@@ -38,7 +39,9 @@ set exe=
3839
if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts
3940
if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts
4041
if "%1"=="-d" (set suffix=_d) & shift & goto CheckOpts
42+
if "%1"=="-win32" (set prefix=%pcbuild%win32) & shift & goto CheckOpts
4143
if "%1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts
44+
if "%1"=="-p" (call :SetPlatform %~2) & shift & shift & goto CheckOpts
4245
if NOT "%1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts
4346

4447
if not defined prefix set prefix=%pcbuild%win32
@@ -58,6 +61,13 @@ echo on
5861

5962
echo About to run again without deleting .pyc first:
6063
pause
64+
goto Qmode
65+
66+
:SetPlatform
67+
if /I %1 EQU Win32 (set prefix=%pcbuild%win32) & exit /B 0
68+
if /I %1 EQU x64 (set prefix=%pcbuild%amd64) & exit /B 0
69+
echo Invalid platform "%1"
70+
exit /B 1
6171

6272
:Qmode
6373
echo on

0 commit comments

Comments
 (0)