def process_common_macho(template, progress, code, rsrcname, destname, is_update, raw=0, others=[], filename=None, destroot=""): # Check that we have a filename if filename is None: raise BuildError, "Need source filename on MacOSX" # First make sure the name ends in ".app" if destname[-4:] != '.app': destname = destname + '.app' # Now deduce the short name destdir, shortname = os.path.split(destname) if shortname[-4:] == '.app': # Strip the .app suffix shortname = shortname[:-4] # And deduce the .plist and .icns names plistname = None icnsname = None if rsrcname and rsrcname[-5:] == '.rsrc': tmp = rsrcname[:-5] plistname = tmp + '.plist' if os.path.exists(plistname): icnsname = tmp + '.icns' if not os.path.exists(icnsname): icnsname = None else: plistname = None if not icnsname: dft_icnsname = os.path.join(sys.prefix, 'Resources/Python.app/Contents/Resources/PythonApplet.icns') if os.path.exists(dft_icnsname): icnsname = dft_icnsname if not os.path.exists(rsrcname): rsrcname = None if progress: progress.label('Creating bundle...') import bundlebuilder builder = bundlebuilder.AppBuilder(verbosity=0) builder.mainprogram = filename builder.builddir = destdir builder.name = shortname builder.destroot = destroot if rsrcname: realrsrcname = macresource.resource_pathname(rsrcname) builder.files.append((realrsrcname, os.path.join('Contents/Resources', os.path.basename(rsrcname)))) for o in others: if type(o) == str: builder.resources.append(o) else: builder.files.append(o) if plistname: import plistlib builder.plist = plistlib.Plist.fromFile(plistname) if icnsname: builder.iconfile = icnsname if not raw: builder.argv_emulation = 1 builder.setup() builder.build() if progress: progress.label('Done.') progress.inc(0)