예제 #1
0
def gencix(major, minor):
    # First generate first pass at the CILE over all of the lib tree
    cixfile = "activeperl-%d.%d.cix" % (major, minor)
    command = "python ../../../ci2.py scan -n -r -p -l Perl -T /tmp/ActivePerl-%d.%d/perl/lib -i \"*.pm\"> %s" % (
        major, minor, cixfile)
    retval = os.system(command)
    if retval != 0:
        print "Error scanning ActivePerl library"
        sys.exit(retval)
    #
    # Grab the output of that scan

    root = parse(cixfile).getroot()

    newroot = Element("codeintel", version="2.0")
    cixfile = SubElement(newroot,
                         "file",
                         lang="Perl",
                         mtime=str(int(time.time())),
                         path=os.path.basename('perl.cix'))

    for file in root.getiterator('file'):
        print >> sys.stderr, "Processing", file.get('path')
        for blob in file:
            if blob.get("src"):
                # Don't want the src string.
                del blob.attrib["src"]
            cixfile.append(blob)

    cix = genPerlStdCIX(
        cixfile,
        "/tmp/ActivePerl-%d.%d/perl/lib/pod/perlfunc.pod" % (major, minor))

    parent_map = dict((c, p) for p in cixfile.getiterator() for c in p)
    for variable in newroot.getiterator('variable'):
        attributes = variable.get('attributes')
        if attributes and '__local__' in variable.get('attributes'):
            parent_map[variable].remove(variable)

    # Generate the CIX.
    print >> sys.stderr, "Prettying"
    prettify(newroot)
    tree = ElementTree(newroot)
    #fname = '../../../lib/codeintel2/stdlibs/perl-%d.%d.cix' % (major, minor)
    fname = 'perl-%d.%d.cix' % (major, minor)
    #os.system('p4 edit %s' % fname)
    stream = open(fname, "w")
    print >> sys.stderr, "Writing"
    stream.write('<?xml version="1.0" encoding="UTF-8"?>\n')
    tree.write(stream)
    stream.close()
예제 #2
0
def gencix(major, minor):
    # First generate first pass at the CILE over all of the lib tree
    cixfile = "activeperl-%d.%d.cix" % (major, minor)
    command = "python ../../../ci2.py scan -n -r -p -l Perl -T /tmp/ActivePerl-%d.%d/perl/lib -i \"*.pm\"> %s" % (major, minor, cixfile)
    retval = os.system(command)
    if retval != 0:
        print "Error scanning ActivePerl library"
        sys.exit(retval)
    #    
    # Grab the output of that scan
    
    root = parse(cixfile).getroot()
    
    newroot = Element("codeintel", version="2.0")
    cixfile = SubElement(newroot, "file", lang="Perl",
                         mtime=str(int(time.time())),
                         path=os.path.basename('perl.cix'))
    
    for file in root.getiterator('file'):
        print >> sys.stderr, "Processing", file.get('path')
        for blob in file:
            if blob.get("src"):
                # Don't want the src string.
                del blob.attrib["src"]
            cixfile.append(blob)
    
    cix = genPerlStdCIX(cixfile, "/tmp/ActivePerl-%d.%d/perl/lib/pod/perlfunc.pod" % (major, minor))
        
    parent_map = dict((c, p) for p in cixfile.getiterator() for c in p)
    for variable in newroot.getiterator('variable'):
        attributes = variable.get('attributes')
        if attributes and '__local__' in variable.get('attributes'):
            parent_map[variable].remove(variable)

    # Generate the CIX.
    print >>sys.stderr, "Prettying"
    prettify(newroot)
    tree = ElementTree(newroot)
    #fname = '../../../lib/codeintel2/stdlibs/perl-%d.%d.cix' % (major, minor)
    fname = 'perl-%d.%d.cix' % (major, minor)
    #os.system('p4 edit %s' % fname)
    stream = open(fname, "w")
    print >>sys.stderr, "Writing"
    stream.write('<?xml version="1.0" encoding="UTF-8"?>\n')
    tree.write(stream)
    stream.close()