build.py 536 Bytes
import os, shutil, glob, subprocess, platform

def clean (dist=False) :
    if os.path.exists("build") :
        shutil.rmtree("build")
    if dist and os.path.exists("dist") :
        shutil.rmtree("dist")
    for path in glob.glob("*.spec") :
        os.remove(path)

icon = {"Windows" : ["--icon", "bones.ico"],
        "Darwin" : ["--icon", "bones.icns"]}
args = ["pyinstaller", "--clean", "-F", "-w"] + icon.get(platform.system(), [])

clean(True)
targets = ["bones.py", "bones_machine.py"]
subprocess.call(args + targets)
clean()