| import os | |
| import zipfile | |
| import tarfile | |
| import shutil | |
| # --- Config --- | |
| DART_ZIP_PATH = "./DART.zip" | |
| OUTPUT_DIR = "./" | |
| TEMP_DART_DIR = os.path.join(OUTPUT_DIR, "__extracted_dart__") | |
| # --- Step 1: Extract DART.zip into temp --- | |
| print("📦 Extracting DART.zip...") | |
| with zipfile.ZipFile(DART_ZIP_PATH, "r") as zip_ref: | |
| zip_ref.extractall(TEMP_DART_DIR) | |
| # --- Step 2: Move contents of extracted DART folder to root --- | |
| print("🚚 Moving DART contents to script root...") | |
| dart_inner = os.path.join(TEMP_DART_DIR, "DART") | |
| if not os.path.exists(dart_inner): | |
| raise RuntimeError("❌ 'DART' folder not found inside the zip file.") | |
| for item in os.listdir(dart_inner): | |
| src = os.path.join(dart_inner, item) | |
| dst = os.path.join(OUTPUT_DIR, item) | |
| if os.path.exists(dst): | |
| print(f"⚠️ Skipping existing: {dst}") | |
| continue | |
| shutil.move(src, dst) | |
| print(f"✅ Moved: {item}") | |
| # --- Step 3: Cleanup --- | |
| print("🧹 Cleaning up temporary folders...") | |
| shutil.rmtree(TEMP_DART_DIR) | |
| print("\n✅ Setup complete. DART is now extracted into the project root.") | |