'Generate code for a single suite'

def compilesuite(self, major, minor, language, script, fname, precompinfo):

    [name, desc, code, level, version, events, classes, comps, enums] = self.suite
    def class_sorter(k1, k2):
        'Sort    classes    by    code,    and    make    sure    main    class    sorts    before    synonyms'
        if (k1[1] < k2[1]):
            return (-1)
        if (k1[1] > k2[1]):
            return 1
        if ((not k2[3]) or (k2[3][0][1] == 'c@#!')):
            return (-1)
        if ((not k1[3]) or (k1[3][0][1] == 'c@#!')):
            return 1
        return 0
    events.sort()
    classes.sort(class_sorter)
    comps.sort()
    enums.sort()
    self.fp = fp = open(self.pathname, 'w')
    MacOS.SetCreatorAndType(self.pathname, 'Pyth', 'TEXT')
    fp.write(('"""Suite    %s:    %s\n' % (ascii(name), ascii(desc))))
    fp.write(('Level    %d,    version    %d\n\n' % (level, version)))
    fp.write(('Generated    from    %s\n' % ascii(fname)))
    fp.write(('AETE/AEUT    resource    version    %d/%d,    language    %d,    script    %d\n' % (major, minor, language, script)))
    fp.write('"""\n\n')
    fp.write('import    aetools\n')
    fp.write('import    MacOS\n\n')
    fp.write(('_code    =    %r\n\n' % (code,)))
    if (self.basepackage and (code in self.basepackage._code_to_module)):
        fp.write(('from    %s    import    *\n' % self.basepackage._code_to_fullname[code][0]))
        basemodule = self.basepackage._code_to_module[code]
    elif (self.basepackage and (code.lower() in self.basepackage._code_to_module)):
        fp.write(('from    %s    import    *\n' % self.basepackage._code_to_fullname[code.lower()][0]))
        basemodule = self.basepackage._code_to_module[code.lower()]
    else:
        basemodule = None
    self.basemodule = basemodule
    self.compileclassheader()
    self.enumsneeded = {}
    if events:
        for event in events:
            self.compileevent(event)
    else:
        fp.write('                pass\n\n')
    objc = ObjectCompiler(fp, self.modname, basemodule, precompinfo, interact=(self.edit_modnames is None), verbose=self.verbose)
    for cls in classes:
        objc.compileclass(cls)
    for cls in classes:
        objc.fillclasspropsandelems(cls)
    for comp in comps:
        objc.compilecomparison(comp)
    for enum in enums:
        objc.compileenumeration(enum)
    for enum in self.enumsneeded.keys():
        objc.checkforenum(enum)
    objc.dumpindex()
