コード例 #1
0
	def setup(self, names):

		# Create directories

		s = ''
		for d in names['dirs']:
			s += ' mkdir -p %s;' % d
		names['mkdir'] = s
		
		command = '''
		cd %(projectpath)s
		mkdir -p %(bldpath)s;
		''' % names

		if len(names['headerlist']) > 0:
			command += '''
			cd %(bldpath)s;
			%(mkdir)s
			(''' % names

			pathmap = {}
			for headerpath, regex, exregex, maxdepth in names['headerlist']:
				names['headerpath'] = headerpath

				if not pathmap.has_key(headerpath):
					cmd = 'find %(headerpath)s -maxdepth 0 2>/dev/null' % names
					pathmap[headerpath] = strip( os.popen(cmd).read() )

			names['regex'] = regex
			names['maxdepth'] = maxdepth
			if exregex <> "":
				names['exclude'] = '| egrep -v "%s"' % exregex
			else:
				names['exclude'] = ''

			if names['noclasstest']:
				command = command + \
			'''find %(headerpath)s -regex "%(headerpath)s/%(regex)s" -follow \\
			%(maxdepth)s %(exclude)s;
			''' % names            
			else:
				command = command + 'find %(headerpath)s '
				command = command + '-regex "%(headerpath)s/%(regex)s" '
				command = command + '-exec egrep -l '
				command = command + \
						  '"^%(space)s*(class|struct)%(space)s+[^;]+$" {} \\;'
				command = command + ' ;\n'
				command = command % names
		##end for
		if len(names['headerlist']) > 0:
			command = rstrip(command)
			command = command[:len(command)-1]
			command = command + ') > %(headerfile)s'
			command = command % names

		# Ok! Now execute plan

		os.system(command)
		if len(names['headerlist']) == 0: return

		filename= '%(bldpath)s/%(headerfile)s' % names
		headers = open(filename).readlines()
		for header in headers:
			header = strip(header)
			name = nameonly(header)
			names['name'] = name
			names['header'] = hidepath(header, pathmap)
			txtfile = '%(bldpath)s/%(xmldir)s/%(name)s.txt' % names
			open(txtfile,'w').write('%(header)s\n' % names)

		command = "cd %(bldpath)s; rm -rf %(headerfile)s" % names
		os.system(command)

		# Create makefiles

		self.mkxmlmake(names)
コード例 #2
0
ファイル: mkheadermap.py プロジェクト: hbprosper/SusySapien
larch = len(arch)

libcount = 0
lastlib = ''
done = {}
NameToHeader = {}

for ifile, file in enumerate(records):
    file = strip(file)
    if find(file,'/gcc/') > -1:   continue
    if find(file,'/qt/') > -1:    continue
    if not os.path.exists(file):
        print "**warning** %s not found\n" % file
        continue

    name = nameonly(file)
    if ifile % 1000 == 0:
        print ifile, name

    header, extension = os.path.splitext(file)
    for key in keys:
        if key == file[:len(key)]:
            base = env[key]
            hdr  = file[len(key)+1:]
            extra= ''

            if hdr[0:larch] == arch:
                base = '%s/$(CMS_SYS)' % base
                hdr  = hdr[larch+1:]
                
            if hdr[0:4] == 'src/':
コード例 #3
0
ファイル: lsclass.py プロジェクト: hbprosper/SusySapien
    # Construct include file name, assuming that we
    # are starting at a level higher than the directory src/
    if find(xmlfile, 'src/') < 0:
        goodriddance("lsclass.py - directory src/ not found in %s" % xmlfile)

    # Extract name of include from xml file

    include = replace(replace(split(xmlfile, 'src/')[1], 'xml/', 'interface/'),
                      '.xml', '.h')
    filenamestem = replace(replace(include, 'interface/', ''), '.h', '')
    filenamestem = replace(filenamestem, '/', '.')

    # Skip some classes

    skipstuff = re.compile(r'iterator|component|print|Fwd$')
    cname = nameonly(include)
    if skipstuff.search(cname) != None:
        #print "\t\t\t*** skip processing: ", filenamestem
        exit(0)

    # Extract informatiom

    DB = {}
    populateDB(BASE, include, DB)

    headerxml, classes = DB['include'][include]

    data = {'db': DB, 'filenamestem': filenamestem}
    for classxml in classes:
        classname = classxml.attrib['fullname']
        if skipstuff.search(classname) != None: continue
コード例 #4
0
ファイル: lsclass.py プロジェクト: hbprosper/SusySapien
	# Construct include file name, assuming that we
	# are starting at a level higher than the directory src/
	if find(xmlfile, 'src/') < 0:
		goodriddance("lsclass.py - directory src/ not found in %s" % xmlfile)
		
	# Extract name of include from xml file
	
	include=replace(replace(split(xmlfile,
								  'src/')[1],'xml/','interface/'),'.xml','.h')
	filenamestem = replace(replace(include, 'interface/',''),'.h','')
	filenamestem = replace(filenamestem,'/','.')

	# Skip some classes
	
	skipstuff = re.compile(r'iterator|component|print|Fwd$')
	cname = nameonly(include)	
	if skipstuff.search(cname) != None:
		#print "\t\t\t*** skip processing: ", filenamestem
		exit(0)
	
	# Extract informatiom
	
	DB = {}
	populateDB(BASE, include, DB)
	
	headerxml, classes = DB['include'][include]
	
	data = {'db':DB, 'filenamestem': filenamestem}
	for classxml in classes:
		classname = classxml.attrib['fullname']
		if skipstuff.search(classname) != None: continue
コード例 #5
0
ファイル: mkheadermap.py プロジェクト: hbprosper/SusySapien
larch = len(arch)

libcount = 0
lastlib = ''
done = {}
NameToHeader = {}

for ifile, file in enumerate(records):
    file = strip(file)
    if find(file, '/gcc/') > -1: continue
    if find(file, '/qt/') > -1: continue
    if not os.path.exists(file):
        print "**warning** %s not found\n" % file
        continue

    name = nameonly(file)
    if ifile % 1000 == 0:
        print ifile, name

    header, extension = os.path.splitext(file)
    for key in keys:
        if key == file[:len(key)]:
            base = env[key]
            hdr = file[len(key) + 1:]
            extra = ''

            if hdr[0:larch] == arch:
                base = '%s/$(CMS_SYS)' % base
                hdr = hdr[larch + 1:]

            if hdr[0:4] == 'src/':
コード例 #6
0
ファイル: mksymmap.py プロジェクト: hbprosper/SusySapien
    if find(file,'/gcc/') > -1:   continue
    if find(file,'/qt/') > -1:    continue
    if not os.path.exists(file):
        print "**warning** %s not found\n" % file
        continue

    library, extension = os.path.splitext(file)

    if ifile < len(records)-1:
        nextlibrary, ext = os.path.splitext(records[ifile+1])
    else:
        nextlibrary, ext = ('','')
    if nextlibrary == library: continue
    
    libcount += 1
    print "%4d %s" % (libcount, nameonly(file))
        
    recs = os.popen('symlist.py -i %s' % file).readlines()
    
    for index, record in enumerate(recs):
        for key in keys:
            if key == record[:len(key)]:
                
                record = '$(%s)%s' % (env[key], record[len(key):])
                break

        
        record = replace(record,arch,'$(CMS_SYS)')
        record = strip(record)
        if record == '': continue