Skip to content

Instantly share code, notes, and snippets.

@nobonobo
Last active June 21, 2016 02:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobonobo/5417505 to your computer and use it in GitHub Desktop.
Save nobonobo/5417505 to your computer and use it in GitHub Desktop.
メモ:py2appのコツ

Py2AppのTips

  • 直接import記述していないパッケージが取り込まれない場合がある。
  • 動作するときのsys.modulesと動作しない時のsys.modulesをよく見比べましょう。
  • pngだろうがなんだろうが、「tiff2icns」でicnsファイルは作れる。
  • OS-X内蔵Pythonはアプリ内に複製できない(py2appの仕様)ので、別途Pythonをインストールする必要がある。 (portsサンプル多いが、brewでもできたー。)

for PyQt or PySide

py2appのオプションに「qt_plugins」があるが、OS-XのMt.Lionでファイルコピーエラーになるのでこれを使わず、 以下のようなdata_files引数をsetup関数に渡すと、Qtプラグインの利用が可能になる。

QTDIR = r'/Developer/Applications/Qt/'

DATA_FILES = [
  ("../Resources/qt_plugins/phonon_backend", [QTDIR + r'/plugins/phonon_backend/libphonon_qt7.dylib']),
  ("../Resources/qt_plugins/iconengines", [QTDIR + r'/plugins/iconengines/libqsvgicon.dylib']),
  ("../Resources/qt_plugins/imageformats", [QTDIR + r'/plugins/imageformats/libqsvg.dylib']),
  ("../translations", [QTDIR + r'/translations/qt_ja.qm']),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment