[gtk-mac-bundler] Add example bundle using the binary python launcher.



commit f7e475965716acec8ac87ebb57530c2b78648e57
Author: John Ralls <jralls ceridwen us>
Date:   Thu Jan 9 10:45:19 2020 -0800

    Add example bundle using the binary python launcher.

 examples/gtk_launcher.py        |  11 +--
 examples/python-launcher.bundle | 144 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 147 insertions(+), 8 deletions(-)
---
diff --git a/examples/gtk_launcher.py b/examples/gtk_launcher.py
index 2f00e9e..332c6a4 100644
--- a/examples/gtk_launcher.py
+++ b/examples/gtk_launcher.py
@@ -30,19 +30,14 @@ if int(platform.release().split('.')[0]) > 10:
                                             'gtk.immodules')
 
 os.environ['GI_TYPELIB_PATH'] = join(bundle_lib, 'girepository-1.0')
-os.environ['GVBINDIR'] = join(bundle_lib, 'graphviz')
-os.environ['ENCHANT_MODULE_PATH'] = join(bundle_lib, 'enchant')
 
 #Set $PYTHON to point inside the bundle
-PYVER = 'python3.4'
+PYVER = 'python3.6'
 sys.path.append(bundle_res)
 
-os.environ['GRAMPSDIR'] = join (bundle_lib, PYVER, 'site-packages', 'gramps')
-os.environ['GRAMPSI18N'] = join(bundle_data, 'locale')
-os.environ['GRAMPS_RESOURCES'] = bundle_data
 os.environ['USERPROFILE'] = os.environ['HOME']
 os.environ['APPDATA'] = join(os.environ['HOME'], 'Library', 'Application Support')
-print('System Path:\n','\n'.join(sys.path)) 
-import gramps.grampsapp as app
+# Replace my_app with the file or module with your main() function.
+import my_app as app
 app.main()
 
diff --git a/examples/python-launcher.bundle b/examples/python-launcher.bundle
new file mode 100644
index 0000000..4ef9702
--- /dev/null
+++ b/examples/python-launcher.bundle
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="utf-8"?>
+<app-bundle>
+
+  <meta>
+    <prefix name="default">${env:JHBUILD_PREFIX}</prefix>
+    <destination overwrite="yes">${env:HOME}/Desktop</destination>
+    <run-install-name-tool/>
+
+    <!-- Indicate the active gtk version to use. This is needed only
+        for gtk+-3.0 projects. -->
+    <gtk>gtk+-3.0</gtk>
+  </meta>
+
+  <plist>${project}/Info.plist</plist>
+  <!-- Build gramps-launcher with:
+          gcc -L$PREFIX/lib `python-config -\-cflags -\-ldflags` \
+              -o $PREFIX/bin/gramps-launcher \
+             path/to/gtk-mac-bundler/examples/python-launcher.c
+       with the obvious substitution.
+  -->
+ <main-binary>
+     ${prefix}/bin/python-launcher
+  </main-binary>
+
+  <!-- Copy in GTK+ modules. Note the use of the
+       "${pkg:module:variable}" macro, which evaluates to a pkg-config
+       variable in the specified module. Note that any libraries that
+       binaries link to are also copied in automatically.
+  -->
+  <binary>
+    ${prefix}/lib/gdk-pixbuf-2.0/${pkg:gdk-pixbuf-2.0:gdk_pixbuf_binary_version}/
+  </binary>
+<!-- Copy in the quartz input method. The rest aren't used on MacOS. -->
+  <binary>
+    ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/immodules/im-quartz.so
+  </binary>
+
+<!-- And the print backends -->
+  <binary>
+    ${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/printbackends/*.so
+  </binary>
+
+  <binary recurse="True">
+    ${prefix}/lib/python3.6/*.so
+  </binary>
+
+  <binary>
+    ${prefix}/lib/librsvg-2.2.dylib
+  </binary>
+
+  <binary>
+    ${prefix}/lib/libgtkmacintegration-gtk3.2.dylib
+  </binary>
+
+  <gir>
+    ${prefix}/share/gir-1.0/*.gir
+  </gir>
+
+<!-- Translation filenames, one for each program or library that you
+       want to copy in to the bundle. The "dest" attribute is
+       optional, as usual. Bundler will find all translations of that
+       library/program under the indicated directory and copy them.-->
+  <translations name="gtk30">
+    ${prefix}/share/locale
+  </translations>
+
+  <translations name="gtk30-properties">
+    ${prefix}/share/locale
+  </translations>
+
+  <translations name="glib20">
+    ${prefix}/share/locale
+  </translations>
+
+   <translations name="gdk-pixbuf">
+    ${prefix}/share/locale
+  </translations>
+
+  <translations name="atk10">
+    ${prefix}/share/locale
+  </translations>
+
+  <!-- This python file sets up all of the environment variables
+       needed to run your program. The example contains those
+       necessary for running a basic Gtk program. -->
+  <data dest="${bundle}/Contents/Resources">
+    ${project}/gtk_launcher.py
+  </data>
+
+  <data>
+    ${prefix}/share/glib-2.0/schemas
+  </data>
+
+  <!-- We have to pull in the python modules, which are mixed python
+       and loadable modules.  -->
+  <data recurse="True">
+    ${prefix}/lib/python3.6/*.py
+  </data>
+
+  <data>
+    ${prefix}/lib/python3.6/config-3.6m-darwin/
+  </data>
+
+  <data>
+    ${prefix}/include/python3.6m/pyconfig.h
+  </data>
+
+  <!-- Add your application's share directory, documentation
+       directory, etc. as data elements here. -->
+    
+  <!-- Copy in the themes data. You may want to trim this to save space
+       in your bundle. -->
+  <data>
+    ${prefix}/share/themes
+  </data>
+
+  <data>
+    ${prefix}/share/icons
+  </data>
+  <!-- Copy icons. Note that the .icns file is an Apple format which
+       contains up to 4 sizes of icon. You can use
+       /Developer/Applications/Utilities/Icon Composer.app to import
+       artwork and create the file.-->
+  <data dest="${bundle}/Contents/Resources">
+    ${project}/project.icns
+  </data>
+
+  <!-- Default settings file to set the theme. -->
+  <data dest="${bundle}/Contents/Resources/etc/gtk-3.0/settings.ini">
+    ${project}/settings.ini
+  </data>
+
+  <data>
+    ${prefix}/share/doc/gramps/*
+  </data>
+  
+  <data>
+    ${prefix}/share/doc/gramps/example/gedcom/sample.ged
+  </data>
+
+  <data>
+    ${prefix}/share/doc/gramps/example/gramps/*
+  </data>
+</app-bundle>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]