Esempio n. 1
0
#!/usr/bin/env python
#----------------------------------------------------------------------------
# File: hppath.py
# Description: For each specified header, make a txt file containing its path
# Created: 26-Oct-2005, Harrison B. Prosper
#$Revision: 1.2 $
#----------------------------------------------------------------------------
import sys
from string import *
from boostlib import hidepath
#----------------------------------------------------------------------------
# Command line
#----------------------------------------------------------------------------
argv = sys.argv[1:]
argc = len(argv)
if argc < 1:
    print "\nUsage:\n\thppath <headers>\n"
    sys.exit(1)
files = argv
for file in files:
    file = hidepath(file)
    name = split(split(file, '/').pop(), '.')[0]
    open("%s.txt" % name, 'w').write('%s\n' % file)
    print name
Esempio n. 2
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)
Esempio n. 3
0
#!/usr/bin/env python
#----------------------------------------------------------------------------
# File: hppath.py
# Description: For each specified header, make a txt file containing its path
# Created: 26-Oct-2005, Harrison B. Prosper
#$Revision: 1.2 $
#----------------------------------------------------------------------------
import sys
from string import *
from boostlib import hidepath
#----------------------------------------------------------------------------
# Command line
#----------------------------------------------------------------------------
argv = sys.argv[1:]
argc = len(argv)
if argc < 1:
    print "\nUsage:\n\thppath <headers>\n"
    sys.exit(1)
files = argv
for file in files:
    file = hidepath(file)
    name = split(split(file,'/').pop(),'.')[0]
    open("%s.txt" % name,'w').write('%s\n' % file)
    print name