refactor: update packaging logic to remove local wheel path and improve dependency specifications
This commit is contained in:
@@ -38,9 +38,6 @@ build-backend = "hatchling.build"
|
|||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
packages = ["tools"]
|
packages = ["tools"]
|
||||||
|
|
||||||
[tool.uv.sources]
|
|
||||||
blendjob = { path = "src/anyimage/wheels/blendjob-0.1.17-py3-none-any.whl" }
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
# Keep native asserts: bpy 4.5 can crash at shutdown after assertion rewriting.
|
# Keep native asserts: bpy 4.5 can crash at shutdown after assertion rewriting.
|
||||||
addopts = "--assert=plain"
|
addopts = "--assert=plain"
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class ExtensionPackagingTest(unittest.TestCase):
|
|||||||
):
|
):
|
||||||
command = call.args[0]
|
command = call.args[0]
|
||||||
self.assertIn("blendjob==0.1.17", command)
|
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(f"--python-version={version}", command)
|
||||||
self.assertIn("--implementation=cp", command)
|
self.assertIn("--implementation=cp", command)
|
||||||
self.assertIn(f"--platform={config.pip_platform}", 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()
|
pack = load_pack()
|
||||||
with (
|
with (
|
||||||
patch.object(pack, "current_platform", return_value="windows-x64"),
|
patch.object(pack, "current_platform", return_value="windows-x64"),
|
||||||
@@ -368,10 +368,36 @@ class ExtensionPackagingTest(unittest.TestCase):
|
|||||||
) as prepare,
|
) as prepare,
|
||||||
patch.object(pack, "build_all") as build,
|
patch.object(pack, "build_all") as build,
|
||||||
):
|
):
|
||||||
pack.main(["--prepare"])
|
pack.main(["-l"])
|
||||||
prepare.assert_called_once_with("windows-x64")
|
prepare.assert_called_once_with("windows-x64")
|
||||||
build.assert_not_called()
|
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):
|
def test_detects_supported_hosts(self):
|
||||||
pack = load_pack()
|
pack = load_pack()
|
||||||
for system, machine, expected in (
|
for system, machine, expected in (
|
||||||
|
|||||||
@@ -70,8 +70,6 @@ def download_wheels(platform, destination):
|
|||||||
numpy_requirement,
|
numpy_requirement,
|
||||||
"--dest",
|
"--dest",
|
||||||
str(target_directory),
|
str(target_directory),
|
||||||
"--find-links",
|
|
||||||
str(SOURCE_DIR / "wheels"),
|
|
||||||
"--only-binary=:all:",
|
"--only-binary=:all:",
|
||||||
f"--python-version={python_version}",
|
f"--python-version={python_version}",
|
||||||
"--implementation=cp",
|
"--implementation=cp",
|
||||||
@@ -217,20 +215,22 @@ def build_all():
|
|||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Prepare local dependencies or pack Blender extensions"
|
description="Pack Blender extensions or prepare local dependencies"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--prepare",
|
"-l",
|
||||||
|
"--local",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Update source wheels and Manifest for local testing",
|
help="Update source wheels and Manifest for local testing",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
"-p",
|
||||||
"--platform",
|
"--platform",
|
||||||
choices=PLATFORMS,
|
choices=PLATFORMS,
|
||||||
help="Target platform; preparation defaults to this computer",
|
help="Build one platform; --local defaults to this computer",
|
||||||
)
|
)
|
||||||
args = parser.parse_args(argv)
|
args = parser.parse_args(argv)
|
||||||
if args.prepare:
|
if args.local:
|
||||||
platform = args.platform or current_platform()
|
platform = args.platform or current_platform()
|
||||||
wheels = prepare_local_dependencies(platform)
|
wheels = prepare_local_dependencies(platform)
|
||||||
print(
|
print(
|
||||||
|
|||||||
14
uv.lock
generated
14
uv.lock
generated
@@ -40,7 +40,7 @@ dev = [
|
|||||||
|
|
||||||
[package.metadata]
|
[package.metadata]
|
||||||
requires-dist = [
|
requires-dist = [
|
||||||
{ name = "blendjob", path = "src/anyimage/wheels/blendjob-0.1.17-py3-none-any.whl" },
|
{ name = "blendjob", specifier = "==0.1.17" },
|
||||||
{ name = "numpy", specifier = ">=1.26,<2.0" },
|
{ name = "numpy", specifier = ">=1.26,<2.0" },
|
||||||
{ name = "scipy", specifier = "==1.15.3" },
|
{ name = "scipy", specifier = "==1.15.3" },
|
||||||
]
|
]
|
||||||
@@ -97,18 +97,12 @@ wheels = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "blendjob"
|
name = "blendjob"
|
||||||
version = "0.1.17"
|
version = "0.1.17"
|
||||||
source = { path = "src/anyimage/wheels/blendjob-0.1.17-py3-none-any.whl" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/bc/27/68328383ae48c33d2e9f570c9496601e266d629e72b6dbb00757c62e50a7/blendjob-0.1.17.tar.gz", hash = "sha256:fa3be5a0341a032dbc7342ae578f361c19104b3eb8106e881334631fb2443d72", size = 21699, upload-time = "2026-09-10T04:38:09.519Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ filename = "blendjob-0.1.17-py3-none-any.whl", hash = "sha256:a300ff10972953e1e930072edf33eed5e0f9342c83b30311341c7a6581c98e95" },
|
{ url = "https://files.pythonhosted.org/packages/ad/ad/42b749a762a5e49c63ee3e48f9583e310cc1a57fba68dae4332c60b36a8d/blendjob-0.1.17-py3-none-any.whl", hash = "sha256:a300ff10972953e1e930072edf33eed5e0f9342c83b30311341c7a6581c98e95", size = 27060, upload-time = "2026-09-10T04:38:08.698Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.metadata]
|
|
||||||
requires-dist = [
|
|
||||||
{ name = "fastapi", marker = "extra == 'server'", specifier = "==0.139.2" },
|
|
||||||
{ name = "uvicorn", marker = "extra == 'server'", specifier = "==0.51.0" },
|
|
||||||
]
|
|
||||||
provides-extras = ["server"]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bpy"
|
name = "bpy"
|
||||||
version = "4.5.3"
|
version = "4.5.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user