4e39f598a5
- LICENSE.txt (GPL-3.0-or-later), declared in the new PCM v2 metadata.json (validated against the official schema) - tools/build_package.py builds the registry-layout addon zip in dist/ plus the submission metadata copy with sha256/sizes and a release download_url derived from the Gitea homepage - tools/deploy.py: symlink/copy deploy for Linux, macOS and Windows - 64 px resources/icon.png for the PCM listing - README: Linux setup/dev commands, packaging and license sections Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
70 lines
2.4 KiB
Python
70 lines
2.4 KiB
Python
"""Deploy the plugin into the KiCad user plugins directory - all OSes.
|
|
|
|
python tools/deploy.py # symlink (dev; Windows may need
|
|
# developer mode -> use deploy.ps1)
|
|
python tools/deploy.py --copy # plain copy, no repo link
|
|
python tools/deploy.py --kicad-version 10.0
|
|
|
|
Plugin dir: Windows/macOS <Documents>/KiCad/<ver>/plugins
|
|
Linux ~/.local/share/kicad/<ver>/plugins
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import shutil
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
COPY_EXCLUDE = {".venv", ".git", "tests", "tools", "dist", "resources",
|
|
"__pycache__", ".pytest_cache", "conftest.py", "deploy.ps1",
|
|
".gitignore", "metadata.json"}
|
|
|
|
|
|
def plugins_dir(kicad_version: str) -> Path:
|
|
if sys.platform.startswith("linux"):
|
|
base = Path.home() / ".local" / "share" / "kicad"
|
|
else: # windows + macos: Documents
|
|
base = Path.home() / "Documents" / "KiCad"
|
|
return base / kicad_version / "plugins"
|
|
|
|
|
|
def main() -> int:
|
|
ap = argparse.ArgumentParser(description=__doc__)
|
|
ap.add_argument("--copy", action="store_true",
|
|
help="copy instead of symlinking the repo")
|
|
ap.add_argument("--kicad-version", default="10.0")
|
|
args = ap.parse_args()
|
|
|
|
pdir = plugins_dir(args.kicad_version)
|
|
if not pdir.is_dir():
|
|
sys.exit(f"KiCad plugins dir not found: {pdir}\n"
|
|
f"(is KiCad {args.kicad_version} installed? On Windows "
|
|
f"with a relocated Documents folder use deploy.ps1)")
|
|
dst = pdir / "fill-resistance"
|
|
|
|
if dst.is_symlink():
|
|
dst.unlink()
|
|
elif dst.exists():
|
|
shutil.rmtree(dst)
|
|
|
|
if args.copy:
|
|
shutil.copytree(
|
|
ROOT, dst,
|
|
ignore=lambda d, names: [n for n in names if n in COPY_EXCLUDE])
|
|
print(f"copied plugin to: {dst}")
|
|
else:
|
|
try:
|
|
dst.symlink_to(ROOT, target_is_directory=True)
|
|
except OSError as e:
|
|
sys.exit(f"symlink failed ({e}); on Windows enable developer "
|
|
f"mode, run elevated, or use deploy.ps1 (junction)")
|
|
print(f"symlink created: {dst} -> {ROOT}")
|
|
print("Restart KiCad (or refresh plugins) and wait for the plugin "
|
|
"venv build.")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|