mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-31 01:32:28 +00:00
Refactor and improve CTL and other code
This commit is contained in:
parent
1d8f37a2f0
commit
9906f299bb
25 changed files with 5768 additions and 5350 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue