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-git",) ] def test_main_packages_disable_wine_helper_build(self): stableContents = self.pkgbuilds[0].read_text(encoding="utf-8") self.assertNotIn("wine-access", stableContents) gitContents = self.pkgbuilds[1].read_text(encoding="utf-8") self.assertIn("-Dwine-access=disabled", gitContents) 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_main_packages_advertise_matching_optional_helper(self): stableContents = self.pkgbuilds[0].read_text(encoding="utf-8") self.assertNotIn("cthulhu-wine-access", stableContents) gitContents = self.pkgbuilds[1].read_text(encoding="utf-8") self.assertIn( "'cthulhu-wine-access-git: Wine, Proton, NVDA Controller, and Tolk integration'", gitContents, ) self.assertNotIn("optdepends_x86_64", gitContents) def test_stable_packages_use_current_release_version(self): contents = self.pkgbuilds[0].read_text(encoding="utf-8") self.assertRegex(contents, r"(?m)^pkgver=2026\.05\.25$") 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$") def test_optional_helper_packages_disable_lto(self): for pkgbuild in self.helperPkgbuilds: with self.subTest(pkgbuild=pkgbuild): contents = pkgbuild.read_text(encoding="utf-8") self.assertRegex(contents, r"(?m)^options=\(!lto\)$") def test_git_sources_declare_git_as_a_build_dependency(self): for pkgbuild in self.pkgbuilds + self.helperPkgbuilds: with self.subTest(pkgbuild=pkgbuild): contents = pkgbuild.read_text(encoding="utf-8") self.assertIn("git+", contents) makeDependencies = contents.split("makedepends=(", 1)[1].split( ")", 1 )[0] self.assertRegex(makeDependencies, r"(?m)^ git$") if __name__ == "__main__": unittest.main()