Skip to content

Commit

Permalink
OSX build: Don't hardcode version/year. Set them automatically.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennda committed Feb 13, 2011
1 parent 7e29324 commit 89fc824
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 3 deletions.
60 changes: 60 additions & 0 deletions kivy/tools/packaging/osx/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>Kivy</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>*</string>
</array>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>Kivy</string>
<key>CFBundleGetInfoString</key>
<string>Kivy {{__VERSION__}} Copyright {{__YEAR__}} Kivy Maintainers</string>
<key>CFBundleIconFile</key>
<string>appIcon.icns</string>
<key>CFBundleIdentifier</key>
<string>org.kivy</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Kivy</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>{{__VERSION__}}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSEnvironment</key>
<dict/>
<key>LSHasLocalizedDisplayName</key>
<false/>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>LSUIElement</key>
<false/>
<key>NSAppleScriptEnabled</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>Kivy {{__VERSION__}} Copyright {{__YEAR__}} Kivy Maintainers</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
4 changes: 4 additions & 0 deletions kivy/tools/packaging/osx/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CFBundleName = "Kivy";
CFBundleShortVersionString = "{{__VERSION__}}";
CFBundleGetInfoString = "Kivy version {{__VERSION__}} Copyright {{__YEAR__}} Kivy Maintainers";
NSHumanReadableCopyright = "Copyright {{__YEAR__}} Kivy Maintainers.";
37 changes: 34 additions & 3 deletions kivy/tools/packaging/osx/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import shutil
import shlex
import re
import time
from urllib import urlretrieve
from urllib2 import urlopen
from subprocess import Popen, PIPE
Expand Down Expand Up @@ -41,9 +42,10 @@ def finalize_options(self):
self.dist_name + '-osx-build')

def run(self):
print "---------------------------------"
print "Building Kivy Portable for OSX"
print "---------------------------------"
intro = "Building Kivy Portable for OSX (%s)" % (self.dist_name)
print "-" * len(intro)
print intro
print "-" * len(intro)

print "\nPreparing Build..."
print "---------------------------------------"
Expand Down Expand Up @@ -144,6 +146,35 @@ def get_latest_hash():
'osx', 'kivy.sh')
shutil.copy(script, script_target)


# Write plist files with updated version & year info (for copyright)
year = time.strftime("%Y")
first = '2011'
if year != first:
year = first + '-' + year
version = self.dist_name.replace("Kivy-", "")

def write_plist(fn, target):
print "*Writing", fn
plist_template = os.path.join(self.dist_dir, 'kivy', 'tools',
'packaging', 'osx', fn)
with open(plist_template, 'r') as fd:
plist_content = fd.read()
plist_content = plist_content.replace("{{__VERSION__}}", version)
plist_content = plist_content.replace("{{__YEAR__}}", year)
with open(plist_target, 'w') as fd:
fd.write(plist_content)

fn = 'InfoPlist.strings'
plist_target = os.path.join(self.build_dir, 'portable-deps-osx', 'Kivy.app',
'Contents', 'Resources', 'English.lproj', fn)
write_plist(fn, plist_target)

fn = 'Info.plist'
plist_target = os.path.join(self.build_dir, 'portable-deps-osx', 'Kivy.app',
'Contents', fn)
write_plist(fn, plist_target)

print "*Moving examples out of app bundle to be included in disk image"
examples_target = os.path.join(self.build_dir, 'portable-deps-osx',
'examples')
Expand Down

0 comments on commit 89fc824

Please sign in to comment.