def save(self, destresfile=None): if self.mode <> 'w': raise error, "can't save font: no write permission" self._buildfontassociationtable() self._buildoffsettable() self._buildboundingboxtable() self._buildglyphwidthtable() self._buildkerningtables() self._buildstylemappingtable() self._buildglyphencodingsubtable() rawnames = [ "_rawheader", "_rawfontassociationtable", "_rawoffsettable", "_rawglyphwidthtable", "_rawstylemappingtable", "_rawglyphencodingsubtable", "_rawkerningtables" ] for name in rawnames[1:]: # skip header data = getattr(self, name) if len(data) & 1: setattr(self, name, data + '\0') self.ffWTabOff = FONDheadersize + len( self._rawfontassociationtable) + len(self._rawoffsettable) self.ffStylOff = self.ffWTabOff + len(self._rawglyphwidthtable) self.ffKernOff = self.ffStylOff + len( self._rawstylemappingtable) + len(self._rawglyphencodingsubtable) self.glyphTableOffset = len(self._rawstylemappingtable) if not self._rawglyphwidthtable: self.ffWTabOff = 0 if not self._rawstylemappingtable: self.ffStylOff = 0 if not self._rawglyphencodingsubtable: self.glyphTableOffset = 0 if not self._rawkerningtables: self.ffKernOff = 0 self._buildheader() # glyphTableOffset has only just been calculated self._updatestylemappingtable() newdata = "" for name in rawnames: newdata = newdata + getattr(self, name) if destresfile is None: self.FOND.data = newdata self.FOND.ChangedResource() self.FOND.WriteResource() else: ID, type, name = self.FOND.GetResInfo() self.FOND.DetachResource() self.FOND.data = newdata saveref = Res.CurResFile() Res.UseResFile(destresfile) self.FOND.AddResource(type, ID, name) Res.UseResFile(saveref) self.changed = 0
def menu_save(self): if not self.path: self.menu_save_as() return # Will call us recursively # # First save data # dhandle = self.ted.WEGetText() data = dhandle.data fp = open(self.path, 'wb') # NOTE: wb, because data has CR for end-of-line fp.write(data) if data[-1] <> '\r': fp.write('\r') fp.close() # # Now save style and soup # oldresfile = Res.CurResFile() try: rf = Res.FSpOpenResFile(self.path, 3) except Res.Error: Res.FSpCreateResFile(self.path, '????', 'TEXT', macfs.smAllScripts) rf = Res.FSpOpenResFile(self.path, 3) styles = Res.Resource('') soup = Res.Resource('') self.ted.WECopyRange(0, 0x3fffffff, None, styles, soup) styles.AddResource('styl', 128, '') soup.AddResource('SOUP', 128, '') Res.CloseResFile(rf) Res.UseResFile(oldresfile) self.ted.WEResetModCount()
def mergecfmfiles(srclist, dst, architecture='fat'): """Merge all files in srclist into a new file dst. If architecture is given, only code fragments of that type will be used: "pwpc" for PPC, "m68k" for cfm68k. This does not work for "classic" 68k code, since it does not use code fragments to begin with. If architecture is None, all fragments will be used, enabling FAT binaries. """ srclist = list(srclist) for i in range(len(srclist)): srclist[i] = Carbon.File.pathname(srclist[i]) dst = Carbon.File.pathname(dst) dstfile = open(dst, "wb") rf = Res.FSpOpenResFile(dst, 3) try: dstcfrg = CfrgResource() for src in srclist: srccfrg = CfrgResource(src) for frag in srccfrg.fragments: if frag.architecture == 'pwpc' and architecture == 'm68k': continue if frag.architecture == 'm68k' and architecture == 'pwpc': continue dstcfrg.append(frag) frag.copydata(dstfile) cfrgres = Res.Resource(dstcfrg.build()) Res.UseResFile(rf) cfrgres.AddResource('cfrg', 0, "") finally: dstfile.close() rf = Res.CloseResFile(rf)
def readLWFN(path, onlyHeader=0): """reads an LWFN font file, returns raw data""" resRef = Res.FSOpenResFile(path, 1) # read-only try: Res.UseResFile(resRef) n = Res.Count1Resources('POST') data = [] for i in range(501, 501 + n): res = Res.Get1Resource('POST', i) code = ord(res.data[0]) if ord(res.data[1]) <> 0: raise T1Error, 'corrupt LWFN file' if code in [1, 2]: if onlyHeader and code == 2: break data.append(res.data[2:]) elif code in [3, 5]: break elif code == 4: f = open(path, "rb") data.append(f.read()) f.close() elif code == 0: pass # comment, ignore else: raise T1Error, 'bad chunk code: ' + ` code ` finally: Res.CloseResFile(resRef) data = string.join(data, '') assertType1(data) return data
def mergecfmfiles(srclist, dst, architecture='fat'): srclist = list(srclist) for i in range(len(srclist)): srclist[i] = Carbon.File.pathname(srclist[i]) dst = Carbon.File.pathname(dst) dstfile = open(dst, 'wb') rf = Res.FSpOpenResFile(dst, 3) try: dstcfrg = CfrgResource() for src in srclist: srccfrg = CfrgResource(src) for frag in srccfrg.fragments: if frag.architecture == 'pwpc' and architecture == 'm68k': continue if frag.architecture == 'm68k' and architecture == 'pwpc': continue dstcfrg.append(frag) frag.copydata(dstfile) cfrgres = Res.Resource(dstcfrg.build()) Res.UseResFile(rf) cfrgres.AddResource('cfrg', 0, '') finally: dstfile.close() rf = Res.CloseResFile(rf)
def copyres(input, output, skiptypes, skipowner, progress=None): ctor = None alltypes = [] Res.UseResFile(input) ntypes = Res.Count1Types() progress_type_inc = 50 / ntypes for itype in range(1, 1 + ntypes): type = Res.Get1IndType(itype) if type in skiptypes: continue alltypes.append(type) nresources = Res.Count1Resources(type) progress_cur_inc = progress_type_inc / nresources for ires in range(1, 1 + nresources): res = Res.Get1IndResource(type, ires) id, type, name = res.GetResInfo() lcname = string.lower(name) if lcname == OWNERNAME and id == 0: if skipowner: continue else: ctor = type size = res.size attrs = res.GetResAttrs() if progress: progress.label('Copy %s %d %s' % (type, id, name)) progress.inc(progress_cur_inc) res.LoadResource() res.DetachResource() Res.UseResFile(output) try: res2 = Res.Get1Resource(type, id) except MacOS.Error: res2 = None if res2: if progress: progress.label('Overwrite %s %d %s' % (type, id, name)) progress.inc(0) res2.RemoveResource() res.AddResource(type, id, name) res.WriteResource() attrs = attrs | res.GetResAttrs() res.SetResAttrs(attrs) Res.UseResFile(input) return (alltypes, ctor)
def __init__(self, path=None): self.version = 1 self.fragments = [] self.path = path if path is not None and os.path.exists(path): currentresref = Res.CurResFile() resref = Res.FSpOpenResFile(path, 1) Res.UseResFile(resref) try: try: data = Res.Get1Resource('cfrg', 0).data except Res.Error: raise Res.Error, "no 'cfrg' resource found", sys.exc_traceback finally: Res.CloseResFile(resref) Res.UseResFile(currentresref) self.parse(data) if self.version != 1: raise error, "unknown 'cfrg' resource format"
def getSFNTResIndices(path): """Determine whether a file has a resource fork or not.""" try: resref = MyOpenResFile(path) except Res.Error: return [] Res.UseResFile(resref) numSFNTs = Res.Count1Resources('sfnt') Res.CloseResFile(resref) return list(range(1, numSFNTs + 1))
def __init__(self, path, res_name_or_index): resref = MyOpenResFile(path) Res.UseResFile(resref) if isinstance(res_name_or_index, basestring): res = Res.Get1NamedResource('sfnt', res_name_or_index) else: res = Res.Get1IndResource('sfnt', res_name_or_index) self.file = StringIO(res.data) Res.CloseResFile(resref) self.name = path
def __init__(self, path, res_name_or_index): resref = MyOpenResFile(path) Res.UseResFile(resref) if type(res_name_or_index) == type(""): res = Res.Get1NamedResource('sfnt', res_name_or_index) else: res = Res.Get1IndResource('sfnt', res_name_or_index) self.file = cStringIO.StringIO(res.data) Res.CloseResFile(resref) self.name = path
def readPlistFromResource(path, restype='plst', resid=0): """Read plst resource from the resource fork of path. """ from Carbon.File import FSRef, FSGetResourceForkName from Carbon.Files import fsRdPerm from Carbon import Res fsRef = FSRef(path) resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdPerm) Res.UseResFile(resNum) plistData = Res.Get1Resource(restype, resid).data Res.CloseResFile(resNum) return readPlistFromString(plistData)
def readwindowsettings(self): try: resref = Res.FSpOpenResFile(self.path, 1) except Res.Error: return try: Res.UseResFile(resref) data = Res.Get1Resource('PyWS', 128) self.settings = marshal.loads(data.data) except: pass Res.CloseResFile(resref)
def readPlistFromResource(path, restype='plst', resid=0): warnings.warnpy3k('In 3.x, readPlistFromResource is removed.', stacklevel=2) from Carbon.File import FSRef, FSGetResourceForkName from Carbon.Files import fsRdPerm from Carbon import Res fsRef = FSRef(path) resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdPerm) Res.UseResFile(resNum) plistData = Res.Get1Resource(restype, resid).data Res.CloseResFile(resNum) return readPlistFromString(plistData)
def writeestr(dst, edict): """Create Estr resource file given a dictionary of errors.""" os.unlink(dst.as_pathname()) Res.FSpCreateResFile(dst, 'RSED', 'rsrc', smAllScripts) output = Res.FSpOpenResFile(dst, WRITE) Res.UseResFile(output) for num in edict.keys(): res = Res.Resource(Pstring(edict[num][0])) res.AddResource('Estr', num, '') res.WriteResource() Res.CloseResFile(output)
def __init__(self, path, mode='r'): if mode == 'r': permission = 1 # read only elif mode == 'w': permission = 3 # exclusive r/w else: raise error, 'mode should be either "r" or "w"' self.mode = mode self.resref = Res.FSOpenResFile(path, permission) Res.UseResFile(self.resref) self.path = path self.fonds = [] self.getFONDs()
def __init__(self, path, mode='r'): import macfs if mode == 'r': permission = 1 # read only elif mode == 'w': permission = 3 # exclusive r/w else: raise error('mode should be either "r" or "w"') self.mode = mode fss = macfs.FSSpec(path) self.resref = Res.FSpOpenResFile(fss, permission) Res.UseResFile(self.resref) self.path = path self.fonds = [] self.getFONDs()
def dataFromFile(pathOrFSSpec, nameOrID="", resType='NFNT'): from Carbon import Res resref = Res.FSOpenResFile(pathOrFSSpec, 1) # readonly try: Res.UseResFile(resref) if not nameOrID: # just take the first in the file res = Res.Get1IndResource(resType, 1) elif type(nameOrID) == types.IntType: res = Res.Get1Resource(resType, nameOrID) else: res = Res.Get1NamedResource(resType, nameOrID) theID, theType, name = res.GetResInfo() data = res.data finally: Res.CloseResFile(resref) return data
def writewindowsettings(self): try: resref = Res.FSpOpenResFile(self.path, 3) except Res.Error: Res.FSpCreateResFile(self.path, self._creator, 'TEXT', smAllScripts) resref = Res.FSpOpenResFile(self.path, 3) try: data = Res.Resource(marshal.dumps(self.settings)) Res.UseResFile(resref) try: temp = Res.Get1Resource('PyWS', 128) temp.RemoveResource() except Res.Error: pass data.AddResource('PyWS', 128, "window settings") finally: Res.UpdateResFile(resref) Res.CloseResFile(resref)
def writePlistToResource(rootObject, path, restype='plst', resid=0): warnings.warnpy3k('In 3.x, writePlistToResource is removed.', stacklevel=2) from Carbon.File import FSRef, FSGetResourceForkName from Carbon.Files import fsRdWrPerm from Carbon import Res plistData = writePlistToString(rootObject) fsRef = FSRef(path) resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdWrPerm) Res.UseResFile(resNum) try: Res.Get1Resource(restype, resid).RemoveResource() except Res.Error: pass res = Res.Resource(plistData) res.AddResource(restype, resid, '') res.WriteResource() Res.CloseResFile(resNum)
def writePlistToResource(rootObject, path, restype='plst', resid=0): """Write 'rootObject' as a plst resource to the resource fork of path. """ from Carbon.File import FSRef, FSGetResourceForkName from Carbon.Files import fsRdWrPerm from Carbon import Res plistData = writePlistToString(rootObject) fsRef = FSRef(path) resNum = Res.FSOpenResourceFile(fsRef, FSGetResourceForkName(), fsRdWrPerm) Res.UseResFile(resNum) try: Res.Get1Resource(restype, resid).RemoveResource() except Res.Error: pass res = Res.Resource(plistData) res.AddResource(restype, resid, '') res.WriteResource() Res.CloseResFile(resNum)
def writeLWFN(path, data): Res.FSpCreateResFile(path, "just", "LWFN", 0) resRef = Res.FSpOpenResFile(path, 2) # write-only try: Res.UseResFile(resRef) resID = 501 chunks = findEncryptedChunks(data) for isEncrypted, chunk in chunks: if isEncrypted: code = 2 else: code = 1 while chunk: res = Res.Resource(chr(code) + '\0' + chunk[:LWFNCHUNKSIZE - 2]) res.AddResource('POST', resID, '') chunk = chunk[LWFNCHUNKSIZE - 2:] resID = resID + 1 res = Res.Resource(chr(5) + '\0') res.AddResource('POST', resID, '') finally: Res.CloseResFile(resRef)
def getstylesoup(self, pathname): if not pathname: return None, None oldrf = Res.CurResFile() try: rf = Res.FSpOpenResFile(self.path, 1) except Res.Error: return None, None try: hstyle = Res.Get1Resource('styl', 128) hstyle.DetachResource() except Res.Error: hstyle = None try: hsoup = Res.Get1Resource('SOUP', 128) hsoup.DetachResource() except Res.Error: hsoup = None Res.CloseResFile(rf) Res.UseResFile(oldrf) return hstyle, hsoup
def close(self): if self.closed: return Res.UseResFile(self.resref) try: res = Res.Get1NamedResource('sfnt', self.fullname) except Res.Error: pass else: res.RemoveResource() res = Res.Resource(self.file.getvalue()) if self.res_id is None: self.res_id = Res.Unique1ID('sfnt') res.AddResource('sfnt', self.res_id, self.fullname) res.ChangedResource() self.createFond() del self.ttFont Res.CloseResFile(self.resref) self.file.close() self.closed = 1
def writeLWFN(path, data): named, namef = os.path.split(self.name) Res.FSCreateResourceFile(named, namef, u'') MacOS.SetCreatorAndType(path, "just", "LWFN") resRef = Res.FSOpenResourceFile(path, u'rsrc', 2) # write-only try: Res.UseResFile(resRef) resID = 501 chunks = findEncryptedChunks(data) for isEncrypted, chunk in chunks: if isEncrypted: code = 2 else: code = 1 while chunk: res = Res.Resource( chr(code) + '\0' + chunk[:LWFNCHUNKSIZE - 2]) res.AddResource('POST', resID, '') chunk = chunk[LWFNCHUNKSIZE - 2:] resID = resID + 1 res = Res.Resource(chr(5) + '\0') res.AddResource('POST', resID, '') finally: Res.CloseResFile(resRef)
def process_common(template, progress, code, rsrcname, destname, is_update, copy_codefragment, raw=0, others=[], filename=None, destroot=""): if MacOS.runtimemodel == 'macho': return process_common_macho(template, progress, code, rsrcname, destname, is_update, raw, others, filename, destroot) if others: raise BuildError, "Extra files only allowed for MachoPython applets" # Create FSSpecs for the various files template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1) template = template_fsr.as_pathname() # Copy data (not resources, yet) from the template if progress: progress.label("Copy data fork...") progress.set(10) if copy_codefragment: tmpl = open(template, "rb") dest = open(destname, "wb") data = tmpl.read() if data: dest.write(data) dest.close() tmpl.close() del dest del tmpl # Open the output resource fork if progress: progress.label("Copy resources...") progress.set(20) try: output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) except MacOS.Error: destdir, destfile = os.path.split(destname) Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) # Copy the resources from the target specific resource template, if any typesfound, ownertype = [], None try: input = Res.FSOpenResourceFile(rsrcname, RESOURCE_FORK_NAME, READ) except (MacOS.Error, ValueError): pass if progress: progress.inc(50) else: if is_update: skip_oldfile = ['cfrg'] else: skip_oldfile = [] typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress) Res.CloseResFile(input) # Check which resource-types we should not copy from the template skiptypes = [] if 'vers' in typesfound: skiptypes.append('vers') if 'SIZE' in typesfound: skiptypes.append('SIZE') if 'BNDL' in typesfound: skiptypes = skiptypes + [ 'BNDL', 'FREF', 'icl4', 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#' ] if not copy_codefragment: skiptypes.append('cfrg') ## skipowner = (ownertype <> None) # Copy the resources from the template input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ) dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) Res.CloseResFile(input) ## if ownertype == None: ## raise BuildError, "No owner resource found in either resource file or template" # Make sure we're manipulating the output resource file now Res.UseResFile(output) if ownertype == None: # No owner resource in the template. We have skipped the # Python owner resource, so we have to add our own. The relevant # bundle stuff is already included in the interpret/applet template. newres = Res.Resource('\0') newres.AddResource(DEFAULT_APPLET_CREATOR, 0, "Owner resource") ownertype = DEFAULT_APPLET_CREATOR if code: # Delete any existing 'PYC ' resource named __main__ try: res = Res.Get1NamedResource(RESTYPE, RESNAME) res.RemoveResource() except Res.Error: pass # Create the raw data for the resource from the code object if progress: progress.label("Write PYC resource...") progress.set(120) data = marshal.dumps(code) del code data = (MAGIC + '\0\0\0\0') + data # Create the resource and write it id = 0 while id < 128: id = Res.Unique1ID(RESTYPE) res = Res.Resource(data) res.AddResource(RESTYPE, id, RESNAME) attrs = res.GetResAttrs() attrs = attrs | 0x04 # set preload res.SetResAttrs(attrs) res.WriteResource() res.ReleaseResource() # Close the output file Res.CloseResFile(output) # Now set the creator, type and bundle bit of the destination. # Done with FSSpec's, FSRef FInfo isn't good enough yet (2.3a1+) dest_fss = Carbon.File.FSSpec(destname) dest_finfo = dest_fss.FSpGetFInfo() dest_finfo.Creator = ownertype dest_finfo.Type = 'APPL' dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited dest_fss.FSpSetFInfo(dest_finfo) macostools.touched(destname) if progress: progress.label("Done.") progress.inc(0)
def generate(input, output, module_dict=None, architecture='fat', debug=0): # try to remove old file try: os.remove(output) except: pass if module_dict is None: import macmodulefinder print "Searching for modules..." module_dict, missing = macmodulefinder.process(input, [], [], 1) if missing: import EasyDialogs missing.sort() answer = EasyDialogs.AskYesNoCancel( "Some modules could not be found; continue anyway?\n(%s)" % string.join(missing, ", ")) if answer <> 1: sys.exit(0) applettemplatepath = buildtools.findtemplate() corepath = findpythoncore() dynamicmodules, dynamicfiles, extraresfiles = findfragments( module_dict, architecture) print 'Adding "__main__"' buildtools.process(applettemplatepath, input, output, 0) outputref = Res.FSpOpenResFile(output, 3) try: Res.UseResFile(outputref) print "Adding Python modules" addpythonmodules(module_dict) print "Adding PythonCore resources" copyres(corepath, outputref, ['cfrg', 'Popt', 'GU\267I'], 1) print "Adding resources from shared libraries" for ppcpath, cfm68kpath in extraresfiles: if os.path.exists(ppcpath): copyres(ppcpath, outputref, ['cfrg'], 1) elif os.path.exists(cfm68kpath): copyres(cfm68kpath, outputref, ['cfrg'], 1) print "Fixing sys.path prefs" Res.UseResFile(outputref) try: res = Res.Get1Resource('STR#', 228) # from PythonCore except Res.Error: pass else: res.RemoveResource() # setting pref file name to empty string res = Res.Get1NamedResource('STR ', "PythonPreferenceFileName") res.data = Pstring("") res.ChangedResource() syspathpref = "$(APPLICATION)" res = Res.Resource("\000\001" + Pstring(syspathpref)) res.AddResource("STR#", 229, "sys.path preference") print "Creating 'PYD ' resources" for modname, (ppcfrag, cfm68kfrag) in dynamicmodules.items(): res = Res.Resource(Pstring(ppcfrag) + Pstring(cfm68kfrag)) id = 0 while id < 128: id = Res.Unique1ID('PYD ') res.AddResource('PYD ', id, modname) finally: Res.CloseResFile(outputref) print "Merging code fragments" cfmfile.mergecfmfiles([applettemplatepath, corepath] + dynamicfiles.keys(), output, architecture) print "done!"
# A minimal text editor.
def process_common(template, progress, code, rsrcname, destname, is_update, copy_codefragment, raw=0, others=[], filename=None, destroot=''): if MacOS.runtimemodel == 'macho': return process_common_macho(template, progress, code, rsrcname, destname, is_update, raw, others, filename, destroot) else: if others: raise BuildError, 'Extra files only allowed for MachoPython applets' template_fsr, d1, d2 = Carbon.File.FSResolveAliasFile(template, 1) template = template_fsr.as_pathname() if progress: progress.label('Copy data fork...') progress.set(10) if copy_codefragment: tmpl = open(template, 'rb') dest = open(destname, 'wb') data = tmpl.read() if data: dest.write(data) dest.close() tmpl.close() del dest del tmpl if progress: progress.label('Copy resources...') progress.set(20) try: output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) except MacOS.Error: destdir, destfile = os.path.split(destname) Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) typesfound, ownertype = [], None try: input = Res.FSOpenResourceFile(rsrcname, RESOURCE_FORK_NAME, READ) except (MacOS.Error, ValueError): if progress: progress.inc(50) else: if is_update: skip_oldfile = ['cfrg'] else: skip_oldfile = [] typesfound, ownertype = copyres(input, output, skip_oldfile, 0, progress) Res.CloseResFile(input) skiptypes = [] if 'vers' in typesfound: skiptypes.append('vers') if 'SIZE' in typesfound: skiptypes.append('SIZE') if 'BNDL' in typesfound: skiptypes = skiptypes + [ 'BNDL', 'FREF', 'icl4', 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#' ] if not copy_codefragment: skiptypes.append('cfrg') input = Res.FSOpenResourceFile(template, RESOURCE_FORK_NAME, READ) dummy, tmplowner = copyres(input, output, skiptypes, 1, progress) Res.CloseResFile(input) Res.UseResFile(output) if ownertype is None: newres = Res.Resource('\x00') newres.AddResource(DEFAULT_APPLET_CREATOR, 0, 'Owner resource') ownertype = DEFAULT_APPLET_CREATOR if code: try: res = Res.Get1NamedResource(RESTYPE, RESNAME) res.RemoveResource() except Res.Error: pass if progress: progress.label('Write PYC resource...') progress.set(120) data = marshal.dumps(code) del code data = MAGIC + '\x00\x00\x00\x00' + data id = 0 while id < 128: id = Res.Unique1ID(RESTYPE) res = Res.Resource(data) res.AddResource(RESTYPE, id, RESNAME) attrs = res.GetResAttrs() attrs = attrs | 4 res.SetResAttrs(attrs) res.WriteResource() res.ReleaseResource() Res.CloseResFile(output) dest_fss = Carbon.File.FSSpec(destname) dest_finfo = dest_fss.FSpGetFInfo() dest_finfo.Creator = ownertype dest_finfo.Type = 'APPL' dest_finfo.Flags = dest_finfo.Flags | Carbon.Files.kHasBundle | Carbon.Files.kIsShared dest_finfo.Flags = dest_finfo.Flags & ~Carbon.Files.kHasBeenInited dest_fss.FSpSetFInfo(dest_finfo) macostools.touched(destname) if progress: progress.label('Done.') progress.inc(0) return
#
"""macgen_bin - Generate application from shared libraries"""