Initial commit
This commit is contained in:
58
install_data.py
Normal file
58
install_data.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Installation script for GitRepoSetup package data.
|
||||
Copies licenses, .gitignore, and workflows to the appdirs data directory.
|
||||
"""
|
||||
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from appdirs import user_data_dir
|
||||
|
||||
|
||||
def install_package_data():
|
||||
"""Copy package data files to appdirs location."""
|
||||
# Get source and destination directories
|
||||
repo_root = Path(__file__).parent
|
||||
data_dir = Path(user_data_dir("GitRepoSetup", "PHB"))
|
||||
|
||||
print(f"Installing package data to: {data_dir}")
|
||||
|
||||
# Create data directory
|
||||
data_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Copy licenses
|
||||
licenses_src = repo_root / "licenses"
|
||||
licenses_dst = data_dir / "licenses"
|
||||
|
||||
if licenses_src.exists():
|
||||
if licenses_dst.exists():
|
||||
shutil.rmtree(licenses_dst)
|
||||
shutil.copytree(licenses_src, licenses_dst)
|
||||
print(f"✓ Copied {len(list(licenses_dst.glob('*.txt')))} license files")
|
||||
|
||||
# Copy .gitignore
|
||||
gitignore_src = repo_root / ".gitignore"
|
||||
gitignore_dst = data_dir / ".gitignore"
|
||||
|
||||
if gitignore_src.exists():
|
||||
shutil.copy2(gitignore_src, gitignore_dst)
|
||||
print("✓ Copied .gitignore")
|
||||
|
||||
# Copy .gitea directory
|
||||
gitea_src = repo_root / ".gitea"
|
||||
gitea_dst = data_dir / ".gitea"
|
||||
|
||||
if gitea_src.exists():
|
||||
if gitea_dst.exists():
|
||||
shutil.rmtree(gitea_dst)
|
||||
shutil.copytree(gitea_src, gitea_dst)
|
||||
workflows_count = len(list((gitea_dst / "workflows").glob("*.yml")))
|
||||
print(f"✓ Copied .gitea directory with {workflows_count} workflow files")
|
||||
|
||||
print("\n✅ Package data installed successfully!")
|
||||
print(f" Location: {data_dir}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
install_package_data()
|
||||
Reference in New Issue
Block a user