def main(): expandedpaths = [] for path in incpaths: expandedpaths.append(expandpath(path)) hdrs = [] for hdr in headers: basepath = '' kindex = -1 for index, path in enumerate(incpaths): expath = expandedpaths[index] if hdr[:len(expath)] == expath: if len(expath) > len(basepath): basepath = expath kindex = index if kindex < 0: continue hdr = "%s %s" % (incpaths[kindex], hdr[len(basepath)+1:]) print hdr hdrs.append(hdr) for header in headers: findheaders(incpaths, expandedpaths, header, hdrs) hdrs.sort() record = joinfields(hdrs,'\n')+'\n' open("headers",'w').write(record)
def findheaders(incpaths, expandedpaths, header, hdrs, depth=0): depth += 1 if depth > 50: fatal("lost in tree!") command = 'egrep "^(# *include .*\.h|class \w+;)" %s 2>/dev/null' % header records = map(lambda x: strip(x), os.popen(command).readlines()) for record in records: name = '' m = include.match(record) if m != None: name = m.group('header') else: m = forward.match(record) if m != None: name = m.group('name') + '.h' if name == '': continue for index, path in enumerate(incpaths): hdr = '%s/%s' % (path, name) hdr = expandpath(hdr) if hdr == '': command = 'find %s/* '\ '-name "*%s*" 2>/dev/null' % \ (path, name) hdr = strip(os.popen(command).read()) if hdr == '': continue hdr = "%s %s" % (path, hdr[len(expandedpaths[index])+1:]) print "\t", hdr if hdr in hdrs: continue hdrs.append(hdr) findheaders(incpaths, hdr, hdrs, depth)
def main(): expandedpaths = [] for path in incpaths: expandedpaths.append(expandpath(path)) hdrs = [] for hdr in headers: basepath = '' kindex = -1 for index, path in enumerate(incpaths): expath = expandedpaths[index] if hdr[:len(expath)] == expath: if len(expath) > len(basepath): basepath = expath kindex = index if kindex < 0: continue hdr = "%s %s" % (incpaths[kindex], hdr[len(basepath) + 1:]) print hdr hdrs.append(hdr) for header in headers: findheaders(incpaths, expandedpaths, header, hdrs) hdrs.sort() record = joinfields(hdrs, '\n') + '\n' open("headers", 'w').write(record)
def findheaders(incpaths, expandedpaths, header, hdrs, depth=0): depth += 1 if depth > 50: fatal("lost in tree!") command = 'egrep "^(# *include .*\.h|class \w+;)" %s 2>/dev/null' % header records = map(lambda x: strip(x), os.popen(command).readlines()) for record in records: name = '' m = include.match(record) if m != None: name = m.group('header') else: m = forward.match(record) if m != None: name = m.group('name') + '.h' if name == '': continue for index, path in enumerate(incpaths): hdr = '%s/%s' % (path, name) hdr = expandpath(hdr) if hdr == '': command = 'find %s/* '\ '-name "*%s*" 2>/dev/null' % \ (path, name) hdr = strip(os.popen(command).read()) if hdr == '': continue hdr = "%s %s" % (path, hdr[len(expandedpaths[index]) + 1:]) print "\t", hdr if hdr in hdrs: continue hdrs.append(hdr) findheaders(incpaths, hdr, hdrs, depth)
except: fatal("keyword project not found in file Project.py") try: incpaths = strip(incpaths) except: fatal("keyword incpaths not found in file Project.py") try: libpaths = strip(libpaths) except: fatal("keyword libpaths not found in file Project.py") libpaths+= ' $PYTHON_PROJECTS/boostutil/lib $BOOST_BASE/lib' libdirs = split(libpaths) libpaths= map(lambda x: expandpath(x), libdirs) incdirs = split(incpaths) incpaths= map(lambda x: expandpath(x), incdirs) print incdirs # Find headers #print "finding headers..." #str = replace(joinfields(incdirs,' '),'$','\\$') #command = "findheaders.py %s" % str #os.system(command) #if not os.path.exists("headers"): # fatal("Unable to find file headers created by findheaders.py")
except: fatal("keyword project not found in file Project.py") try: incpaths = strip(incpaths) except: fatal("keyword incpaths not found in file Project.py") try: libpaths = strip(libpaths) except: fatal("keyword libpaths not found in file Project.py") libpaths += ' $PYTHON_PROJECTS/boostutil/lib $BOOST_BASE/lib' libdirs = split(libpaths) libpaths = map(lambda x: expandpath(x), libdirs) incdirs = split(incpaths) incpaths = map(lambda x: expandpath(x), incdirs) print incdirs # Find headers #print "finding headers..." #str = replace(joinfields(incdirs,' '),'$','\\$') #command = "findheaders.py %s" % str #os.system(command) #if not os.path.exists("headers"): # fatal("Unable to find file headers created by findheaders.py")