-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathbuild.py
More file actions
executable file
·88 lines (68 loc) · 2.05 KB
/
Copy pathbuild.py
File metadata and controls
executable file
·88 lines (68 loc) · 2.05 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python3
# coding: utf-8
"""Build script for Load QSS plugin.
Validates project structure and metadata before release.
"""
import sys
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parent
def validateMetadata():
"""Validate metadata.txt has required fields."""
metadata = ROOT_DIR / "metadata.txt"
if not metadata.exists():
print(f"Error: {metadata} not found")
return False
content = metadata.read_text(encoding="utf-8")
required = ["name", "version", "qgisMinimumVersion"]
for field in required:
if f"{field}=" not in content:
print(f"Error: metadata.txt missing '{field}'")
return False
print(" metadata.txt OK")
return True
def validateStructure():
"""Validate required files exist."""
requiredFiles = [
"__init__.py",
"LoadQSS.py",
"LoadQSSDialog.py",
"AboutQSSDialog.py",
"metadata.txt",
"images/icon.png",
]
for f in requiredFiles:
if not (ROOT_DIR / f).exists():
print(f"Error: missing {f}")
return False
print("Project structure OK")
return True
def validatePythonSyntax():
"""Check Python files for syntax errors."""
pyFiles = list[Path](ROOT_DIR.glob("*.py")) + list[Path](ROOT_DIR.glob("utils/*.py"))
for py in pyFiles:
try:
compile(py.read_text(encoding="utf-8"), str(py), "exec")
except SyntaxError as e:
print(f"Error: {py.name}: {e}")
return False
print(" Python syntax OK")
return True
def main():
"""Main build function."""
print("=" * 50)
print("Load QSS Build")
print("=" * 50)
checks = [
("Metadata", validateMetadata),
("Structure", validateStructure),
("Syntax", validatePythonSyntax),
]
for name, fn in checks:
print(f"\n[{name}]")
if not fn():
sys.exit(1)
print("\n" + "=" * 50)
print("Build completed successfully!")
print("=" * 50)
if __name__ == "__main__":
main()