diff --git a/osx/build_app.sh b/osx/build_app.sh index 94ec8b485..5b43ad022 100755 --- a/osx/build_app.sh +++ b/osx/build_app.sh @@ -12,7 +12,11 @@ glib-compile-schemas data python setup_py2app.py build python setup_py2app.py py2app +# py2app copies all Python framework to target.. +# too busy to figure out how to solve this at the moment. Let's just +# delete the files after they've been copied. rm -fr $FRAMEWORKS/Python.framework + # icon themes mkdir -p $RES/share/icons rsync -r -t --ignore-existing $INSTROOT/share/icons/Adwaita $RES/share/icons diff --git a/osx/conf.py b/osx/conf.py index f9565230e..f2918e817 100644 --- a/osx/conf.py +++ b/osx/conf.py @@ -1,6 +1,6 @@ - import os import sys +from Foundation import NSBundle __package__ = "meld" __version__ = "3.19.0" @@ -21,101 +21,73 @@ def frozen(): global DATADIR, LOCALEDIR, UNINSTALLED_SCHEMA + bundle = NSBundle.mainBundle() + resource_path = bundle.resourcePath().fileSystemRepresentation().decode("utf-8") + bundle_path = bundle.bundlePath().fileSystemRepresentation().decode("utf-8") + frameworks_path = bundle.privateFrameworksPath().fileSystemRepresentation().decode("utf-8") + executable_path = bundle.executablePath().fileSystemRepresentation().decode("utf-8") + etc_path = os.path.join(resource_path , "etc") + lib_path = os.path.join(resource_path , "lib") + share_path = os.path.join(resource_path , "share") + + # Default to Adwaita GTK Theme or override with user's environment var + gtk_theme= os.environ.get('GTK_THEME', "Adwaita") + os.environ['GTK_THEME'] = gtk_theme + + # Main libraries environment variables + #dyld_library_path = os.environ.get('DYLD_LIBRARY_PATH', '').split(':') + #dyld_library_path.insert(0, lib_path) + #dyld_library_path.insert(1, frameworks_path) + #os.environ['DYLD_LIBRARY_PATH'] = ':'.join(dyld_library_path) + #print "DYLD_LIBRARY_PATH %s" % os.environ.get('DYLD_LIBRARY_PATH', '') + + # Glib and GI environment variables + os.environ['GSETTINGS_SCHEMA_DIR'] = os.path.join( + share_path, "glib-2.0") + os.environ['GI_TYPELIB_PATH'] = os.path.join( + lib_path, "girepository-1.0") + + # Avoid GTK warnings unless user specifies otherwise + debug_gtk = os.environ.get('G_ENABLE_DIAGNOSTIC', "0") + os.environ['G_ENABLE_DIAGNOSTIC'] = debug_gtk + + # GTK environment variables + os.environ['GTK_DATA_PREFIX'] = resource_path + os.environ['GTK_EXE_PREFIX'] = resource_path + os.environ['GTK_PATH'] = resource_path + + # XDG environment variables + os.environ['XDG_CONFIG_DIRS'] = os.path.join(etc_path, "xdg") + os.environ['XDG_DATA_DIRS'] = ":".join((share_path, + os.path.join(share_path, "meld"))) + + # Pango environment variables + os.environ['PANGO_RC_FILE'] = os.path.join(etc_path, "pango", "pangorc") + os.environ['PANGO_SYSCONFDIR'] = etc_path + os.environ['PANGO_LIBDIR'] = lib_path + + # Gdk environment variables + os.environ['GDK_PIXBUF_MODULEDIR'] = os.path.join( + lib_path, "gdk-pixbuf-2.0", "2.10.0", "loaders") + #os.environ['GDK_RENDERING'] = "image" + + # Python environment variables + os.environ['PYTHONHOME'] = resource_path + original_python_path = os.environ.get('PYTHONPATH', "") + python_path = ":".join((lib_path, + os.path.join(lib_path, "python", "lib-dynload"), + os.path.join(lib_path, "python"), + original_python_path)) + os.environ['PYTHONPATH'] = python_path + + # meld specific + DATADIR = os.path.join(share_path, "meld") + LOCALEDIR = os.path.join(share_path, "mo") UNINSTALLED_SCHEMA = True - try: - from Foundation import NSBundle - bundle = NSBundle.mainBundle() - resource_path = bundle.resourcePath().fileSystemRepresentation().decode("utf-8") - bundle_path = bundle.bundlePath().fileSystemRepresentation().decode("utf-8") - frameworks_path = bundle.privateFrameworksPath().fileSystemRepresentation().decode("utf-8") - executable_path = bundle.executablePath().fileSystemRepresentation().decode("utf-8") - etc_path = os.path.join(resource_path , "etc") - lib_path = os.path.join(resource_path , "lib") - share_path = os.path.join(resource_path , "share") - - # Default to Adwaita GTK Theme or override with user's environment var - gtk_theme= os.environ.get('GTK_THEME', "Adwaita") - os.environ['GTK_THEME'] = gtk_theme - - # Main libraries environment variables - #dyld_library_path = os.environ.get('DYLD_LIBRARY_PATH', '').split(':') - #dyld_library_path.insert(0, lib_path) - #dyld_library_path.insert(1, frameworks_path) - #os.environ['DYLD_LIBRARY_PATH'] = ':'.join(dyld_library_path) - #print "DYLD_LIBRARY_PATH %s" % os.environ.get('DYLD_LIBRARY_PATH', '') - - # Glib and GI environment variables - os.environ['GSETTINGS_SCHEMA_DIR'] = os.path.join( - share_path, "glib-2.0") - os.environ['GI_TYPELIB_PATH'] = os.path.join( - lib_path, "girepository-1.0") - - # Avoid GTK warnings unless user specifies otherwise - debug_gtk = os.environ.get('G_ENABLE_DIAGNOSTIC', "0") - os.environ['G_ENABLE_DIAGNOSTIC'] = debug_gtk - - # GTK environment variables - os.environ['GTK_DATA_PREFIX'] = resource_path - os.environ['GTK_EXE_PREFIX'] = resource_path - os.environ['GTK_PATH'] = resource_path - - # XDG environment variables - os.environ['XDG_CONFIG_DIRS'] = os.path.join(etc_path, "xdg") - os.environ['XDG_DATA_DIRS'] = ":".join((share_path, - os.path.join(share_path, "meld"))) - - # Pango environment variables - os.environ['PANGO_RC_FILE'] = os.path.join(etc_path, "pango", "pangorc") - os.environ['PANGO_SYSCONFDIR'] = etc_path - os.environ['PANGO_LIBDIR'] = lib_path - - # Gdk environment variables - os.environ['GDK_PIXBUF_MODULEDIR'] = os.path.join( - lib_path, "gdk-pixbuf-2.0", "2.10.0", "loaders") - os.environ['GDK_RENDERING'] = "image" - - # Python environment variables - os.environ['PYTHONHOME'] = resource_path - original_python_path = os.environ.get('PYTHONPATH', "") - python_path = ":".join((lib_path, - os.path.join(lib_path, "python", "lib-dynload"), - os.path.join(lib_path, "python"), - original_python_path)) - os.environ['PYTHONPATH'] = python_path - - # meld specific - DATADIR = os.path.join(share_path, "meld") - LOCALEDIR = os.path.join(share_path, "mo") - - except ImportError: - print ("frozen: ImportError") - melddir = os.path.dirname(sys.executable) - DATADIR = os.path.join(melddir, "share", "meld") - LOCALEDIR = os.path.join(melddir, "share", "mo") - - # This first bit should be unnecessary, but some things (GTK icon theme - # location, GSettings schema location) don't fall back correctly. - data_dir = os.environ.get('XDG_DATA_DIRS', "/usr/local/share/:/usr/share/") - data_dir = ":".join((melddir, data_dir)) - os.environ['XDG_DATA_DIRS'] = data_dir - - def uninstalled(): - global DATADIR, LOCALEDIR, UNINSTALLED, UNINSTALLED_SCHEMA - melddir = os.path.abspath(os.path.join( - os.path.dirname(os.path.realpath(__file__)), "..")) - - DATADIR = os.path.join(melddir, "data") - LOCALEDIR = os.path.join(melddir, "build", "mo") - UNINSTALLED = True - UNINSTALLED_SCHEMA = True - - # This first bit should be unnecessary, but some things (GTK icon theme - # location, GSettings schema location) don't fall back correctly. - data_dir = os.environ.get('XDG_DATA_DIRS', "/usr/local/share/:/usr/share/") - data_dir = ":".join((melddir, data_dir)) - os.environ['XDG_DATA_DIRS'] = data_dir + # Always use frozen when building... + return frozen() def ui_file(filename): return os.path.join(DATADIR, "ui", filename)