Skip to content

Commit

Permalink
Fix iesdp=>ielib import directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
burner1024 committed Jul 11, 2024
1 parent aadf9cf commit ace817c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/ie/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def dump_definition(prefix, items, structures_dir):
"""
Dump dict of items (IESDP constants, usually offsets) to iesdp.tpp in the corresponding IElib dir
@arg prefix - file format from which items are source, e.g. "EFF_V2"
@arg prefix - file format from which items are sourced, e.g. "EFF_V2"
@arg items - dict {name: value}
@arg structures_dir - path to ielib/structures
"""
Expand Down
11 changes: 11 additions & 0 deletions scripts/ie/offsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ def get_offset_prefix(file_version, data_file_name): # eff_v2 / body.yml
prefix = prefix.upper()
return prefix

def get_format_version(file_version):
'''
Get simplified file format version for usage in IELIB directory tree:
EFF_V2 => eff2
'''
base = re.sub("_v.*", "", file_version)
version = re.sub(".*_v", "", file_version)
version = version.replace(".", "")
if version == "1":
version = ""
return f"{base}{version}"

def get_offset_id(item, prefix):
"""
Expand Down
4 changes: 3 additions & 1 deletion scripts/iesdp_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
get_itemtypes,
save_itemtypes_ielib,
get_itemtypes_isense,
get_format_version,
)

yaml = ruamel.yaml.YAML(typ="rt")
Expand Down Expand Up @@ -310,7 +311,8 @@ def sanitise(self):
definition_items = {**definition_items, **new_definition_items}

pod.append_offsets(offsets, prefix)
dump_definition(prefix, definition_items, IELIB_STRUCTURES_DIR)
prefix_dir = get_format_version(ff)
dump_definition(prefix_dir, definition_items, IELIB_STRUCTURES_DIR)

# feature block
fpath = os.path.join(IESDP_FILE_FORMATS_DIR, "itm_v1", "feature_block.yml")
Expand Down

0 comments on commit ace817c

Please sign in to comment.