aboutsummaryrefslogtreecommitdiff
path: root/tools/mkdeps.py
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-02-15 23:28:50 +0000
committerJuan J. Martinez <jjm@usebox.net>2022-02-15 23:28:50 +0000
commit31418a90da67a1bcd1af0a39f33e8ecc5cdd2d49 (patch)
tree1127a547c91af3cb71912c6572a44c76484a1982 /tools/mkdeps.py
parent9c984aa67d2bd607032ba7fa911c77f9bbf87d4c (diff)
downloadubox-msx-lib-31418a90da67a1bcd1af0a39f33e8ecc5cdd2d49.tar.gz
ubox-msx-lib-31418a90da67a1bcd1af0a39f33e8ecc5cdd2d49.zip
Use black for formatting
Diffstat (limited to 'tools/mkdeps.py')
-rwxr-xr-xtools/mkdeps.py51
1 files changed, 34 insertions, 17 deletions
diff --git a/tools/mkdeps.py b/tools/mkdeps.py
index 89df9d8..cb70555 100755
--- a/tools/mkdeps.py
+++ b/tools/mkdeps.py
@@ -14,23 +14,41 @@ def main():
FIX_RE = r"([^:]+:)"
- parser = ArgumentParser(description="mkdeps for SDCC",
- epilog="Copyright (C) 2021 Juan J Martinez <jjm@usebox.net>",
- )
+ parser = ArgumentParser(
+ description="mkdeps for SDCC",
+ epilog="Copyright (C) 2021 Juan J Martinez <jjm@usebox.net>",
+ )
parser.add_argument(
- "--version", action="version", version="%(prog)s " + __version__)
+ "--version", action="version", version="%(prog)s " + __version__
+ )
- parser.add_argument("-b", "--build-dir", dest="build", default=None, type=str,
- help="Directory to build")
- parser.add_argument("-I", "--include", dest="include", default=None, type=str,
- help="Include directory (for multiple directories, use : as separator)")
- parser.add_argument("-v", "--verbose", dest="verbose", action="store_true",
- help="Enable verbose output")
+ parser.add_argument(
+ "-b",
+ "--build-dir",
+ dest="build",
+ default=None,
+ type=str,
+ help="Directory to build",
+ )
+ parser.add_argument(
+ "-I",
+ "--include",
+ dest="include",
+ default=None,
+ type=str,
+ help="Include directory (for multiple directories, use : as separator)",
+ )
+ parser.add_argument(
+ "-v",
+ "--verbose",
+ dest="verbose",
+ action="store_true",
+ help="Enable verbose output",
+ )
parser.add_argument("dir", help="Directory to scan")
- parser.add_argument(
- "deps", help="Dependencies file (to include in Makefile)")
+ parser.add_argument("deps", help="Dependencies file (to include in Makefile)")
args = parser.parse_args()
@@ -41,13 +59,12 @@ def main():
result = []
for d in sorted(glob.glob(os.path.join(args.dir, "*.c"))):
if args.verbose:
- print("running %r" % ' '.join(cmd + [d]))
- out = subprocess.run(cmd + [d], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ print("running %r" % " ".join(cmd + [d]))
+ out = subprocess.run(cmd + [d], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if out.returncode:
sys.exit("Error: %s" % out.stderr)
- out = out.stdout.decode('utf-8').strip("\n\r")
+ out = out.stdout.decode("utf-8").strip("\n\r")
result.append(re.sub(FIX_RE, fix_path, out))
try:
@@ -57,7 +74,7 @@ def main():
print("%r not found, will generate" % args.deps)
old = None
- new = '\n'.join(result)
+ new = "\n".join(result)
if new != old:
with open(args.deps, "wt") as fd: