Skip to content

Commit 74b061b

Browse files
committed
Fix hook_manifest_add.py
1 parent 15a6ed6 commit 74b061b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

automation/hook_manifest_add.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
import toml
77
from natsort import natsorted
88

9-
from utils import get_from_url
10-
119
base_dir = Path(__file__).parent.parent # base directory of the repository
1210

1311
hook_v2_json_path = base_dir / "metadata/hook_v2.json"
1412
hook_v3_json_path = base_dir / "metadata/hook_v3.json"
1513
offsets_toml_path = base_dir / "store/offsets"
16-
config_path = base_dir / "store"
14+
store_path = base_dir / "store"
15+
libs_path = store_path / "libs"
16+
hook_base_path = libs_path / "hook"
17+
dfhooks_base_path = libs_path / "dfhooks"
1718

1819
DEFAULT_MIRROR = "https://dfint.github.io"
1920

2021
offsets_base_url = "/update-data/store/offsets/"
21-
lib_download_base_url = "/update-data/store/libs/hook/"
22+
hook_download_base_url = "/update-data/store/libs/hook/"
2223
dfhooks_download_base_url = "/update-data/store/libs/dfhooks/"
2324
config_base_url = "/update-data/store/"
2425

@@ -58,11 +59,11 @@ def add_info_to_manifest(manifest_path: str, config_item: dict[str, Any]) -> Non
5859
manifest_path.write_text(json.dumps(hook_manifest, indent=2))
5960

6061

61-
def add_maifest_entry(hook_lib_url: str, config_file_name: str, offsets_file_name: str, dfhooks_url: str) -> None:
62-
res_hook = get_from_url(hook_lib_url)
63-
res_config = (config_path / config_file_name).read_bytes()
62+
def add_maifest_entry(hook_path: str, config_file_name: str, offsets_file_name: str, dfhooks_path: str) -> None:
63+
res_hook = (hook_base_path / hook_path).read_bytes()
64+
res_config = (store_path / config_file_name).read_bytes()
6465
res_offsets = (offsets_toml_path / offsets_file_name).read_bytes()
65-
res_dfhooks = get_from_url(dfhooks_url)
66+
res_dfhooks = (dfhooks_base_path / dfhooks_path).read_bytes()
6667

6768
offsets_data = toml.loads(res_offsets.decode(encoding="utf-8"))
6869
df_checksum = offsets_data["metadata"]["checksum"]
@@ -71,10 +72,10 @@ def add_maifest_entry(hook_lib_url: str, config_file_name: str, offsets_file_nam
7172
config_item = ConfigItem(
7273
df_checksum,
7374
payload_checksum,
74-
hook_lib_url,
75+
hook_download_base_url + hook_path,
7576
config_base_url + config_file_name,
7677
offsets_base_url + offsets_file_name,
77-
dfhooks_url,
78+
dfhooks_download_base_url + dfhooks_path,
7879
)
7980

8081
add_info_to_manifest(
@@ -116,10 +117,10 @@ def main() -> None:
116117
operating_system = Path(file_name).stem.rpartition("_")[2]
117118
lib_variant = config[operating_system]
118119
add_maifest_entry(
119-
lib_download_base_url + lib_variant["lib"],
120+
lib_variant["lib"],
120121
"config.toml",
121122
file_name,
122-
dfhooks_download_base_url + lib_variant["dfhooks"]
123+
lib_variant["dfhooks"]
123124
)
124125

125126

0 commit comments

Comments
 (0)