-
Notifications
You must be signed in to change notification settings - Fork 18
fix: portable runtime layout #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
71b2dba
b1181d7
558702b
ff74aba
5b766ca
28ce722
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -423,13 +423,11 @@ def test_populate_portable_root_copies_release_bundle_contents(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertFalse((destination_root / "astrbot-desktop-tauri.exe").exists()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue((destination_root / "WebView2Loader.dll").is_file()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| destination_root / "resources" / "backend" / "runtime-manifest.json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).is_file() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (destination_root / "resources" / "webui" / "index.html").is_file() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (destination_root / "backend" / "runtime-manifest.json").is_file() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue((destination_root / "webui" / "index.html").is_file()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertFalse((destination_root / "resources" / "backend").exists()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertFalse((destination_root / "resources" / "webui").exists()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue((destination_root / "kill-backend-processes.ps1").is_file()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue((destination_root / "portable.flag").is_file()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.assertTrue((destination_root / MODULE.PORTABLE_README_NAME).is_file()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
487
to
507
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (testing): Assert that the legacy resources/backend and resources/webui paths are not created anymore Please also have this test assert that the old
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -480,10 +478,10 @@ def test_validate_portable_root_accepts_expected_layout(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with tempfile.TemporaryDirectory() as tmpdir: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| root = Path(tmpdir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "AstrBot.exe").write_text("binary") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "resources" / "backend").mkdir(parents=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "resources" / "webui").mkdir(parents=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "resources" / "backend" / "runtime-manifest.json").write_text("{}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "resources" / "webui" / "index.html").write_text("<html></html>") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "backend").mkdir(parents=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "webui").mkdir(parents=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "backend" / "runtime-manifest.json").write_text("{}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "webui" / "index.html").write_text("<html></html>") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MODULE.validate_portable_root(root) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -498,10 +496,10 @@ def test_validate_portable_root_requires_expected_files(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_validate_portable_root_requires_top_level_exe(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with tempfile.TemporaryDirectory() as tmpdir: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| root = Path(tmpdir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "resources" / "backend").mkdir(parents=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "resources" / "webui").mkdir(parents=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "resources" / "backend" / "runtime-manifest.json").write_text("{}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "resources" / "webui" / "index.html").write_text("<html></html>") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "backend").mkdir(parents=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "webui").mkdir(parents=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "backend" / "runtime-manifest.json").write_text("{}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (root / "webui" / "index.html").write_text("<html></html>") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with self.assertRaisesRegex(ValueError, r"top-level \*\.exe"): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MODULE.validate_portable_root(root) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When packaging the backend resources, it is a good practice to exclude development artifacts like
__pycache__and compiled Python files (.pyc,.pyo). These files are not necessary for the portable runtime and can bloat the package or cause issues if they were generated with a different Python version.