-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·61 lines (51 loc) · 1.43 KB
/
build.sh
File metadata and controls
executable file
·61 lines (51 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Build OpenSPP QGIS plugin for distribution
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PLUGIN_DIR="$SCRIPT_DIR/openspp_qgis"
OUTPUT_FILE="$SCRIPT_DIR/openspp_qgis.zip"
echo "Building OpenSPP QGIS Plugin..."
# Check plugin directory exists
if [ ! -d "$PLUGIN_DIR" ]; then
echo "Error: Plugin directory not found: $PLUGIN_DIR"
exit 1
fi
# Check metadata.txt exists
if [ ! -f "$PLUGIN_DIR/metadata.txt" ]; then
echo "Error: metadata.txt not found"
exit 1
fi
# Remove old build
if [ -f "$OUTPUT_FILE" ]; then
rm "$OUTPUT_FILE"
echo "Removed old build"
fi
# Clean up Python cache
find "$PLUGIN_DIR" -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find "$PLUGIN_DIR" -type f -name "*.pyc" -delete 2>/dev/null || true
# Validate Python syntax
echo "Validating Python syntax..."
for pyfile in $(find "$PLUGIN_DIR" -name "*.py"); do
python3 -m py_compile "$pyfile" || {
echo "Syntax error in: $pyfile"
exit 1
}
done
echo "All Python files valid"
# Create ZIP
cd "$SCRIPT_DIR"
zip -r "$OUTPUT_FILE" openspp_qgis \
-x "*.pyc" \
-x "*__pycache__*" \
-x "*.git*" \
-x "*.DS_Store"
# Show result
echo ""
echo "Build complete!"
echo "Output: $OUTPUT_FILE"
echo "Size: $(du -h "$OUTPUT_FILE" | cut -f1)"
echo ""
echo "To install in QGIS:"
echo " 1. Plugins → Manage and Install Plugins"
echo " 2. Install from ZIP"
echo " 3. Select: $OUTPUT_FILE"