File size: 886 Bytes
5e56bcf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import shutil
import subprocess
import sys

def clean():
    """Removes previous build artifacts."""
    for d in ["build", "dist", "upif.egg-info"]:
        if os.path.exists(d):
            shutil.rmtree(d)
    print("Cleaned build directories.")

def build():
    """Runs the setup.py build command."""
    print("Starting build process (Cython -> Wheel)...")
    try:
        # Run setup.py bdist_wheel
        subprocess.check_call([sys.executable, "setup.py", "build_ext", "--inplace"])
        subprocess.check_call([sys.executable, "setup.py", "bdist_wheel"])
        print("\nSUCCESS: Wheel created in dist/")
    except subprocess.CalledProcessError as e:
        print(f"\nERROR: Build failed: {e}")
        print("Note: You need a C compiler (MSVC on Windows, GCC on Linux) for Cython.")

def main():
    clean()
    build()

if __name__ == "__main__":
    main()