def test():
    print(">> run test task:")
    for item in os.scandir(libvmake.current_file(mainlib, "tests")):
        if item.is_file() and item.name.startswith(
                'test_') and item.name.endswith('.py'):
            print(f"==> test {item.name}")
            libvmake.execute(f'nosetests -s {item.path}')
def init():
    libvmake.execute(
        f"{python} -m pip install --no-input --upgrade setuptools wheel")
    pip_install("nuitka")
    pip_install([
        'pylint', "pipreqs", "nose", 'build', 'ipython', 'regex', 'PyYAML',
        'pyside6', 'cefpython3'
    ])
def convertui():
    log.info(">> run convert ui task:")
    ui_dir = libvmake.current_file(mainlib, 'ui')
    ui_files = [
        os.path.join(ui_dir, x) for x in os.listdir(ui_dir)
        if x.endswith('.ui')
    ]
    for file in ui_files:
        libvmake.execute(f"{uic} {file} -o {re.sub(r'.ui$', '_ui.py', file)}")
def design():
    global designer
    log.info(">> run clean task:")
    if designer is None:
        libvmake.abort(
            "designer is not supported, you should download qt and use the designer in it"
        )
    ui_dir = libvmake.current_file(mainlib, 'ui')
    ui_files = [
        os.path.join(ui_dir, x) for x in os.listdir(ui_dir)
        if x.endswith('.ui')
    ]
    cmd = [designer]
    cmd.extend(ui_files)
    libvmake.execute(cmd)
    convertui()
def require():
    log.info(">> run requires export task:")
    libvmake.execute(f"pipreqs {mainlib} --encoding=utf-8 --force")
def tty():
    log.info(">> run tty shell:")
    libvmake.execute(python)
def pip_install(x, syspython=False):
    return libvmake.execute(
        f"{sys.executable if syspython else python} -m pip install --no-input {' '.join(x) if type(x) == list else x}"
    )
def start():
    log.info(">> run start task:")
    libvmake.execute(f'"{python}" {mainpy}')