[fix] lower minimum Xmake version to 3.0.0

This commit is contained in:
dijunkun
2026-10-08 15:48:34 +08:00
parent 5af7cc35e9
commit f335f274ab
19 changed files with 52 additions and 49 deletions
+8 -7
View File
@@ -18,15 +18,16 @@ class XmakeSelectionTest(unittest.TestCase):
for patcher in (
patch.dict(os.environ, {}, clear=True),
patch.object(build_native.shutil, "which", return_value="/tools/xmake"),
patch.object(build_native.subprocess, "check_output", return_value="xmake v3.1.1\n"),
patch.object(build_native.subprocess, "check_output", return_value="xmake v3.0.0\n"),
):
patcher.start()
self.addCleanup(patcher.stop)
def test_path_tool_accepts_minimum_and_newer_versions(self):
for output in ("xmake v3.1.1", "xmake v3.1.2\n", "xmake v3.1.10, A build utility\n",
for output in ("xmake v3.0.0", "xmake v3.0.1\n", "xmake v3.0.9\n", "xmake v3.0.99\n",
"xmake v3.1.0\n", "xmake v3.1.1\n", "xmake v3.1.2\n", "xmake v3.1.10, A build utility\n",
"xmake v3.2.0\n", "xmake v3.10.0\n", "xmake v4.0.0\n",
"\x1b[1mxmake v3.1.1+HEAD.3ba37a0d4, A build utility\x1b[0m\n"):
"\x1b[1mxmake v3.0.0+HEAD.3ba37a0d4, A build utility\x1b[0m\n"):
with self.subTest(output=output):
build_native.subprocess.check_output.return_value = output
self.assertEqual(build_native.find_xmake(), "/tools/xmake")
@@ -40,16 +41,16 @@ class XmakeSelectionTest(unittest.TestCase):
def test_missing_tool_reports_minimum_requirement(self):
build_native.shutil.which.return_value = None
with self.assertRaisesRegex(SystemExit, "Xmake 3.1.1 or newer is required"):
with self.assertRaisesRegex(SystemExit, "Xmake 3.0.0 or newer is required"):
build_native.find_xmake()
build_native.subprocess.check_output.assert_not_called()
def test_older_or_unrecognized_versions_are_rejected(self):
for output in ("xmake v3.1.0\n", "xmake v3.0.99\n", "xmake v2.99.99\n",
"xmake version unknown\n", "xmake v3.1\n", "xmake v3.1.1invalid\n", ""):
for output in ("xmake v2.9.9\n", "xmake v2.99.99\n",
"xmake version unknown\n", "xmake v3.0\n", "xmake v3.0.0invalid\n", ""):
with self.subTest(output=output):
build_native.subprocess.check_output.return_value = output
with self.assertRaisesRegex(SystemExit, "Use Xmake 3.1.1 or newer"):
with self.assertRaisesRegex(SystemExit, "Use Xmake 3.0.0 or newer"):
build_native.find_xmake()