Split the wine helper into it's own package.

This commit is contained in:
Storm Dragon
2026-07-31 14:29:31 -04:00
parent ddea36c211
commit ed80fb0ea7
6 changed files with 157 additions and 48 deletions
+45
View File
@@ -0,0 +1,45 @@
import unittest
from pathlib import Path
class ArchPkgbuildOptionalWineTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
repository = Path(__file__).resolve().parents[1]
cls.pkgbuilds = [
repository / "distro-packages" / "Arch-Linux" / name / "PKGBUILD"
for name in ("cthulhu", "cthulhu-git")
]
cls.helperPkgbuilds = [
repository / "distro-packages" / "Arch-Linux" / name / "PKGBUILD"
for name in ("cthulhu-wine-access", "cthulhu-wine-access-git")
]
def test_main_packages_disable_wine_helper_build(self):
for pkgbuild in self.pkgbuilds:
with self.subTest(pkgbuild=pkgbuild):
contents = pkgbuild.read_text(encoding="utf-8")
self.assertIn("-Dwine-access=disabled", contents)
def test_main_packages_do_not_depend_on_wine(self):
for pkgbuild in self.pkgbuilds:
with self.subTest(pkgbuild=pkgbuild):
contents = pkgbuild.read_text(encoding="utf-8")
dependencySection = contents.split("source=(", 1)[0]
dependencyLines = {
line.strip().strip("'")
for line in dependencySection.splitlines()
if line.strip() and not line.lstrip().startswith("#")
}
self.assertNotIn("wine", dependencyLines)
def test_optional_helper_packages_own_the_wine_dependency(self):
for pkgbuild in self.helperPkgbuilds:
with self.subTest(pkgbuild=pkgbuild):
contents = pkgbuild.read_text(encoding="utf-8")
self.assertIn("-Dwine-access=enabled", contents)
self.assertRegex(contents, r"(?m)^ wine$")
if __name__ == "__main__":
unittest.main()
+12
View File
@@ -5,6 +5,18 @@ from cthulhu.wine_access_manager import PrefixProcess, WineAccessManager
class WineAccessManagerTest(unittest.TestCase):
@mock.patch.object(WineAccessManager, "_find_helper", return_value=None)
@mock.patch.object(WineAccessManager, "discover_prefixes")
def test_poll_without_installed_helper_is_a_no_op(
self, discover_prefixes, _find_helper
):
manager = WineAccessManager(helperPath=None)
self.assertIsNone(manager.helperPath)
self.assertTrue(manager.poll())
discover_prefixes.assert_not_called()
self.assertEqual(manager.prefixes, {})
def test_prefix_prefers_explicit_wineprefix(self):
environment = {
"WINEPREFIX": "/tmp/custom-prefix",