Create comprehensive portable package
(self)
| 502 | self.build_env = build_env |
| 503 | |
| 504 | def create_portable_package(self) -> bool: |
| 505 | """Create comprehensive portable package""" |
| 506 | logger.step("Creating Portable Package") |
| 507 | |
| 508 | portable_dir = self.build_env.build_dir / f"{PROJECT_NAME}-v{VERSION}-Portable" |
| 509 | |
| 510 | try: |
| 511 | # Create portable directory |
| 512 | if portable_dir.exists(): |
| 513 | shutil.rmtree(portable_dir) |
| 514 | portable_dir.mkdir() |
| 515 | |
| 516 | # Copy core files |
| 517 | core_files = ['main.py', 'setup.py', |
| 518 | 'requirements.txt', 'README.md', '.gitignore'] |
| 519 | |
| 520 | for file in core_files: |
| 521 | src = self.build_env.build_dir / file |
| 522 | if src.exists(): |
| 523 | shutil.copy2(src, portable_dir) |
| 524 | logger.success(f"Copied: {file}") |
| 525 | |
| 526 | # Copy core module |
| 527 | core_src = self.build_env.build_dir / 'augment_tools_core' |
| 528 | if core_src.exists(): |
| 529 | shutil.copytree(core_src, portable_dir / 'augment_tools_core', |
| 530 | ignore=shutil.ignore_patterns('__pycache__', '*.pyc')) |
| 531 | logger.success("Copied: augment_tools_core/") |
| 532 | |
| 533 | # Create startup scripts |
| 534 | self._create_startup_scripts(portable_dir) |
| 535 | |
| 536 | # Create documentation |
| 537 | self._create_portable_documentation(portable_dir) |
| 538 | |
| 539 | # Create ZIP package |
| 540 | zip_path = self.build_env.dist_dir / f"{portable_dir.name}.zip" |
| 541 | with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED, |
| 542 | compresslevel=BUILD_CONFIG["compression_level"]) as zipf: |
| 543 | for root, dirs, files in os.walk(portable_dir): |
| 544 | for file in files: |
| 545 | file_path = Path(root) / file |
| 546 | arcname = file_path.relative_to(self.build_env.build_dir) |
| 547 | zipf.write(file_path, arcname) |
| 548 | |
| 549 | # Clean up temp directory |
| 550 | shutil.rmtree(portable_dir) |
| 551 | |
| 552 | size = zip_path.stat().st_size |
| 553 | logger.success(f"Portable package created: {zip_path.name} ({size:,} bytes)") |
| 554 | return True |
| 555 | |
| 556 | except Exception as e: |
| 557 | logger.error(f"Portable package creation failed: {e}") |
| 558 | return False |
| 559 | |
| 560 | def _create_startup_scripts(self, portable_dir: Path) -> None: |
| 561 | """Create platform-specific startup scripts""" |
nothing calls this directly
no test coverage detected