Attempt build fix to allow running from git.
This commit is contained in:
@@ -38,6 +38,13 @@ only-packages = true
|
||||
[tool.hatch.build.targets.sdist.hooks.custom]
|
||||
path = "scripts/fastapi-vue/build-frontend.py"
|
||||
|
||||
[tool.hatch.build.targets.sdist.force-include]
|
||||
"scripts/fastapi-vue/build-frontend.py" = "scripts/fastapi-vue/build-frontend.py"
|
||||
"scripts/fastapi-vue/buildutil.py" = "scripts/fastapi-vue/buildutil.py"
|
||||
|
||||
[tool.hatch.build.targets.wheel.hooks.custom]
|
||||
path = "scripts/fastapi-vue/build-frontend.py"
|
||||
|
||||
[tool.uv]
|
||||
package = true
|
||||
|
||||
|
||||
@@ -14,4 +14,21 @@ from buildutil import build
|
||||
class CustomBuildHook(BuildHookInterface):
|
||||
def initialize(self, version, build_data) -> None:
|
||||
super().initialize(version, build_data)
|
||||
build("frontend")
|
||||
root = Path(self.root)
|
||||
frontend_src = root / "frontend"
|
||||
frontend_build = root / "mediahive" / "frontend-build"
|
||||
|
||||
# When building a wheel from sdist, frontend sources may be omitted
|
||||
# while prebuilt assets are already present in mediahive/frontend-build.
|
||||
if frontend_src.exists():
|
||||
build(str(frontend_src))
|
||||
return
|
||||
|
||||
if frontend_build.exists():
|
||||
return
|
||||
|
||||
msg = (
|
||||
"Frontend build is missing. Expected either source directory "
|
||||
f"'{frontend_src}' or prebuilt assets in '{frontend_build}'."
|
||||
)
|
||||
raise RuntimeError(msg)
|
||||
|
||||
Reference in New Issue
Block a user