Refactor and improve CTL and other code

This commit is contained in:
Justine Tunney 2024-06-04 05:41:53 -07:00
parent 1d8f37a2f0
commit 9906f299bb
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
25 changed files with 5768 additions and 5350 deletions

View file

@ -7,11 +7,8 @@ import sys
def GetDeps(path):
visited = set()
def Dive(path, inside, depth, that_isnt=None):
sys.stdout.write('%s%s' % ('\t' * depth, path))
sys.stdout.write('\n')
if path in visited:
return
visited.add(path)
included = path
if not os.path.exists(path):
if inside:
samedir = os.path.join(os.path.dirname(inside), path)
@ -24,6 +21,15 @@ def GetDeps(path):
else:
# sys.stderr.write('not found: %s\n' % (path))
return
sys.stdout.write('\t' * depth)
sys.stdout.write(path)
sys.stdout.write('\n')
if path in visited:
return
visited.add(path)
with open(path) as f:
code = f.read()
for dep in re.findall(r'[.#]\s*include\s+[<"]([^">]+)[">]', code):