Skip to content

Commit d710dc4

Browse files
author
kduvekot
committed
latest version of the build.py script
1 parent 3f42d7b commit d710dc4

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

build.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,13 @@ def ensure_console_log_exists(config: BuildConfig, archive_dir: Path) -> None:
143143

144144

145145
def create_7z_archive(archive_path: Path, source_dir: Path) -> None:
146-
"""Create a 7z archive from a source directory."""
146+
"""Create a 7z archive from a source directory, preserving the directory name in the archive."""
147147
print(f"Creating {archive_path.name}...")
148148
try:
149149
with py7zr.SevenZipFile(str(archive_path), 'w') as archive:
150-
# Add all contents of source_dir directly to archive (not wrapped in source_dir name)
151-
for item in source_dir.iterdir():
152-
if item.is_dir():
153-
archive.writeall(str(item), arcname=item.name)
154-
else:
155-
archive.write(str(item), arcname=item.name)
150+
# Archive the directory itself (not just its contents)
151+
# This preserves the directory name in the archive, matching shell script behavior
152+
archive.writeall(str(source_dir), arcname=source_dir.name)
156153
print(f" Successfully created {archive_path.name}")
157154
except Exception as e:
158155
print(f" Warning: Failed to create {archive_path.name}: {e}")

0 commit comments

Comments
 (0)