Commit fc726b1
Hana
fix(setup): wizard install — voice template packaged + relocatable nell launcher
Two bugs surfaced during Hana's wizard validation against the
Phase 7 bundled .app:
1. install_voice_template tried to read docs/voice-drafts/nell-voice.md
from a path resolved relative to brain/setup.py — which is
correct in source-installs but FAILS in any wheel install
(the wheel ships only the brain/ package, not docs/). The
nell-example voice template threw FileNotFoundError on every
install_only path including the Phase 7 .app.
2. The pip-generated nell entry point at python-runtime/bin/nell
had its python interpreter shebang baked to an absolute path
from the build machine. The .app shipped a script that tried
to exec /Users/<builder>/.../python-runtime/bin/python3 — a
path that exists on the build machine and fails everywhere
else. Hana's traceback shows the source-tree's brain/cli.py
getting imported instead of the bundled one because the
shebang resolved to the build host's python.
Fix #1 — package the template:
* docs/voice-drafts/nell-voice.md moved to
brain/voice_templates/nell-voice.md
* brain/voice_templates/__init__.py added so it's a real
package (hatchling auto-includes everything under
brain/)
* install_voice_template reads via importlib.resources
files('brain.voice_templates').joinpath('nell-voice.md');
no repo_root parameter, no path resolution
* verified: wheel ships brain/voice_templates/nell-voice.md;
nell init --voice-template nell-example writes the file
correctly from a tmp NELLBRAIN_HOME
Fix #2 — relocatable nell launcher:
* build_python_runtime.sh post-install step replaces bin/nell
with a 6-line /bin/sh wrapper that resolves $SCRIPT_DIR via
cd "$(dirname "$0")" then execs "$SCRIPT_DIR/python3"
with a -c 'from brain.cli import main; sys.exit(main())'
payload. Whatever directory the python-runtime tree gets
copied to, bin/nell finds its own python next door
* Windows: pip's Scripts/nell.exe is already a relative-path
launcher binary, so the script keeps it untouched
* verified: bundled bin/nell runs --version from /tmp,
init --voice-template nell-example writes voice.md
Test updates:
* test_install_voice_template_nell_example_copies_packaged_file
replaces the old fake-repo-root test; asserts the canonical
nell voice opens with '## 1. Who you are' and is > 1000 bytes
* test_install_voice_template_nell_example_missing_file_raises
removed (the importlib.resources path can't fail this way
once the file ships in the wheel; ValueError on unknown
template still tested)
1470 → 1469 (one removed test). Ruff clean. macOS arm64 .app
re-bundled at ~/wizard-validation/ with codesign verify pass.1 parent 1cf3a6e commit fc726b1
5 files changed
Lines changed: 72 additions & 40 deletions
File tree
- app
- brain
- voice_templates
- tests/unit/brain
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
129 | 158 | | |
130 | 159 | | |
131 | 160 | | |
132 | | - | |
133 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
134 | 169 | | |
135 | 170 | | |
136 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
| |||
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
105 | | - | |
106 | | - | |
107 | 104 | | |
108 | 105 | | |
109 | 106 | | |
| |||
115 | 112 | | |
116 | 113 | | |
117 | 114 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
122 | 121 | | |
123 | 122 | | |
124 | 123 | | |
| |||
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
145 | 142 | | |
146 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| |||
Whitespace-only changes.
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
100 | 101 | | |
101 | | - | |
| 102 | + | |
102 | 103 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
114 | 109 | | |
115 | 110 | | |
116 | 111 | | |
| |||
0 commit comments