diff --git a/extensions/botbox3000/.gitignore b/extensions/botbox3000/.gitignore index 2dbcb1d..a636b31 100644 --- a/extensions/botbox3000/.gitignore +++ b/extensions/botbox3000/.gitignore @@ -1,6 +1,9 @@ # Hidden files and directories (everything starting with .) .* +# Build output (release zips and their signatures) +dist/ + # Python cache (but keep bundled deps/) __pycache__/ *.py[cod] diff --git a/extensions/botbox3000/VERSION b/extensions/botbox3000/VERSION new file mode 100644 index 0000000..7dea76e --- /dev/null +++ b/extensions/botbox3000/VERSION @@ -0,0 +1 @@ +1.0.1 diff --git a/extensions/botbox3000/boxbot.py b/extensions/botbox3000/boxbot.py index 9a7215a..6caf86a 100644 --- a/extensions/botbox3000/boxbot.py +++ b/extensions/botbox3000/boxbot.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (C) 2026 jondale import sys from pathlib import Path diff --git a/extensions/botbox3000/livinghinge.py b/extensions/botbox3000/livinghinge.py index d73e06e..64d22aa 100644 --- a/extensions/botbox3000/livinghinge.py +++ b/extensions/botbox3000/livinghinge.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (C) 2026 jondale import sys from pathlib import Path diff --git a/extensions/botbox3000/offset.py b/extensions/botbox3000/offset.py index fc6bdf3..c382491 100644 --- a/extensions/botbox3000/offset.py +++ b/extensions/botbox3000/offset.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (C) 2026 jondale import math diff --git a/extensions/botbox3000/package.sh b/extensions/botbox3000/package.sh new file mode 100755 index 0000000..e291e28 --- /dev/null +++ b/extensions/botbox3000/package.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +# Build a distributable Inkscape extension zip at dist/boxbot-.zip +# +# Usage: +# ./package.sh [version] [--sign] +# +# version Set the version explicitly (used as-is, no bump). Saved to VERSION. +# With no version, the patch number in VERSION is incremented (x.y.Z+1). +# --sign Also produce a detached GPG signature (dist/boxbot-.zip.sig). +# +# The zip bundles only the extension's own files in a boxbot/ folder. It does +# NOT include deps/ — the extension falls back to the inkex shipped with +# Inkscape (the sys.path shim is a no-op when deps/ is absent). +set -euo pipefail + +repo_root="$(cd "$(dirname "$0")" && pwd)" +cd "$repo_root" + +# Files that go into the package (allowlist: anything not here is excluded). +files="boxbot.inx boxbot.py offset.py placements.py livinghinge.py LICENSE README.md" +pkg="boxbot" + +# Increment the patch component of a MAJOR.MINOR.PATCH version string. +bump_patch() { + local major minor patch + IFS='.' read -r major minor patch <<< "$1" + printf '%s.%s.%s' "${major:-0}" "${minor:-0}" "$(( ${patch:-0} + 1 ))" +} + +version="" +sign=0 +while [ $# -gt 0 ]; do + case "$1" in + --sign) sign=1 ;; + -*) echo "error: unknown option: $1" >&2; exit 1 ;; + *) version="$1" ;; + esac + shift +done + +if [ -z "$version" ]; then + current="$(cat VERSION 2>/dev/null || true)" + [ -n "$current" ] || { echo "error: no VERSION file to increment" >&2; exit 1; } + version="$(bump_patch "$current")" +fi + +# Persist so the next run increments from here. +printf '%s\n' "$version" > VERSION + +stage="$(mktemp -d)" +trap 'rm -rf "$stage"' EXIT +mkdir -p "$stage/$pkg" +for f in $files; do + [ -f "$f" ] || { echo "error: missing file: $f" >&2; exit 1; } + cp "$f" "$stage/$pkg/" +done + +mkdir -p dist +out="dist/boxbot-${version}.zip" +rm -f "$out" +( cd "$stage" && zip -rq "$repo_root/$out" "$pkg" ) + +if [ "$sign" -eq 1 ]; then + rm -f "$out.sig" + gpg --output "$out.sig" --detach-sign "$out" + echo "signed -> $out.sig" +fi + +echo "built $out" +unzip -l "$out" diff --git a/extensions/botbox3000/placements.py b/extensions/botbox3000/placements.py index e850688..93f3431 100644 --- a/extensions/botbox3000/placements.py +++ b/extensions/botbox3000/placements.py @@ -1,4 +1,6 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (C) 2026 jondale import sys from pathlib import Path