aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2017-07-14 01:21:55 +0200
committerThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2017-07-14 01:21:55 +0200
commite59bb3f483b5bf7962c0a79c96c9f75d4c41ef9f (patch)
tree8855b0000ae2388a2187887b6aa3e09fcdd07e52
parente457dcdb5e9d806cfeef2c27330d01eba0e82c58 (diff)
Corrected bits option management, added behaviour of removing unknown headers in makeinc.
-rwxr-xr-xtools/makeinc.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/tools/makeinc.py b/tools/makeinc.py
index 6bc3c7c..69756cc 100755
--- a/tools/makeinc.py
+++ b/tools/makeinc.py
@@ -11,13 +11,16 @@ from argparse import ArgumentParser
argparser = ArgumentParser(prog='makeinc.py')
argparser.add_argument('out', help='The output include folder.')
argparser.add_argument('path', help='The include directories.', nargs='*')
-argparser.add_argument('--bits', help='The bits path', default='')
+argparser.add_argument('--bits', help='The bits path', action='append')
# Parse the arguments.
args = argparser.parse_args()
# Correct the bits path.
-args.bits = args.bits.split(':') if args.bits else []
+bits = []
+for arg in args.bits:
+ bits += arg.split(':')
+args.bits = bits
#*****************************************************************************#
# Useful function #
#*****************************************************************************#
@@ -185,7 +188,17 @@ for base in args.path:
%(nm, dirs[names.index(nm)], base))
exit(1)
-# Hello.
+# Check for the intruders.
+if os.path.isdir(args.out):
+ lst = []
+ for root, _, nms in os.walk(args.out):
+ lst += [os.path.join(root, name)[len(os.path.join(args.out, '')):] \
+ for name in nms]
+ for nm in lst:
+ if not nm in names:
+ os.remove(os.path.join(args.out, nm))
+
+# Make the includes.
for path in zip(dirs, names):
localpath = os.path.join(args.out, path[1])
@@ -193,3 +206,5 @@ for path in zip(dirs, names):
except: pass
make_header(path[0], path[1], open(localpath, 'w'))
+
+# End of file.