@@ -5,41 +5,6 @@ $ProgressPreference = "SilentlyContinue"
55$WorkingDirectory = Get-Location
66$CloudflaredDirectory = " $WorkingDirectory \go\src\github.com\cloudflare\cloudflared"
77
8- Write-Output " Installing python..."
9-
10- $PythonVersion = " 3.10.11"
11- $PythonZipFile = " $env: Temp \python-$PythonVersion -embed-amd64.zip"
12- $PipInstallFile = " $env: Temp \get-pip.py"
13- $PythonZipUrl = " https://www.python.org/ftp/python/$PythonVersion /python-$PythonVersion -embed-amd64.zip"
14- $PythonPath = " $WorkingDirectory \Python"
15- $PythonBinPath = " $PythonPath \python.exe"
16-
17- # Download Python zip file
18- Invoke-WebRequest - Uri $PythonZipUrl - OutFile $PythonZipFile
19-
20- # Download Python pip file
21- Invoke-WebRequest - Uri " https://bootstrap.pypa.io/get-pip.py" - OutFile $PipInstallFile
22-
23- # Extract Python files
24- Expand-Archive $PythonZipFile - DestinationPath $PythonPath - Force
25-
26- # Add Python to PATH
27- $env: Path = " $PythonPath \Scripts;$PythonPath ;$ ( $env: Path ) "
28-
29- Write-Output " Installed to $PythonPath "
30-
31- # Install pip
32- & $PythonBinPath $PipInstallFile
33-
34- # Add package paths in pythonXX._pth to unblock python -m pip
35- $PythonImportPathFile = " $PythonPath \python310._pth"
36- $ComponentTestsDir = " $CloudflaredDirectory \component-tests\"
37- @ ($ComponentTestsDir , " Lib\site-packages" , $ (Get-Content $PythonImportPathFile )) | Set-Content $PythonImportPathFile
38-
39- # Test Python installation
40- & $PythonBinPath -- version
41- & $PythonBinPath - m pip -- version
42-
438go env
449go version
4510
@@ -48,8 +13,8 @@ $env:CGO_ENABLED = 1
4813$env: TARGET_ARCH = " amd64"
4914$env: Path = " $Env: Temp \go\bin;$ ( $env: Path ) "
5015
51- & $PythonBinPath -- version
52- & $PythonBinPath - m pip -- version
16+ python -- version
17+ python - m pip -- version
5318
5419cd $CloudflaredDirectory
5520
@@ -72,11 +37,11 @@ if ($LASTEXITCODE -ne 0) { throw "Failed unit tests" }
7237
7338Write-Output " Running component tests"
7439
75- & $PythonBinPath - m pip install -- upgrade - r component- tests/ requirements.txt
76- & $PythonBinPath component- tests/ setup.py -- type create
77- & $PythonBinPath - m pytest component- tests - o log_cli= true -- log- cli- level= INFO
40+ python - m pip -- disable-pip - version - check install -- upgrade - r component- tests/ requirements.txt
41+ python component- tests/ setup.py -- type create
42+ python - m pytest component- tests - o log_cli= true -- log- cli- level= INFO
7843if ($LASTEXITCODE -ne 0 ) {
79- & $PythonBinPath component- tests/ setup.py -- type cleanup
44+ python component- tests/ setup.py -- type cleanup
8045 throw " Failed component tests"
8146}
82- & $PythonBinPath component- tests/ setup.py -- type cleanup
47+ python component- tests/ setup.py -- type cleanup
0 commit comments