import subprocess
import sys
import glob
import os
import shutil

def build_docs():
    subprocess.run( ["python", "-m", "pdoc", "-o", "./docs", "--logo", "./logo.png", "amachine/"] )

def repair_wheel():

    wheels = glob.glob("./dist/*.whl")
    
    if not wheels:
        print("No wheels found in ./dist/")
        return

    subprocess.run( ["auditwheel", "repair" ] + wheels )

    for w in wheels:
        os.remove(w)

    repaired_wheels = glob.glob("./wheelhouse/*.whl")
    for rw in repaired_wheels:
        shutil.move(rw, "./dist/")