@@ -15,9 +15,6 @@ if ([string]::IsNullOrWhiteSpace($pythonBin)) {
1515
1616Write-Host " Using Python: $pythonBin "
1717
18- $repoRoot = (Resolve-Path (Join-Path $PSScriptRoot ' ..' )).Path
19- $requirementsPath = Join-Path $repoRoot ' requirements.txt'
20-
2118function Test-PythonCode {
2219 param (
2320 [string ]$Python ,
@@ -32,79 +29,16 @@ function Test-PythonCode {
3229 }
3330}
3431
35- function Install-PatchedLiteLLMFromGitHubSource {
36- param (
37- [string ]$Python ,
38- [string ]$Tag
39- )
40-
41- $tempRoot = Join-Path ([System.IO.Path ]::GetTempPath()) " dsa-litellm-$Tag "
42- $archivePath = Join-Path ([System.IO.Path ]::GetTempPath()) " dsa-litellm-$Tag .zip"
43- $extractRoot = Join-Path $tempRoot ' src'
44-
45- if (Test-Path $tempRoot ) {
46- Remove-Item - Recurse - Force $tempRoot
47- }
48- New-Item - ItemType Directory - Path $extractRoot - Force | Out-Null
49-
50- $downloadUrl = " https://github.com/BerriAI/litellm/archive/refs/tags/$Tag .zip"
51- Write-Host " Downloading patched LiteLLM source: $downloadUrl "
52- Invoke-WebRequest - Uri $downloadUrl - OutFile $archivePath
53-
54- Expand-Archive - Path $archivePath - DestinationPath $extractRoot - Force
55- $sourceDir = Get-ChildItem - Path $extractRoot - Directory | Select-Object - First 1
56- if (-not $sourceDir ) {
57- throw " Unable to locate extracted LiteLLM source under $extractRoot ."
58- }
59-
60- $enterpriseDir = Join-Path $sourceDir.FullName ' enterprise'
61- if (Test-Path $enterpriseDir ) {
62- # Work around Poetry wheel build failures on Windows when the upstream source archive
63- # includes LiteLLM's optional enterprise package tree.
64- Remove-Item - Recurse - Force $enterpriseDir
65- }
66-
67- & $Python - m pip install $sourceDir.FullName
68- if ($LASTEXITCODE -ne 0 ) {
69- throw " Patched LiteLLM install failed with exit code $LASTEXITCODE ."
70- }
71- }
72-
73- function Install-BackendDependencies {
74- param (
75- [string ]$Python ,
76- [string ]$RequirementsFile
77- )
78-
79- $tempRequirements = Join-Path ([System.IO.Path ]::GetTempPath()) ' dsa-desktop-backend-requirements.txt'
80- $litellmTag = $null
81- $filteredLines = foreach ($line in Get-Content $RequirementsFile ) {
82- if ($line -match ' ^\s*litellm\s*@\s*https://github\.com/BerriAI/litellm/archive/refs/tags/([^/\s]+)\.tar\.gz' ) {
83- $litellmTag = $Matches [1 ]
84- continue
85- }
86- $line
87- }
88-
89- Set-Content - Path $tempRequirements - Value $filteredLines
90-
91- & $Python - m pip install - r $tempRequirements
92- if ($LASTEXITCODE -ne 0 ) {
93- throw " pip install -r $tempRequirements failed with exit code $LASTEXITCODE ."
94- }
95-
96- if ($litellmTag ) {
97- Install-PatchedLiteLLMFromGitHubSource - Python $Python - Tag $litellmTag
98- }
99- }
100-
10132Write-Host ' Building backend executable...'
10233if (-not (Test-PythonCode - Python $pythonBin - Code " import PyInstaller" )) {
10334 & $pythonBin - m pip install pyinstaller
10435}
10536
10637Write-Host ' Installing backend dependencies...'
107- Install-BackendDependencies - Python $pythonBin - RequirementsFile $requirementsPath
38+ & $pythonBin - m pip install - r requirements.txt
39+ if ($LASTEXITCODE -ne 0 ) {
40+ throw " pip install -r requirements.txt failed with exit code $LASTEXITCODE ."
41+ }
10842
10943Write-Host ' Checking python-multipart availability...'
11044if (-not (Test-PythonCode - Python $pythonBin - Code " import multipart, multipart.multipart" )) {
0 commit comments