Author: bugman Date: Tue Sep 6 16:11:56 2011 New Revision: 14597 URL: http://svn.gna.org/viewcvs/relax?rev=14597&view=rev Log: Created the 'scons binary_dist' target for Mac OS X. Typing 'scons binary_dist' on a Mac will now create a DMG image of a universal Mac OS X application. Modified: 1.3/scons/distrib.py Modified: 1.3/scons/distrib.py URL: http://svn.gna.org/viewcvs/relax/1.3/scons/distrib.py?rev=14597&r1=14596&r2=14597&view=diff ============================================================================== --- 1.3/scons/distrib.py (original) +++ 1.3/scons/distrib.py Tue Sep 6 16:11:56 2011 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2006 Edward d'Auvergne # +# Copyright (C) 2006-2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -22,13 +22,14 @@ # Import statements. -from os import getcwd, path, sep, system, walk +from os import getcwd, path, sep, system, waitpid, walk from re import search +from subprocess import PIPE, Popen import sys from tarfile import TarFile from zipfile import ZipFile -# relax version file. +# relax module imports. from version import version @@ -59,6 +60,8 @@ file = env['DIST_FILE'] + '.zip' elif dist_type == 'tar': file = env['DIST_FILE'] + '.tar.bz2' + elif dist_type == 'dmg': + file = env['DIST_FILE'] + '.dmg' # Print out. print(("\n\nSigning the distribution package " + repr(file) + ".\n")) @@ -91,9 +94,24 @@ file = env['DIST_FILE'] + '.zip' elif dist_type == 'tar': file = env['DIST_FILE'] + '.tar.bz2' + elif dist_type == 'dmg': + file = env['DIST_FILE'] + '.dmg' # Print out. print(("\n\nCreating the package distribution " + repr(file) + ".\n")) + + # Create the special Mac OS X DMG file and then stop execution. + if dist_type == 'dmg': + # Create the Mac OS X universal application. + pipe = Popen('python setup.py py2app', shell=True, stdin=PIPE, close_fds=False) + waitpid(pipe.pid, 0) + + # Create the dmg image. + pipe = Popen('hdiutil create -fs HFS+ -volname "relax" -srcfolder dist/relax.app %s' % file, shell=True, stdin=PIPE, close_fds=False) + waitpid(pipe.pid, 0) + + # Stop executing. + return # Open the Zip distribution file. if dist_type == 'zip':