You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.3 KiB
33 lines
1.3 KiB
# -*- coding: utf-8 -*-
|
|
"""Dump docs-repo dir tree under A4/A3/A2/A7 + scan numbered-tag residue dirs."""
|
|
import os
|
|
import re
|
|
DOCS = r'E:\code\crm-api-docs'
|
|
OUT = r'e:\code\crm-backend-matt\.scratch\customer-rework\bruno-tree-after.txt'
|
|
|
|
lines = []
|
|
numbered = []
|
|
for root, dirs, files in os.walk(DOCS):
|
|
dirs[:] = [d for d in dirs if d not in ('environments', '.git')]
|
|
rel = os.path.relpath(root, DOCS)
|
|
if rel == '.':
|
|
rel = ''
|
|
depth = 0 if rel == '' else rel.count(os.sep) + 1
|
|
# numbered residue check on dir names
|
|
for d in dirs:
|
|
if re.search(r'A\d-\d', d):
|
|
numbered.append(os.path.join(rel, d) if rel else d)
|
|
if not any(seg in rel for seg in ('A4 客户管理', 'A3 商机管理', 'A7 后台管理', 'customer', 'preference')):
|
|
continue
|
|
bru = sorted(f for f in files if f.endswith('.bru'))
|
|
indent = ' ' * depth
|
|
lines.append('%s%s/ (%d bru)' % (indent, os.path.basename(root) if rel else '(root)', len(bru)))
|
|
for f in bru:
|
|
lines.append('%s %s' % (indent, f))
|
|
|
|
lines.append('')
|
|
lines.append('== NUMBERED RESIDUE DIRS: %d' % len(numbered))
|
|
lines += [' ' + n for n in numbered]
|
|
open(OUT, 'w', encoding='utf-8').write('\n'.join(lines))
|
|
print('dirs with A\\d-\\d residue:', len(numbered))
|
|
print('written:', OUT)
|
|
|