-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_setup.py
More file actions
153 lines (127 loc) · 4.37 KB
/
verify_setup.py
File metadata and controls
153 lines (127 loc) · 4.37 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env python3
"""
Setup Verification Script
Checks if all required files are present and configured correctly
"""
import sys
from pathlib import Path
def check_file(filepath, required=True):
"""Check if file exists"""
path = Path(filepath)
exists = path.exists()
status = "✓" if exists else ("✗" if required else "○")
req_str = "(required)" if required else "(optional)"
print(f"{status} {filepath} {req_str}")
return exists
def check_python_imports():
"""Check if required Python packages are installed"""
print("\nChecking Python packages:")
packages = {
"requests": True,
"geopy": True,
"tkinter": True,
}
all_present = True
for package, required in packages.items():
try:
__import__(package)
print(f"✓ {package} installed")
except ImportError:
status = "✗" if required else "○"
print(f"{status} {package} NOT installed {'(required)' if required else '(optional)'}")
if required:
all_present = False
return all_present
def check_version_consistency():
"""Check if version numbers are consistent"""
print("\nChecking version consistency:")
try:
with open("Weather.py", "r", encoding="utf-8") as f:
weather_content = f.read()
# Extract version from Weather.py
version_line = [line for line in weather_content.split('\n') if 'VERSION = ' in line]
if version_line:
version = version_line[0].split('"')[1]
print(f"✓ Weather.py version: {version}")
return True
else:
print("✗ Could not find VERSION in Weather.py")
return False
except Exception as e:
print(f"✗ Error checking version: {e}")
return False
def check_github_repo():
"""Check if GitHub repo is configured"""
print("\nChecking GitHub configuration:")
try:
with open("Weather.py", "r", encoding="utf-8") as f:
content = f.read()
if 'GITHUB_REPO = "Rog294super/Weather-App"' in content:
print("✓ GitHub repository configured: Rog294super/Weather-App")
return True
else:
print("✗ GitHub repository not properly configured")
return False
except Exception as e:
print(f"✗ Error checking GitHub config: {e}")
return False
def main():
print("=" * 60)
print("Weather Application - Setup Verification")
print("=" * 60)
# Check required files
print("\nChecking required files:")
required_files = [
"Weather.py",
"file_handler.py",
"requirements.txt",
"README.md",
"LICENSE",
".gitignore"
]
optional_files = [
"icon.ico",
"config.json",
"Weather.spec",
"Weather_Installer.spec",
"compiler.bat"
]
all_required_present = True
for file in required_files:
if not check_file(file, required=True):
all_required_present = False
print("\nChecking optional files:")
for file in optional_files:
check_file(file, required=False)
# Check Updater directory
print("\nChecking Updater directory:")
updater_files = [
"Updater/updater_final.cpp",
"Updater/compile_updater.bat"
]
for file in updater_files:
check_file(file, required=False)
# Check Python packages
packages_ok = check_python_imports()
# Check version consistency
version_ok = check_version_consistency()
# Check GitHub configuration
github_ok = check_github_repo()
# Summary
print("\n" + "=" * 60)
print("SUMMARY")
print("=" * 60)
if all_required_present and packages_ok and version_ok and github_ok:
print("✓ All checks passed! Ready to build.")
print("\nNext steps:")
print("1. Run compiler.bat to build the application")
print("2. Test the built executable")
print("3. Create a GitHub release with the built files")
return 0
else:
print("✗ Some checks failed. Please fix the issues above.")
print("\nTo install missing packages:")
print(" pip install -r requirements.txt")
return 1
if __name__ == "__main__":
sys.exit(main())