File size: 3,634 Bytes
6d6b8af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""

Comprehensive build verification script for Codette package

"""
import os
import sys
import subprocess
from pathlib import Path

def print_section(name):
    """Print a section header"""
    print(f"\n{'='*20} {name} {'='*20}")

def check_executable():
    """Verify the executable exists and basic structure"""
    print_section("Checking Executable")
    
    exe_path = Path('dist/test_codette_exe/test_codette_exe.exe')
    if not exe_path.exists():
        print("❌ ERROR: Executable not found!")
        return False
        
    print("βœ“ Executable found")
    print(f"Size: {exe_path.stat().st_size / (1024*1024):.1f} MB")
    return True

def check_arviz_files():
    """Verify arviz static files are present"""
    print_section("Checking Arviz Files")
    
    static_path = Path('dist/test_codette_exe/arviz/static/html')
    required_file = 'icons-svg-inline.html'
    
    if not static_path.exists():
        print("❌ ERROR: Arviz static directory not found!")
        return False
        
    if not (static_path / required_file).exists():
        print(f"❌ ERROR: Required file {required_file} not found!")
        return False
        
    print("βœ“ Arviz static files present")
    return True

def check_package_structure():
    """Verify key package directories and files"""
    print_section("Checking Package Structure")
    
    required_dirs = [
        'dist/test_codette_exe',
        'dist/test_codette_exe/arviz',
        'dist/test_codette_exe/_internal'
    ]
    
    all_present = True
    for dir_path in required_dirs:
        if not os.path.exists(dir_path):
            print(f"❌ Missing directory: {dir_path}")
            all_present = False
        else:
            print(f"βœ“ Found directory: {dir_path}")
            
    return all_present

def try_launch_executable():
    """Attempt to launch the executable briefly"""
    print_section("Testing Executable Launch")
    
    exe_path = Path('dist/test_codette_exe/test_codette_exe.exe')
    if not exe_path.exists():
        print("❌ Cannot test launch - executable not found")
        return False
        
    try:
        # Start the process
        process = subprocess.Popen(
            [str(exe_path)],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        )
        
        # Wait for a short time to see if it crashes immediately
        try:
            stdout, stderr = process.communicate(timeout=2)
            # Process finished within 2 seconds - might be an error
            print("⚠ Warning: Process exited quickly")
            if stderr:
                print("Error output:")
                print(stderr.decode())
            return False
        except subprocess.TimeoutExpired:
            # Process is still running after 2 seconds - good!
            process.kill()
            print("βœ“ Executable launched successfully")
            return True
            
    except Exception as e:
        print(f"❌ Error launching executable: {e}")
        return False

def main():
    """Run all verifications"""
    print_section("BUILD VERIFICATION")
    
    checks = [
        check_executable(),
        check_arviz_files(),
        check_package_structure(),
        try_launch_executable()
    ]
    
    print_section("SUMMARY")
    total = len(checks)
    passed = sum(1 for check in checks if check)
    
    print(f"Passed {passed}/{total} checks")
    
    return 0 if all(checks) else 1

if __name__ == '__main__':
    sys.exit(main())