Skip to content

Instantly share code, notes, and snippets.

@paulwinex
Created March 31, 2020 15:37
Show Gist options
  • Save paulwinex/0fd7b25a9c646fba05e3ccc4c2ca6d51 to your computer and use it in GitHub Desktop.
Save paulwinex/0fd7b25a9c646fba05e3ccc4c2ca6d51 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
pyinstaller compile.spec --distpath=${PWD}/dist
# -*- mode: python -*-
import os
from PyInstaller.utils.hooks import collect_submodules
import PySide2
import ntpath
from pathlib import Path
root = Path(os.getcwd()).parent
name = 'example'
hidden = collect_submodules('pkg_resources')+['PySide2', 'Qt']
a = Analysis([Path('main.py').absolute().as_posix()],
pathex=[os.path.join(ntpath.dirname(PySide2.__file__), 'Qt', 'bin')],
binaries=[
('/lib/x86_64-linux-gnu/libc.so.6', '.')
],
datas=[],
hiddenimports=hidden,
hookspath=None,
runtime_hooks=None,
excludes=None,
win_no_prefer_redirects=None,
win_private_assemblies=None,
cipher=None)
pyz = PYZ(a.pure, a.zipped_data,
cipher=None)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
a.binaries,
name=name,
debug=False,
strip=None,
upx=True,
console=True,
icon=None
)
from Qt.QtWidgets import QMainWindow, QApplication
class Window(QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.resize(800, 600)
app = QApplication([])
w = Window()
w.show()
app.exec_()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment