uninstall.sh: the video lane's empty outputs/ goes with its runtime

Every install makes ~/.local/share/qwen38-video/outputs, a lane
installed on demand and never loaded included, and uninstall.sh kept
the directory for that empty folder, with a line that called it files
the video lane did not put there (found by the install matrix: a plain
install, then ./uninstall.sh --yes, left both). The empty folder goes;
videos in it stay, as they always did, and the line says so. The new
test fails on the old code (4 of 4) and passes on the new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hasan BasbunarandClaude Opus 5.5 committed 2026-10-17 02:11:24 +02:00
1 parent b49df38ebc
commit b01b5ac2f5
2 files changed
+72 -2

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env python3
"""uninstall.sh removes the video lane's empty outputs/ folder, and says what it keeps of it.
Every install makes ~/.local/share/qwen38-video/outputs, a video lane installed on demand and
never loaded included (install-video.sh's service step). uninstall.sh removed the runtime under
it, then kept the directory for that empty folder, with a line that called it files the video
lane did not put there (found by the install matrix, 2026-10-17: a plain install, then
./uninstall.sh --yes, left both). The block runs here as uninstall.sh has it.
"""
import pathlib
import subprocess
import tempfile
import unittest
REPO = pathlib.Path(__file__).resolve().parents[1]
TEXT = (REPO / "uninstall.sh").read_text()
START = TEXT.index("# The video lane's runtime, under the same rule")
BLOCK = TEXT[START:TEXT.index("\nfi\n", START) + 4]
def run(files):
d = pathlib.Path(tempfile.mkdtemp(prefix="uninst-video-")) / "qwen38-video"
for rel in files:
p = d / rel
if rel.endswith("/"):
p.mkdir(parents=True, exist_ok=True)
else:
p.parent.mkdir(parents=True, exist_ok=True)
p.write_text("x")
d.mkdir(parents=True, exist_ok=True)
script = f'set -euo pipefail\nPRIV=0; PRIV_DONE=0; VIDEO_LANE_DIR="{d}"\n' + BLOCK + "echo BLOCK-END\n"
r = subprocess.run(["bash", "-c", script], capture_output=True, text=True, timeout=30)
return d, r.stdout + r.stderr
class TheVideoLanesFolderGoesWithIt(unittest.TestCase):
def test_a_lane_never_loaded_leaves_nothing(self):
d, out = run(["outputs/"])
self.assertFalse(d.exists(), out)
self.assertNotIn("kept", out)
self.assertIn("BLOCK-END", out)
def test_a_lane_used_and_removed_leaves_nothing_of_its_own(self):
d, out = run(["outputs/", "venv/bin/python", "sglang/setup.py", "sglang-wheel"])
self.assertFalse(d.exists(), out)
def test_the_videos_it_made_stay_and_are_said_to(self):
d, out = run(["outputs/clip.mp4", "venv/bin/python"])
self.assertTrue((d / "outputs/clip.mp4").exists())
self.assertFalse((d / "venv").exists())
self.assertIn(f"kept {d}/outputs: the videos the lane generated (delete them by hand: rm -r {d}/outputs)", out)
self.assertNotIn("did not put there", out)
def test_a_file_of_someone_else_keeps_the_folder_said_as_such(self):
d, out = run(["outputs/", "notes.txt"])
self.assertTrue((d / "notes.txt").exists())
self.assertFalse((d / "outputs").exists())
self.assertIn(f"kept {d}: it holds files the video lane did not put there", out)
if __name__ == "__main__":
unittest.main(verbosity=2)
+10 -2
View File
@@ -223,10 +223,18 @@ if [ -d "$IMAGE_LANE_DIR" ] && { [ "$PRIV" -eq 0 ] || [ "$PRIV_DONE" -eq 1 ]; };
rmdir "$IMAGE_LANE_DIR" 2>/dev/null || echo "kept $IMAGE_LANE_DIR: it holds files the image lane did not put there"
fi
# The video lane's runtime, under the same rule: only venv/, sglang/ and the notes of the wheel
# and the commit they hold, and the directory itself only once it is empty.
# and the commit they hold, and the directory itself only once it is empty. Its outputs/ folder
# goes when it is empty: every install makes it, a lane installed on demand and never loaded
# included, and it kept the directory with a line that called it someone else's (found by the
# install matrix, 2026-10-17). The videos in it stay, as they always did, and are said to.
if [ -d "$VIDEO_LANE_DIR" ] && { [ "$PRIV" -eq 0 ] || [ "$PRIV_DONE" -eq 1 ]; }; then
rm -rf "$VIDEO_LANE_DIR/venv" "$VIDEO_LANE_DIR/sglang" "$VIDEO_LANE_DIR/sglang-wheel" "$VIDEO_LANE_DIR/sglang-source"
rmdir "$VIDEO_LANE_DIR" 2>/dev/null || echo "kept $VIDEO_LANE_DIR: it holds files the video lane did not put there"
rmdir "$VIDEO_LANE_DIR/outputs" 2>/dev/null || true
if [ -d "$VIDEO_LANE_DIR/outputs" ]; then
echo "kept $VIDEO_LANE_DIR/outputs: the videos the lane generated (delete them by hand: rm -r $VIDEO_LANE_DIR/outputs)"
fi
rmdir "$VIDEO_LANE_DIR" 2>/dev/null || [ -d "$VIDEO_LANE_DIR/outputs" ] \
|| echo "kept $VIDEO_LANE_DIR: it holds files the video lane did not put there"
fi
# The speech lane's runtime, under the same rule: venv/, llama.cpp/ and the routes' script.
# Its models/ stay, with a reclaim command below, as every other checkpoint does.