'Generate a single child.  May force a few children to be built as we generate deps'

def generate_child(self, child, dir):

    self.generate_type = GEN_DEMAND_CHILD
    la = self.typelib.GetLibAttr()
    lcid = la[1]
    clsid = la[0]
    major = la[3]
    minor = la[4]
    self.base_mod_name = (('win32com.gen_py.' + str(clsid)[1:(-1)]) + ('x%sx%sx%s' % (lcid, major, minor)))
    try:
        oleItems = {}
        vtableItems = {}
        infos = self.CollectOleItemInfosFromType()
        found = 0
        for type_info_tuple in infos:
            (info, infotype, doc, attr) = type_info_tuple
            if (infotype == pythoncom.TKIND_COCLASS):
                (coClassItem, child_infos) = self._Build_CoClass(type_info_tuple)
                found = (build.MakePublicAttributeName(doc[0]) == child)
                if (not found):
                    for (info, info_type, refType, doc, refAttr, flags) in child_infos:
                        if (build.MakePublicAttributeName(doc[0]) == child):
                            found = 1
                            break
                if found:
                    oleItems[coClassItem.clsid] = coClassItem
                    self._Build_CoClassChildren(coClassItem, child_infos, oleItems, vtableItems)
                    break
        if (not found):
            for type_info_tuple in infos:
                (info, infotype, doc, attr) = type_info_tuple
                if (infotype in [pythoncom.TKIND_INTERFACE, pythoncom.TKIND_DISPATCH]):
                    if (build.MakePublicAttributeName(doc[0]) == child):
                        found = 1
                        (oleItem, vtableItem) = self._Build_Interface(type_info_tuple)
                        oleItems[clsid] = oleItem
                        if (vtableItem is not None):
                            vtableItems[clsid] = vtableItem
        assert found, ("Cant    find    the    '%s'    interface    in    the    CoClasses,    or    the    interfaces" % (child,))
        items = {}
        for (key, value) in oleItems.iteritems():
            items[key] = (value, None)
        for (key, value) in vtableItems.iteritems():
            existing = items.get(key, None)
            if (existing is not None):
                new_val = (existing[0], value)
            else:
                new_val = (None, value)
            items[key] = new_val
        self.progress.SetDescription('Generating...', len(items))
        for (oleitem, vtableitem) in items.itervalues():
            an_item = (oleitem or vtableitem)
            assert (not self.file), 'already    have    a    file?'
            out_name = (os.path.join(dir, an_item.python_name) + '.py')
            worked = False
            self.file = self.open_writer(out_name)
            try:
                if (oleitem is not None):
                    self.do_gen_child_item(oleitem)
                if (vtableitem is not None):
                    self.do_gen_child_item(vtableitem)
                self.progress.Tick()
                worked = True
            finally:
                self.finish_writer(out_name, self.file, worked)
                self.file = None
    finally:
        self.progress.Finished()
