Skip to content

Commit

Permalink
Builder: Merged changes for Snowberry packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 26, 2012
1 parent e6ea638 commit 0d159f4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 31 deletions.
82 changes: 51 additions & 31 deletions distrib/platform_release.py
Expand Up @@ -95,6 +95,7 @@ def prepare_work_dir():


def mac_os_version():
"""Determines the Mac OS version."""
return platform.mac_ver()[0][:4]


Expand All @@ -105,38 +106,11 @@ def output_filename(ext=''):
return 'doomsday_' + DOOMSDAY_VERSION_FULL + "_" + DOOMSDAY_BUILD + ext


def mac_release():
"""The Mac OS X release procedure."""
def mac_able_to_package_snowberry():
return mac_os_version() == '10.5'

# 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
# fails otherwise).
MAC_WORK_DIR = os.path.abspath(os.path.join(DOOMSDAY_DIR, '../macx_release_build'))
remkdir(MAC_WORK_DIR)
os.chdir(MAC_WORK_DIR)
if os.system('qmake -r -spec macx-g++ CONFIG+=release DENG_BUILD=%s ' % (DOOMSDAY_BUILD_NUMBER) +
'../doomsday/doomsday.pro && make -w ' +
'&& ../doomsday/build/mac/bundleapp.sh ../doomsday'):
raise Exception("Failed to build from source.")

# Now we can proceed to packaging.
target = os.path.join(OUTPUT_DIR, output_filename('.dmg'))
try:
os.remove(target)
print 'Removed existing target file', target
except:
print 'Target:', target

def mac_package_snowberry():
os.chdir(SNOWBERRY_DIR)
remkdir('dist')
remkdir('build')
Expand Down Expand Up @@ -182,10 +156,56 @@ def mac_release():
f.write(DOOMSDAY_VERSION_FULL)
f.close()
os.system('python buildapp.py py2app')

# Share it.
duptree('dist/Doomsday Engine.app', 'shared/Doomsday Engine.app')


def mac_release():
"""The Mac OS X release procedure."""

# Package Snowberry or acquire the shared package.
if mac_able_to_package_snowberry():
# 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!")

mac_package_snowberry()
sbLoc = '/dist/Doomsday Engine.app'
else:
# Wait until the updated packaged SB has been shared.
time.sleep(5 * 60)
sbLoc = '/shared/Doomsday Engine.app'

# First we need to make a release build.
print "Building the release..."
# Must work in the deng root for qmake (resource bundling apparently
# fails otherwise).
MAC_WORK_DIR = os.path.abspath(os.path.join(DOOMSDAY_DIR, '../macx_release_build'))
remkdir(MAC_WORK_DIR)
os.chdir(MAC_WORK_DIR)
if os.system('qmake -r -spec macx-g++ CONFIG+=release DENG_BUILD=%s ' % (DOOMSDAY_BUILD_NUMBER) +
'../doomsday/doomsday.pro && make -w ' +
'&& ../doomsday/build/mac/bundleapp.sh ../doomsday'):
raise Exception("Failed to build from source.")

# Now we can proceed to packaging.
target = os.path.join(OUTPUT_DIR, output_filename('.dmg'))
try:
os.remove(target)
print 'Removed existing target file', target
except:
print 'Target:', target

# Back to the normal work dir.
os.chdir(WORK_DIR)
copytree(SNOWBERRY_DIR + '/dist/Doomsday Engine.app', 'Doomsday Engine.app')
copytree(SNOWBERRY_DIR + sbLoc, 'Doomsday Engine.app')

print 'Coping release binaries into the launcher bundle.'
duptree(os.path.join(MAC_WORK_DIR, 'engine/Doomsday.app'), 'Doomsday Engine.app/Contents/Doomsday.app')
Expand Down
2 changes: 2 additions & 0 deletions snowberry/.gitignore
Expand Up @@ -3,3 +3,5 @@ build
dist
VERSION
*.pyc
shared

0 comments on commit 0d159f4

Please sign in to comment.