@@ -4,6 +4,10 @@ if (!(Test-Path 'C:\python_dev')) {
44if (! (Test-Path ' C:\buildtools' )) {
55 New-Item ' C:\buildtools' - ItemType Directory
66}
7+
8+ ${Env: ProgramFiles(x86)} = " C:\Program Files (x86)"
9+ echo ${Env: ProgramFiles(x86)}
10+
711Copy-Item ' build.bat' - Destination ' C:\python_dev\build.bat' - Force
812Copy-Item ' fips_python.patch' - Destination ' C:\python_dev\fips_python.patch' - Force
913
@@ -17,23 +21,38 @@ Write-Host ('Installing Visual Studio 2017 Community Edition...')
1721$process = Start-Process - FilePath C:\python_dev\vs_Community.exe - ArgumentList " --includeRecommended" , " --includeOptional" , " --quiet" , " --nocache" , " --norestart" , " --wait" , " --installPath" , " c:\buildtools" , " --add" , " Microsoft.VisualStudio.Workload.Python" , " --add" , " Microsoft.ComponentGroup.PythonTools.NativeDevelopment" , " --add" , " Microsoft.Component.MSBuild" , " --add" , " Component.CPython3.x86" - Wait - PassThru
1822Write-Output $process.ExitCode
1923
20- Write-Host (' Downloading python...' )
21- Invoke-WebRequest - Uri https:// www.python.org/ ftp/ python/ 3.9 .2 / Python- 3.9 .2. tar.xz - OutFile ' C:\python_dev\Python-3.9.2.tar.xz'
22-
2324Write-Host (' Installing Choco...' )
2425iex ((New-Object System.Net.WebClient).DownloadString(" https://chocolatey.org/install.ps1" ));
2526
26- choco install git 7zip.install patch - y;
27+ # choco install git 7zip.install -y;
2728cd C:\python_dev
2829
30+ if ((Test-Path ' C:\Python39' )) {
31+ # Cleanup
32+ Remove-Item C:\Python39 - Recurse
33+ }
34+ if ((Test-Path ' C:\python_dev\Python-3.9.2' )) {
35+ # Cleanup
36+ Remove-Item C:\python_dev\Python- 3.9 .2 - Recurse
37+ }
38+
39+ if (! (Test-Path ' C:\python_dev\Python-3.9.2.tar.xz' )) {
40+ Write-Host (' Downloading python...' )
41+ Invoke-WebRequest - Uri https:// www.python.org/ ftp/ python/ 3.9 .2 / Python- 3.9 .2. tar.xz - OutFile ' C:\python_dev\Python-3.9.2.tar.xz'
42+ }
43+
2944Write-Host (' Untar Python...' )
30457z x Python- 3.9 .2. tar.xz
31467z x Python- 3.9 .2. tar
3247Move-Item C:\python_dev\Python- 3.9 .2 C:\Python39
48+
3349cd C:\Python39
34- patch - p1 - i C:\python_dev\fips_python.patch
50+ cmd.exe / c " c:\Program Files\Git\usr\bin\patch.exe" - p1 - i C:\python_dev\fips_python.patch
51+ Write-Host (' Patch success...' )
3552
53+ Write-Host (' Building Python...' )
3654cmd.exe / c C:\python_dev\build.bat
55+ Write-Host (' Build Python success...' )
3756
3857Copy-Item ' C:\Python39\PCbuild\amd64\python.exe' - Destination ' c:\Python39\PCbuild\amd64\python39.exe' - Force
3958Write-Host (' Done...' )
0 commit comments