mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-25 08:41:54 +00:00
30 lines
804 B
Python
30 lines
804 B
Python
|
#!/usr/bin/python
|
||
|
import sys, os.path, re
|
||
|
|
||
|
reg = re.compile(r'^\*include ([^;\s]*?)\s*$', re.MULTILINE)
|
||
|
|
||
|
|
||
|
|
||
|
def printdeps(filename):
|
||
|
"""Expects a filename relative to script's working directory."""
|
||
|
if(filename[-4:]!='.svx'): filename += ".svx"
|
||
|
print filename
|
||
|
t = file(filename).read()
|
||
|
for m in re.findall(reg, t):
|
||
|
newfname = m
|
||
|
if(newfname[-4:]!='.svx'): newfname += '.svx'
|
||
|
newfname = os.path.normpath(os.path.dirname(filename) + '/' + newfname)
|
||
|
if(os.path.exists(newfname)):
|
||
|
printdeps(newfname)
|
||
|
else: # imitate cavern case-sensitivity workaround
|
||
|
newfname = m.lower()
|
||
|
newfname = os.path.normpath(os.path.dirname(filename) + '/' + newfname)
|
||
|
printdeps(newfname)
|
||
|
|
||
|
|
||
|
if(len(sys.argv) != 2):
|
||
|
print >>sys.stderr, "Usage: %s SVXFILE" % sys.argv[0]
|
||
|
sys.exit(1)
|
||
|
|
||
|
printdeps(sys.argv[1])
|