From a88ea9fc9edc3db3031eb6400b382c8b6462a87d Mon Sep 17 00:00:00 2001 From: skyjake Date: Tue, 20 Sep 2011 13:39:10 +0300 Subject: [PATCH] Mac: Improving platform_build.py robustness Checks for wx and py2app availability in Python and unpacks the template disk image if it hasn't been decompressed yet. --- distrib/platform_release.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/distrib/platform_release.py b/distrib/platform_release.py index 66fa210aec..ac5dba7d6c 100755 --- a/distrib/platform_release.py +++ b/distrib/platform_release.py @@ -86,6 +86,15 @@ def mac_os_version(): """The Mac OS X release procedure.""" def mac_release(): + # Check Python dependencies. + try: + import wx + except ImportError: + raise Exception("Python: wx not found!") + try: + import py2app + except ImportError: + raise Exception("Python: py2app not found!") # First we need to make a release build. print "Building the release..." # Must work in the deng root for qmake (resource bundling apparently @@ -167,7 +176,11 @@ def mac_release(): masterDmg = target volumeName = "Doomsday Engine " + DOOMSDAY_VERSION - shutil.copy(SNOWBERRY_DIR + '/template-image/template.dmg', 'imaging.dmg') + templateFile = os.path.join(SNOWBERRY_DIR, 'template-image/template.dmg') + if not os.path.exists(templateFile): + print 'Template .dmg not found, trying to extract from compressed archive...' + os.system('bunzip2 -k "%s.bz2"' % templateFile) + shutil.copy(templateFile, 'imaging.dmg') remkdir('imaging') os.system('hdiutil attach imaging.dmg -noautoopen -quiet -mountpoint imaging') shutil.rmtree('imaging/Doomsday Engine.app', True)