Skip to content

Commit

Permalink
Update srctools version
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed Nov 17, 2024
1 parent 7972e66 commit 1036a78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
attrs >= 21.4.0
typing_extensions >= 4.2.0
srctools >= 2.3.17
srctools >= 2.4.1
trio >= 0.24.0
pyinstaller >= 6.1.0
versioningit >= 2.1.0
13 changes: 5 additions & 8 deletions src/hammeraddons/unify_fgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ def action_import(
print('Reading FGDs:')
for path in fgd_paths:
print(path)
with RawFileSystem(str(path.parent)) as fsys:
new_fgd.parse_file(fsys, fsys[path.name], eval_bases=False)
fsys = RawFileSystem(str(path.parent))
new_fgd.parse_file(fsys, fsys[path.name], eval_bases=False)

print(f'\nImporting {len(new_fgd)} entiti{"y" if len(new_fgd) == 1 else "ies"}...')
for new_ent in new_fgd:
Expand All @@ -893,8 +893,8 @@ def action_import(

if path.exists():
old_fgd = FGD()
with RawFileSystem(str(path.parent)) as fsys:
old_fgd.parse_file(fsys, fsys[path.name], eval_bases=False)
fsys = RawFileSystem(str(path.parent))
old_fgd.parse_file(fsys, fsys[path.name], eval_bases=False)
try:
ent = old_fgd[new_ent.classname]
except KeyError:
Expand Down Expand Up @@ -1288,9 +1288,6 @@ def action_export(
print('Resource tags:')
for tag, classnames in res_tags.items():
print(f'- {tag}: {len(classnames)} ents')
else:
for ent in fgd.entities.values():
ent.resources = ()

print(f'Exporting {output_path}...')

Expand All @@ -1301,7 +1298,7 @@ def action_export(
serialise(fgd, bin_f)
else:
with open(output_path, 'w', encoding='iso-8859-1') as txt_f:
fgd.export(txt_f)
fgd.export(txt_f, custom_syntax=False)
# BEE2 compatibility, don't make it run.
if 'P2' in tags:
txt_f.write('\n// BEE 2 EDIT FLAG = 0 \n')
Expand Down

0 comments on commit 1036a78

Please sign in to comment.