From 13c95d00d71e202e024f1d1195ad3db79aa9b87c Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 13 Aug 2016 15:50:39 -0700 Subject: [PATCH] Change to a binary launcher in Mac app bundles. --- mac/Info.plist | 2 ++ mac/gramps.bundle | 20 ++++++++++------- mac/gramps.launcher | 50 ------------------------------------------ mac/gramps_launcher.py | 49 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 58 deletions(-) delete mode 100755 mac/gramps.launcher create mode 100644 mac/gramps_launcher.py diff --git a/mac/Info.plist b/mac/Info.plist index e50e38dbc..cfb43a9f1 100755 --- a/mac/Info.plist +++ b/mac/Info.plist @@ -26,5 +26,7 @@ Copyright 1997 - 2016 The Gramps Team, GNU General Public License. LSMinimumSystemVersion 10.5 + GtkOSXLaunchScriptFile + gramps_launcher.py diff --git a/mac/gramps.bundle b/mac/gramps.bundle index ac3962f77..5519485dc 100644 --- a/mac/gramps.bundle +++ b/mac/gramps.bundle @@ -5,23 +5,23 @@ ${env:JHBUILD_PREFIX} ${env:HOME}/Desktop - ${project}/gramps.launcher + gtk+-3.0 ${project}/Info.plist - + - ${prefix}/bin/gramps + ${prefix}/bin/gramps-launcher - - - ${prefix}/bin/python - - + + ${project}/gramps_launcher.py + diff --git a/mac/gramps.launcher b/mac/gramps.launcher deleted file mode 100755 index 024c86944..000000000 --- a/mac/gramps.launcher +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -name="`basename $0`" -tmp="$0" -tmp=`dirname "$tmp"` -tmp=`dirname "$tmp"` -bundle=`dirname "$tmp"` -bundle_contents="$bundle"/Contents -bundle_res="$bundle_contents"/Resources -bundle_lib="$bundle_res"/lib -bundle_bin="$bundle_res"/bin -bundle_data="$bundle_res"/share -bundle_etc="$bundle_res"/etc - -export XDG_DATA_DIRS="$bundle_data" - -export PATH="$bundle_contents"/MacOS:/bin:/usr/bin -export DYLD_LIBRARY_PATH="$bundle_lib" -export LD_LIBRARY_PATH="$DYLD_LIBRARY_PATH" -export GTK_DATA_PREFIX="$bundle_res" -export GTK_EXE_PREFIX="$bundle_res" -export GTK_PATH="$bundle_res" - -export PANGO_RC_FILE="$bundle_etc/pango/pangorc" -export PANGO_SYSCONFDIR="$bundle_etc" -export PANGO_LIBDIR="$bundle_lib" -export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" -if [ `uname -r | cut -d . -f 1` -ge 10 ]; then - export GTK_IM_MODULE_FILE="$bundle_etc/gtk-3.0/gtk.immodules" -fi -export GI_TYPELIB_PATH="$bundle_lib/girepository-1.0" -export GVBINDIR="$bundle_lib/graphviz" -export ENCHANT_MODULE_PATH="$bundle_lib/enchant" - -#Set $PYTHON to point inside the bundle -PYVER=3.4 -export PYTHON="$bundle_contents/MacOS/python" -export PYTHONHOME="$bundle_res" - -export GRAMPSDIR="$bundle_lib/python$PYVER/site-packages/gramps" -export GRAMPSI18N="$bundle_data"/locale -export GRAMPS_RESOURCES="$bundle_data" -export USERPROFILE="$HOME" -export APPDATA="$HOME/Library/Application Support" - -# Strip out the argument added by the OS. -if /bin/expr "x$1" : '^x-psn_' > /dev/null; then - shift 1 -fi -exec "$PYTHON" -O "$bundle_contents/MacOS/Gramps-bin" "$@" - diff --git a/mac/gramps_launcher.py b/mac/gramps_launcher.py new file mode 100644 index 000000000..8e4f00988 --- /dev/null +++ b/mac/gramps_launcher.py @@ -0,0 +1,49 @@ +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') + +bundle_lib = join(bundle_res, 'lib') +bundle_bin = join(bundle_res, 'bin') +bundle_data = join(bundle_res, 'share') +bundle_etc = join(bundle_res, 'etc') + +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 + +environ['PANGO_RC_FILE'] = join(bundle_etc, 'pango', 'pangorc') +environ['PANGO_SYSCONFDIR'] = bundle_etc +environ['PANGO_LIBDIR'] = bundle_lib +environ['GDK_PIXBUF_MODULE_FILE'] = join(bundle_lib, 'gdk-pixbuf-2.0', + '2.10.0', 'loaders.cache') +if int(release().split('.')[0]) > 10: + environ['GTK_IM_MODULE_FILE'] = join(bundle_etc, 'gtk-3.0', + 'gtk.immodules') + +environ['GI_TYPELIB_PATH'] = join(bundle_lib, 'girepository-1.0') +environ['GVBINDIR'] = join(bundle_lib, 'graphviz') +environ['ENCHANT_MODULE_PATH'] = join(bundle_lib, 'enchant') + +#Set $PYTHON to point inside the bundle +PYVER = 'python' + version[:3] + +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'] + +import gramps.grampsapp as app +app.main() +