From 1e15e1c7586d34bbe75efbcd235084553abdef56 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 18 Jan 2021 18:57:37 +0000 Subject: Fixes for windows compatibility. Although it is running on windows, we need a POSIX layer, so we'll use forward slashes. Also clean the lines. --- tools/mkdeps.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/mkdeps.py b/tools/mkdeps.py index e0b2a10..05bac9b 100755 --- a/tools/mkdeps.py +++ b/tools/mkdeps.py @@ -35,7 +35,7 @@ def main(): args = parser.parse_args() fix_path = args.dir if args.build is None else args.build - fix_path = r"%s\1" % (fix_path.rstrip(os.sep) + os.sep) + fix_path = r"%s\1" % (fix_path.strip("/") + "/").replace("\\", "\\\\") inc = ["-I%s" % d for d in args.include.split(":")] cmd = ["sdcc", "-MM"] + inc result = [] @@ -47,7 +47,8 @@ def main(): if out.returncode: sys.exit("Error: %s" % out.stderr) - result.append(re.sub(FIX_RE, fix_path, out.stdout.decode('utf-8'))) + out = out.stdout.decode('utf-8').strip() + result.append(re.sub(FIX_RE, fix_path, out)) try: old = open(args.deps, "rt").read() @@ -56,7 +57,7 @@ def main(): print("%r not found, will generate" % args.deps) old = None - new = ''.join(result) + new = '\n'.join(result) if new != old: with open(args.deps, "wt") as fd: -- cgit v1.2.3