-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhatch_build.py
More file actions
26 lines (19 loc) · 903 Bytes
/
hatch_build.py
File metadata and controls
26 lines (19 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Build hook to copy data files into the package before building."""
import shutil
from pathlib import Path
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class CustomBuildHook(BuildHookInterface):
"""Copy data files from root directory to package directory during build."""
def initialize(self, _version: str, _build_data: dict) -> None:
"""Copy data/config.json and shapes.json into package before building.
This ensures these files are included as package-internal data.
"""
source_directory: Path = Path(self.root)
package_directory: Path = source_directory / "roentgen"
shutil.copy2(
source_directory / "shapes.json", package_directory / "shapes.json"
)
shutil.copy2(
source_directory / "data" / "config.json",
package_directory / "config.json",
)