| 1 | # -*- coding: utf-8 -*- |
| 2 | from __future__ import unicode_literals |
| 3 | |
| 4 | import biplist |
| 5 | import os.path |
| 6 | |
| 7 | # |
| 8 | # Example settings file for dmgbuild |
| 9 | # |
| 10 | |
| 11 | # Use like this: dmgbuild -s settings.py "Test Volume" test.dmg |
| 12 | |
| 13 | # You can actually use this file for your own application (not just TextEdit) |
| 14 | # by doing e.g. |
| 15 | # |
| 16 | # dmgbuild -s settings.py -D app=/path/to/My.app "My Application" MyApp.dmg |
| 17 | |
| 18 | # .. Useful stuff .............................................................. |
| 19 | |
| 20 | application = defines.get('app', '/Applications/TextEdit.app') |
| 21 | appname = os.path.basename(application) |
| 22 | |
| 23 | def icon_from_app(app_path): |
| 24 | plist_path = os.path.join(app_path, 'Contents', 'Info.plist') |
| 25 | plist = biplist.readPlist(plist_path) |
| 26 | icon_name = plist['CFBundleIconFile'] |
| 27 | icon_root,icon_ext = os.path.splitext(icon_name) |
| 28 | if not icon_ext: |
| 29 | icon_ext = '.icns' |
| 30 | icon_name = icon_root + icon_ext |
| 31 | return os.path.join(app_path, 'Contents', 'Resources', icon_name) |
| 32 | |
| 33 | # .. Basics .................................................................... |
| 34 | |
| 35 | # Uncomment to override the output filename |
| 36 | # filename = 'test.dmg' |
| 37 | |
| 38 | # Uncomment to override the output volume name |
| 39 | # volume_name = 'Test' |
| 40 | |
| 41 | # Volume format (see hdiutil create -help) |
| 42 | format = defines.get('format', 'UDBZ') |
| 43 | |
| 44 | # Volume size (must be large enough for your files) |
| 45 | size = defines.get('size', '32M') |
| 46 | |
| 47 | # Files to include |
| 48 | files = [ application, '../User Manual.pdf' ] |
| 49 | |
| 50 | # Symlinks to create |
| 51 | symlinks = { 'Applications': '/Applications' } |
| 52 | |
| 53 | # Volume icon |
| 54 | # |
| 55 | # You can either define icon, in which case that icon file will be copied to the |
| 56 | # image, *or* you can define badge_icon, in which case the icon file you specify |
| 57 | # will be used to badge the system's Removable Disk icon |
| 58 | # |
| 59 | #icon = '/path/to/icon.icns' |
| 60 | #badge_icon = icon_from_app(application) |
| 61 | |
| 62 | # Where to put the icons |
| 63 | icon_locations = { |
| 64 | appname: (60, 75), |
| 65 | 'User Manual.pdf': (60, 210), |
| 66 | 'Applications': (230, 75) |
| 67 | } |
| 68 | |
| 69 | # .. Window configuration ...................................................... |
| 70 | |
| 71 | # Background |
| 72 | # |
| 73 | # This is a STRING containing any of the following: |
| 74 | # |
| 75 | # #3344ff - web-style RGB color |
| 76 | # #34f - web-style RGB color, short form (#34f == #3344ff) |
| 77 | # rgb(1,0,0) - RGB color, each value is between 0 and 1 |
| 78 | # hsl(120,1,.5) - HSL (hue saturation lightness) color |
| 79 | # hwb(300,0,0) - HWB (hue whiteness blackness) color |
| 80 | # cmyk(0,1,0,0) - CMYK color |
| 81 | # goldenrod - X11/SVG named color |
| 82 | # builtin-arrow - A simple built-in background with a blue arrow |
| 83 | # /foo/bar/baz.png - The path to an image file |
| 84 | # |
| 85 | # The hue component in hsl() and hwb() may include a unit; it defaults to |
| 86 | # degrees ('deg'), but also supports radians ('rad') and gradians ('grad' |
| 87 | # or 'gon'). |
| 88 | # |
| 89 | # Other color components may be expressed either in the range 0 to 1, or |
| 90 | # as percentages (e.g. 60% is equivalent to 0.6). |
| 91 | background = './background.png' |
| 92 | |
| 93 | show_status_bar = False |
| 94 | show_tab_view = False |
| 95 | show_toolbar = False |
| 96 | show_pathbar = False |
| 97 | show_sidebar = False |
| 98 | sidebar_width = 180 |
| 99 | |
| 100 | # Window position in ((x, y), (w, h)) format |
| 101 | window_rect = ((100, 100), (320, 360)) |
| 102 | |
| 103 | # Select the default view; must be one of |
| 104 | # |
| 105 | # 'icon-view' |
| 106 | # 'list-view' |
| 107 | # 'column-view' |
| 108 | # 'coverflow' |
| 109 | # |
| 110 | default_view = 'icon-view' |
| 111 | |
| 112 | # General view configuration |
| 113 | show_icon_preview = True |
| 114 | |
| 115 | # Set these to True to force inclusion of icon/list view settings (otherwise |
| 116 | # we only include settings for the default view) |
| 117 | include_icon_view_settings = True |
| 118 | include_list_view_settings = False |
| 119 | |
| 120 | # .. Icon view configuration ................................................... |
| 121 | |
| 122 | arrange_by = None |
| 123 | grid_offset = (0, 0) |
| 124 | grid_spacing = 80 |
| 125 | scroll_position = (0, 0) |
| 126 | label_pos = 'bottom' # or 'right' |
| 127 | text_size = 12 |
| 128 | icon_size = 60 |
| 129 |