-
Notifications
You must be signed in to change notification settings - Fork 1
/
omake_conf.py
33 lines (25 loc) · 1.14 KB
/
omake_conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os, subprocess, log
import glob
from common import *
###########################################################################################################################################
## Config actions
def clean(props):
sourceDirs = ['kern', 'std', 'bin']
binaries = ['*.o', '*.bin']
current_dir = os.environ['PWD']
def clean2(dirs, logLevel=1):
from os.path import join, exists
for dir in dirs:
path = join(current_dir, dir)
log.info(f'Cleaning directory “{path}”...', logLevel)
if not exists(path):
log.warn(f'Unknown directory “{path}”!', logLevel)
return
directories, files = getDirsAndFiles(path)
clean2(directories, logLevel + 1)
for pattern in binaries:
for file in glob.glob(join(path, pattern), recursive=False):
if props['debug']:
log.debug('Removing file “{}”.'.format(join(path, file)), logLevel)
os.remove(join(path, file))
clean2(sourceDirs)