def pack(): log.info(">> run pack task:") os.makedirs(libvmake.current_file('build'), exist_ok=True) # --windows-icon-from-ico=favicon.ico \ # --windows-disable-console \ # --windows-uac-admin # --nofollow-import-to # --windows-disable-console \ # --plugin-enable=multiprocessing \ libvmake.execute_cmd(f''' {python} -m nuitka --standalone \ --nofollow-imports \ --windows-disable-console \ --show-memory \ --show-progress \ --plugin-enable=pyside6 \ --include-qt-plugins=sensible \ --follow-import-to={mainlib} \ --remove-output \ --no-pyi-file \ --show-progress \ --windows-company-name={company} \ --windows-product-name={app} \ --windows-product-version={version} \ --include-data-file={libvmake.current_file('res', 'config.yml')}={os.path.join('res', 'config.yml')} \ --output-dir=build {libvmake.current_file(mainpy)} ''') if not os.path.exists( libvmake.current_file('build', f'{app}.dist', 'cefpython3')): shutil.copytree( libvmake.current_file('.venv', 'Lib', 'site-packages', 'cefpython3'), libvmake.current_file('build', f'{app}.dist', 'cefpython3'))
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 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 clean(): log.info(">> run clean task: ") if parsed_args is not None and parsed_args.dist: shutil.rmtree(libvmake.current_file('.venv'), ignore_errors=True) shutil.rmtree(libvmake.current_file('build'), ignore_errors=True)
log = logging.getLogger('vmake') # check suitable platform if sys.platform not in ['win32']: libvmake.abort("system platform is not supported") # check if running with root privilege # checkroot() # with open(libvmake.current_file('config.yml'), mode='r', encoding='utf-8') as f: # config = yaml.load(f.read(), Loader=yaml.FullLoader)['config'] parsed_args = None parser = None with open(libvmake.current_file('package.yml'), mode='r', encoding='utf-8') as f: config = yaml.load(f.read(), Loader=yaml.FullLoader) app = config['app']['name'] company = config['app']['company'] version = config['app']['version'] mainlib = f'lib{app}' mainpy = f'{app}.py' python = libvmake.get_venv_python() script_root = libvmake.current_file('.venv', 'Scripts') designer = os.path.join(script_root, 'pyside6-designer.exe') uic = os.path.join(script_root, 'pyside6-uic.exe') os.environ['PATH'] = script_root + os.path.pathsep + \