refactor: update packaging logic to remove local wheel path and improve dependency specifications

This commit is contained in:
2026-09-18 19:42:38 +08:00
parent 122f609156
commit 580fe84275
4 changed files with 39 additions and 22 deletions

View File

@@ -225,7 +225,7 @@ class ExtensionPackagingTest(unittest.TestCase):
):
command = call.args[0]
self.assertIn("blendjob==0.1.17", command)
self.assertIn(str(pack.SOURCE_DIR / "wheels"), command)
self.assertNotIn(str(pack.SOURCE_DIR / "wheels"), command)
self.assertIn(f"--python-version={version}", command)
self.assertIn("--implementation=cp", command)
self.assertIn(f"--platform={config.pip_platform}", command)
@@ -359,7 +359,7 @@ class ExtensionPackagingTest(unittest.TestCase):
[],
)
def test_prepare_command_defaults_to_host_and_does_not_build(self):
def test_local_flag_defaults_to_host_and_does_not_build(self):
pack = load_pack()
with (
patch.object(pack, "current_platform", return_value="windows-x64"),
@@ -368,10 +368,36 @@ class ExtensionPackagingTest(unittest.TestCase):
) as prepare,
patch.object(pack, "build_all") as build,
):
pack.main(["--prepare"])
pack.main(["-l"])
prepare.assert_called_once_with("windows-x64")
build.assert_not_called()
def test_platform_flag_builds_one_platform(self):
pack = load_pack()
with tempfile.TemporaryDirectory() as directory:
extension = Path(directory) / "AnyImage.v1.0.1.linux-x64.zip"
extension.write_bytes(b"extension")
with (
patch.object(pack, "build_extension", return_value=extension) as build,
patch.object(pack, "build_all") as build_all,
):
pack.main(["-p", "linux-x64"])
build.assert_called_once_with("linux-x64")
build_all.assert_not_called()
def test_default_command_builds_all_platforms(self):
pack = load_pack()
with tempfile.TemporaryDirectory() as directory:
extension = Path(directory) / "AnyImage.v1.0.1.windows-x64.zip"
extension.write_bytes(b"extension")
with (
patch.object(pack, "build_all", return_value=[extension]) as build_all,
patch.object(pack, "build_extension") as build_extension,
):
pack.main([])
build_all.assert_called_once_with()
build_extension.assert_not_called()
def test_detects_supported_hosts(self):
pack = load_pack()
for system, machine, expected in (