gramps/mac/gramps_launcher.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.6 KiB
Python
Raw Normal View History

from os.path import join, dirname, abspath, normpath
from os import environ
from sys import argv, version
from platform import release
bundlepath = argv[0]
bundle_contents = join(bundlepath, "Contents")
bundle_res = join(bundle_contents, "Resources")
2023-07-31 19:10:59 +05:30
bundle_lib = join(bundle_res, "lib")
bundle_bin = join(bundle_res, "bin")
bundle_data = join(bundle_res, "share")
bundle_etc = join(bundle_res, "etc")
2023-07-31 19:10:59 +05:30
environ["XDG_DATA_DIRS"] = bundle_data
environ["DYLD_LIBRARY_PATH"] = bundle_lib
environ["LD_LIBRARY_PATH"] = bundle_lib
environ["GTK_DATA_PREFIX"] = bundle_res
environ["GTK_EXE_PREFIX"] = bundle_res
environ["GTK_PATH"] = bundle_res
2023-07-31 19:10:59 +05:30
environ["PANGO_RC_FILE"] = join(bundle_etc, "pango", "pangorc")
environ["PANGO_SYSCONFDIR"] = bundle_etc
environ["PANGO_LIBDIR"] = bundle_lib
2021-07-27 01:53:19 +05:30
environ["GIO_MODULE_DIR"] = join(bundle_lib, "gio", "modules")
environ["GDK_PIXBUF_MODULE_FILE"] = join(
bundle_lib, "gdk-pixbuf-2.0", "2.10.0", "loaders.cache"
)
environ["GI_TYPELIB_PATH"] = join(bundle_lib, "girepository-1.0")
environ["GVBINDIR"] = join(bundle_lib, "graphviz")
environ["ENCHANT_MODULE_PATH"] = join(bundle_lib, "enchant")
2023-07-31 19:10:59 +05:30
# Set $PYTHON to point inside the bundle
PYVER = "python" + version[:3]
2023-07-31 19:10:59 +05:30
environ["GRAMPSDIR"] = join(bundle_lib, PYVER, "site-packages", "gramps")
environ["GRAMPSI18N"] = join(bundle_data, "locale")
environ["GRAMPS_RESOURCES"] = bundle_data
environ["USERPROFILE"] = environ["HOME"]
environ["APPDATA"] = join(environ["HOME"], "Library", "Application Support")
environ["PATH"] = join(bundle_contents, "MacOS") + ":" + environ["PATH"]
2023-07-31 19:10:59 +05:30
if __name__ == "__main__":
__file__ = "gramps_launcher.py"
import gramps.grampsapp as app
app.main()