Skip to content

Commit f77ab22

Browse files
committed
win deploy debug
1 parent fdfe61b commit f77ab22

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

tools/deploy_gui_shortcut.ps1

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,36 @@ $ExePath = Join-Path $CondaEnvPath "Scripts\picasso-workflow-gui.exe"
140140
# 3. Locate the icon — ask Python so editable installs work too
141141
# ---------------------------------------------------------------------------
142142
$python = Join-Path $CondaEnvPath "python.exe"
143-
$IconPath = & $python -c @"
144-
import importlib.resources, sys
143+
$RawIconPath = & $python -c @"
144+
import sys, pathlib
145+
# Strategy 1: importlib.resources (works for wheel installs)
145146
try:
147+
import importlib.resources
146148
p = importlib.resources.files('picasso_workflow').joinpath('picasso-workflow.ico')
147-
# resolve to a real filesystem path
148-
import pathlib
149-
print(str(pathlib.Path(str(p)).resolve()))
149+
r = pathlib.Path(str(p)).resolve()
150+
if r.exists():
151+
print(str(r))
152+
sys.exit(0)
150153
except Exception:
151-
sys.exit(1)
154+
pass
155+
# Strategy 2: __file__ (works for editable installs)
156+
try:
157+
import picasso_workflow
158+
r = pathlib.Path(picasso_workflow.__file__).parent / 'picasso-workflow.ico'
159+
if r.exists():
160+
print(str(r))
161+
sys.exit(0)
162+
except Exception:
163+
pass
164+
sys.exit(1)
152165
"@ 2>$null
153166

154-
if (-not $IconPath -or -not (Test-Path $IconPath)) {
167+
# Trim whitespace/newlines that Python adds to the output
168+
$IconPath = if ($RawIconPath) { $RawIconPath.Trim() } else { "" }
169+
170+
if ($IconPath -and (Test-Path $IconPath)) {
171+
Write-Host "Icon: $IconPath"
172+
} else {
155173
Write-Warning "Icon not found - shortcut will use the default Python icon."
156174
$IconPath = $ExePath
157175
}

0 commit comments

Comments
 (0)