MCPcopy Create free account
hub / github.com/TheCSir/TerminalStart / create_extension_zip

Function create_extension_zip

scripts/package_addon.py:4–19  ·  view source on GitHub ↗
(source_dir, output_filename)

Source from the content-addressed store, hash-verified

2import os
3
4def create_extension_zip(source_dir, output_filename):
5 with zipfile.ZipFile(output_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:
6 for root, dirs, files in os.walk(source_dir):
7 # Exclude hidden directories
8 dirs[:] = [d for d in dirs if d not in ['.git', '__pycache__', '.idea', '.vscode']]
9
10 for file in files:
11 # Exclude build artifacts and system files
12 if file.endswith(('.zip', '.DS_Store')):
13 continue
14
15 file_path = os.path.join(root, file)
16 arcname = os.path.relpath(file_path, source_dir)
17 arcname = arcname.replace(os.path.sep, '/')
18 zipf.write(file_path, arcname)
19 print(f"Successfully created {output_filename}")
20
21# Paths
22base_dir = os.path.dirname(os.path.abspath(__file__))

Callers 1

package_addon.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected