@@ -4,16 +4,14 @@ rem Simple script to fetch source for external libraries
44
55if " %PCBUILD% " == " " (set PCBUILD=%~dp0 )
66if " %EXTERNALS_DIR% " == " " (set EXTERNALS_DIR=%PCBUILD% \..\externals)
7- if " %NUGET% " == " " (set NUGET=%EXTERNALS_DIR% \nuget.exe)
8- if " %NUGET_URL% " == " " (set NUGET_URL=https://aka.ms/nugetclidl)
97
108set DO_FETCH = true
119set DO_CLEAN = false
1210
1311:CheckOpts
1412if " %~1 " == " --no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts
1513if " %~1 " == " --no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts
16- if " %~1 " == " --python" (set PYTHON_FOR_BUILD =%2 ) & shift & shift & goto CheckOpts
14+ if " %~1 " == " --python" (set PYTHON =%2 ) & shift & shift & goto CheckOpts
1715if " %~1 " == " --organization" (set ORG=%2 ) & shift & shift & goto CheckOpts
1816if " %~1 " == " -c" (set DO_CLEAN=true) & shift & goto CheckOpts
1917if " %~1 " == " --clean" (set DO_CLEAN=true) & shift & goto CheckOpts
@@ -33,22 +31,10 @@ if "%DO_FETCH%"=="false" goto end
3331
3432if " %ORG% " == " " (set ORG=python)
3533
36- if " %PYTHON_FOR_BUILD% " == " " (
37- echo Checking for installed python...
38- py -3.6 -V > nul 2 >& 1 && (set PYTHON_FOR_BUILD=py -3.6)
39- )
40- if " %PYTHON_FOR_BUILD% " == " " (
41- if NOT exist " %EXTERNALS_DIR% " mkdir " %EXTERNALS_DIR% "
42- if NOT exist " %NUGET% " (
43- echo Downloading nuget...
44- rem NB: Must use single quotes around NUGET here, NOT double!
45- rem Otherwise, a space in the path would break things
46- powershell.exe -Command Invoke-WebRequest %NUGET_URL% -OutFile '%NUGET% '
47- )
48- echo Installing Python via nuget...
49- " %NUGET% " install pythonx86 -ExcludeVersion -OutputDirectory " %EXTERNALS_DIR% "
50- rem Quote it here; it's not quoted later because "py -3.6" wouldn't work
51- set PYTHON_FOR_BUILD = " %EXTERNALS_DIR% \pythonx86\tools\python.exe"
34+ call " %PCBUILD% find_python.bat" " %PYTHON% "
35+
36+ if " %PYTHON% " == " " (
37+ where /Q git || echo Python 3.6 could not be found or installed, and git.exe is not on your PATH && exit /B 1
5238)
5339
5440echo .Fetching external libraries...
@@ -65,9 +51,12 @@ set libraries=%libraries% xz-5.2.2
6551for %%e in (%libraries% ) do (
6652 if exist " %EXTERNALS_DIR% \%%e " (
6753 echo .%%e already exists, skipping.
54+ ) else if " %PYTHON% " == " " (
55+ echo .Fetching %%e with git...
56+ git clone --depth 1 https://github.com/%ORG% /cpython-source-deps --branch %%e " %EXTERNALS_DIR% \%%e "
6857 ) else (
6958 echo .Fetching %%e ...
70- %PYTHON_FOR_BUILD % " %PCBUILD% get_external.py" -O %ORG% %%e
59+ %PYTHON % " %PCBUILD% get_external.py" -O %ORG% %%e
7160 )
7261)
7362
@@ -80,9 +69,12 @@ if NOT "%IncludeSSL%"=="false" set binaries=%binaries% nasm-2.11.06
8069for %%b in (%binaries% ) do (
8170 if exist " %EXTERNALS_DIR% \%%b " (
8271 echo .%%b already exists, skipping.
72+ ) else if " %PYTHON% " == " " (
73+ echo .Fetching %%b with git...
74+ git clone --depth 1 https://github.com/%ORG% /cpython-bin-deps --branch %%b " %EXTERNALS_DIR% \%%b "
8375 ) else (
8476 echo .Fetching %%b ...
85- %PYTHON_FOR_BUILD % " %PCBUILD% get_external.py" -b -O %ORG% %%b
77+ %PYTHON % " %PCBUILD% get_external.py" -b -O %ORG% %%b
8678 )
8779)
8880
0 commit comments