From f5ee93299299c74561e55f96ee7a267d8c4f7bc2 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 7 Jan 2022 18:38:22 +0000 Subject: [PATCH] Pass output directory throuh to consts and call a cleanup function --- genbindings.py | 3 ++- java_strings.py | 3 +++ typescript_strings.py | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/genbindings.py b/genbindings.py index 1443a41a..ca66da19 100755 --- a/genbindings.py +++ b/genbindings.py @@ -31,7 +31,7 @@ else: sys.exit(1) -consts = Consts(DEBUG, target=target) +consts = Consts(DEBUG, target=target, outdir=sys.argv[4]) local_git_version = os.getenv("LDK_GARBAGECOLLECTED_GIT_OVERRIDE") if local_git_version is None: @@ -1058,3 +1058,4 @@ with open(f"{sys.argv[4]}/version.c", "w") as out_c: out_c.write(consts.c_version_file.replace('', local_git_version)) with open(f"{sys.argv[3]}/structs/UtilMethods{consts.file_ext}", "a") as util: util.write(consts.util_fn_sfx) +consts.cleanup() diff --git a/java_strings.py b/java_strings.py index ccde06e5..1b5be889 100644 --- a/java_strings.py +++ b/java_strings.py @@ -1384,3 +1384,6 @@ import javax.annotation.Nullable; out_java_struct += ("\t}\n\n") return (out_java, out_c, out_java_struct + extra_java_struct_out) + + def cleanup(self): + pass diff --git a/typescript_strings.py b/typescript_strings.py index 914c0189..9441a2ac 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -11,8 +11,8 @@ class Target(Enum): BROWSER = 2 class Consts: - def __init__(self, DEBUG: bool, target: Target, **kwargs): - + def __init__(self, DEBUG: bool, target: Target, outdir: str, **kwargs): + self.outdir = outdir self.c_type_map = dict( uint8_t = ['number', 'Uint8Array'], uint16_t = ['number', 'Uint16Array'], @@ -1160,3 +1160,6 @@ const decodeString = (stringPointer, free = true) => { out_java_struct += ("\t}\n\n") return (out_java, out_c, out_java_struct) + + def cleanup(self): + pass -- 2.30.2