1
0
forked from 0ad/0ad

Fix MacOs bundle for Python3

Update the lib used to handle plists, as dmgbuild changed things for
Python3.

Refs #5694

Differential Revision: https://code.wildfiregames.com/D3157
This was SVN commit r24282.
This commit is contained in:
wraitii 2020-11-28 10:23:06 +00:00
parent cf6aaf37a4
commit 2cfd1b9fac
4 changed files with 20 additions and 38 deletions

View File

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>0 A.D.</string>
<key>CFBundleName</key>
<string>0 A.D.</string>
</dict>
</plist>

View File

@ -181,28 +181,33 @@ cp -v ../../libraries/LICENSE.txt "${BUNDLE_RESOURCES}/LIB_LICENSE.txt"
# Create Info.plist
echo "\nCreating Info.plist\n"
alias PlistBuddy=/usr/libexec/PlistBuddy
INFO_PLIST="${BUNDLE_CONTENTS}/Info.plist"
PlistBuddy -c "Add :CFBundleName string 0 A.D." "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundleIdentifier string ${BUNDLE_IDENTIFIER}" "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundleVersion string ${BUNDLE_VERSION}" "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundlePackageType string APPL" "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundleSignature string none" "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundleExecutable string pyrogenesis" "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundleShortVersionString string ${BUNDLE_VERSION}" "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundleDevelopmentRegion string English" "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundleInfoDictionaryVersion string 6.0" "${INFO_PLIST}"
PlistBuddy -c "Add :CFBundleIconFile string 0ad" "${INFO_PLIST}"
PlistBuddy -c "Add :LSHasLocalizedDisplayName bool true" "${INFO_PLIST}"
PlistBuddy -c "Add :LSMinimumSystemVersion string ${BUNDLE_MIN_OSX_VERSION}" "${INFO_PLIST}"
PlistBuddy -c "Add :NSHumanReadableCopyright string Copyright © $(date +%Y) Wildfire Games" "${INFO_PLIST}"
# This is kind of awful but plistlib is usde by dmgbuild
# and it's very strict about what it accepts, so for now this will do.
python3 -c "import plistlib; pl = { \
'CFBundleName': '0 A.D.', \
'CFBundleIdentifier': '${BUNDLE_IDENTIFIER}', \
'CFBundleVersion': '${BUNDLE_VERSION}', \
'CFBundlePackageType': 'APPL', \
'CFBundleSignature': 'none', \
'CFBundleExecutable': 'pyrogenesis', \
'CFBundleShortVersionString': '${BUNDLE_VERSION}', \
'CFBundleDevelopmentRegion': 'English', \
'CFBundleInfoDictionaryVersion': '6.0', \
'CFBundleIconFile': '0ad', \
'LSHasLocalizedDisplayName': True, \
'LSMinimumSystemVersion': '${BUNDLE_MIN_OSX_VERSION}', \
'NSHumanReadableCopyright': 'Copyright © $(date +%Y) Wildfire Games', \
}; \
fp = open('${INFO_PLIST}', 'wb'); plistlib.dump(pl, fp); fp.close();"
# Package the app into a dmg
dmgbuild \
-s "${DMGBUILD_CONFIG}" \
-D app="${BUNDLE_OUTPUT}" \
-D background="../../build/resources/dmgbackground.png" \
-D icon="../resources/0ad.icns" \
"${BUNDLE_DMG_NAME}" "${BUNDLE_FILENAME}"

View File

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
import biplist
import os.path
#
@ -11,17 +10,6 @@ import os.path
application = defines.get('app')
def icon_from_app(app_path):
plist_path = os.path.join(app_path, 'Contents', 'Info.plist')
plist = biplist.readPlist(plist_path)
icon_name = plist['CFBundleIconFile']
icon_root,icon_ext = os.path.splitext(icon_name)
if not icon_ext:
icon_ext = '.icns'
icon_name = icon_root + icon_ext
return os.path.join(app_path, 'Contents', 'Resources', icon_name)
# .. Basics ....................................................................
# Volume format (see hdiutil create -help)
@ -42,8 +30,7 @@ symlinks = { 'Applications': '/Applications' }
# 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 = icon_from_app(application)
badge_icon = defines.get('icon')
# Where to put the icons
icon_locations = {