Skip to content

Commit

Permalink
Merge pull request #353 from gaphor/fancy-dmg
Browse files Browse the repository at this point in the history
Fancy DMG
  • Loading branch information
danyeaw committed Jun 25, 2020
2 parents 357674e + 5166e45 commit e0274c3
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ jobs:
run: pytest
- name: Create macOS Application
run: |
pip3 install dmgbuild
make dist
cd macos-dmg
./package.sh
Expand Down
78 changes: 78 additions & 0 deletions macos-dmg/dmgbuild-settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# You can actually use this file for your own application (not just TextEdit)
# by doing e.g.
#
# dmgbuild -s settings.py -D app=/path/to/My.app "My Application" MyApp.dmg

# .. Useful stuff ..............................................................

application = "Gaphor.app"

# .. Basics ....................................................................

# Uncomment to override the output filename
# filename = 'test.dmg'

# Uncomment to override the output volume name
# volume_name = 'Test'

# Volume format (see hdiutil create -help)
format = "UDZO"

# Files to include
files = [application]

# Symlinks to create
symlinks = {"Applications": "/Applications"}

# Volume icon
#
# You can either define icon, in which case that icon file will be copied to the
# image, *or* you can define badge_icon, in which case the icon file you specify
# will be used to badge the system's Removable Disk icon
#
# icon = '/path/to/icon.icns'
badge_icon = "gaphor.icns"

# Where to put the icons
icon_locations = {application: (140, 120), "Applications": (500, 120)}

# .. Window configuration ......................................................

# Background
#
# This is a STRING containing any of the following:
#
# #3344ff - web-style RGB color
# #34f - web-style RGB color, short form (#34f == #3344ff)
# rgb(1,0,0) - RGB color, each value is between 0 and 1
# hsl(120,1,.5) - HSL (hue saturation lightness) color
# hwb(300,0,0) - HWB (hue whiteness blackness) color
# cmyk(0,1,0,0) - CMYK color
# goldenrod - X11/SVG named color
# builtin-arrow - A simple built-in background with a blue arrow
# /foo/bar/baz.png - The path to an image file
#
# The hue component in hsl() and hwb() may include a unit; it defaults to
# degrees ('deg'), but also supports radians ('rad') and gradians ('grad'
# or 'gon').
#
# Other color components may be expressed either in the range 0 to 1, or
# as percentages (e.g. 60% is equivalent to 0.6).
background = "builtin-arrow"

# Window position in ((x, y), (w, h)) format
window_rect = ((100, 100), (640, 280))

# Select the default view; must be one of
#
# 'icon-view'
# 'list-view'
# 'column-view'
# 'coverflow'
#
default_view = "icon-view"

# .. Icon view configuration ...................................................

arrange_by = None
scroll_position = (0, 0)
12 changes: 12 additions & 0 deletions macos-dmg/package-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
#
# This wrapper for the package script contains some
# env vars, so it can build Gaphor with Python 3.8.
#
# It is intended to run from a local Mac, not CI.
#
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/python@3.8/lib"
export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig"

./package.sh
7 changes: 3 additions & 4 deletions macos-dmg/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ function log() {
echo "$*" >&2
}

rm -rf Gaphor.app Gaphor-*.dmg Gaphor-*-macos.zip
rm -rf Gaphor.app Gaphor-*.dmg


# Make a virtual env, so we are not bothered with site-packages installed on the host system

python3 -m venv --copies --prompt Gaphor.app "${APPHOME}"
source "${APPHOME}/bin/activate"

VERSION="$(poetry version | cut -d' ' -f2)"
PYVER="$(python3 -c 'import sys; print("{}.{}".format(*sys.version_info))')"
Expand Down Expand Up @@ -96,7 +95,7 @@ rm -r "${INSTALLDIR}/Frameworks/Python.framework/Versions/${PYVER}/share"

log "Installing Gaphor in ${INSTALLDIR}..."

pip3 install --no-warn-script-location ../dist/gaphor-${VERSION}-py3-none-any.whl
"${APPHOME}/bin/pip3" install --no-warn-script-location ../dist/gaphor-${VERSION}-py3-none-any.whl


echo "Fixing dynamic link dependencies..."
Expand Down Expand Up @@ -167,6 +166,6 @@ glib-compile-schemas ${INSTALLDIR}/share/glib-2.0/schemas

log "Building Gaphor-$VERSION.dmg..."

hdiutil create -srcfolder $APP Gaphor-$VERSION.dmg
dmgbuild -s dmgbuild-settings.py "Gaphor-$VERSION" "Gaphor-$VERSION.dmg"

log "Done!"

0 comments on commit e0274c3

Please sign in to comment.