diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 194294b00f5..3984b1fdae4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -287,17 +287,30 @@ jobs: shell: pwsh run: | python --version - Write-Host "Cleaning up existing installations..." - Start-Process -FilePath "python" -ArgumentList "-m pip uninstall -y slangpy" -Verb RunAs -Wait - Write-Host "Installing slangpy..." - python -m pip install --no-cache-dir --verbose slangpy --user - Write-Host "Getting Python site-packages directory and copying library files (DLL, SO, DYLIB)..." + Write-Host "Cleaning up existing installations and installing slangpy..." + try { + $SLANGPY_LOCATION = python -c "import slangpy; print(slangpy.__file__.rsplit('\\', 2)[0])" + Start-Process -FilePath "python" -ArgumentList "-m pip uninstall -y slangpy" -Verb RunAs -Wait + if (Test-Path $SLANGPY_LOCATION) { + Write-Host "Removing existing slangpy directory at: $SLANGPY_LOCATION" + Remove-Item -Path $SLANGPY_LOCATION -Recurse -Force + } + } catch { + Write-Host "slangpy not found or already removed" + } + python -m pip install --verbose slangpy --user $SITE_PACKAGES = python -c "import slangpy; print(slangpy.__file__.rsplit('\\', 2)[0])" + $bin_dir = $env:bin_dir -replace '^/c/', 'C:\' -replace '/', '\' Write-Host "Site packages directory: $SITE_PACKAGES" - Write-Host "Copying library files..." - Copy-Item -Path "$bin_dir\*" -Include "*.dll","*.so","*.dylib" -Destination "$SITE_PACKAGES\slangpy\" -Force -ErrorAction Continue + Write-Host "bin_dir location: $bin_dir" + try { + Copy-Item -Path "$bin_dir\slang*.dll" -Destination "$SITE_PACKAGES\slangpy\" -Force -ErrorAction Stop + } catch { + Write-Error "Failed to copy library files: $_" + exit 1 + } Write-Host "Listing files in slangpy directory..." - Get-ChildItem -Path "$SITE_PACKAGES\slangpy" | Write-Host + Get-ChildItem -Path "$SITE_PACKAGES\slangpy" | ForEach-Object { Write-Host "$($_.Name) - Last Modified: $($_.LastWriteTime)" } Write-Host "Running pytest on slangpy tests..." $env:PYTHONPATH = "$SITE_PACKAGES" python -m pytest "$SITE_PACKAGES\slangpy\tests" -v