-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_cv_weasyprint.ps1
More file actions
34 lines (27 loc) · 1.2 KB
/
build_cv_weasyprint.ps1
File metadata and controls
34 lines (27 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Script to generate CV using WeasyPrint with GTK4
# Save original PATH
$originalPath = $env:PATH
# Configure environment variables for GTK4
if (-not $env:GTK_PATH) {
# Default GTK_PATH for this environment; override by setting $env:GTK_PATH before running this script
$env:GTK_PATH = "D:\apps\gtk4"
Write-Host "GTK_PATH not set. Using default: $env:GTK_PATH" -ForegroundColor Yellow
}
# Rebuild PATH without Meld and with GTK at the beginning
$systemPath = $env:PATH -split ';' | Where-Object { $_ -notmatch 'Meld' }
$newPath = @("$env:GTK_PATH\bin") + $systemPath
$env:PATH = $newPath -join ';'
$env:GI_TYPELIB_PATH = "$env:GTK_PATH\lib\girepository-1.0"
$env:XDG_DATA_DIRS = "$env:GTK_PATH\share"
Write-Host "Testing WeasyPrint..." -ForegroundColor Yellow
python -c "import weasyprint; print('WeasyPrint version:', weasyprint.__version__)"
if ($LASTEXITCODE -eq 0) {
Write-Host "WeasyPrint loaded successfully!" -ForegroundColor Green
Write-Host "Building CV..." -ForegroundColor Yellow
# Execute the Python script
python scripts\build_cv.py
} else {
Write-Host "Error loading WeasyPrint. Check GTK installation." -ForegroundColor Red
}
# Restore original PATH
$env:PATH = $originalPath