mirror of
https://github.com/donlon/cloudflare-error-page.git
synced 2026-01-06 15:41:45 +00:00
18 lines
558 B
Python
18 lines
558 B
Python
import glob
|
|
import os
|
|
import shutil
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
|
|
|
|
|
class CustomBuildHook(BuildHookInterface):
|
|
def initialize(self, version: str, build_data: dict[str, Any]):
|
|
src = Path(self.root).parent.parent / 'examples' / '*.json'
|
|
dst = Path(self.root) / 'app' / 'data' / 'examples'
|
|
os.makedirs(dst, exist_ok=True)
|
|
for file in glob.glob(str(src)):
|
|
print(f'Copy {file} to {dst}')
|
|
shutil.copy(file, dst)
|