From 3ec141000c8003c8571275ee54ff78b40b30ad2a Mon Sep 17 00:00:00 2001 From: "@ran-zhao-yu" Date: Mon, 6 Jan 2025 14:05:14 +0800 Subject: [PATCH 1/4] jsoncpp install script Signed-off-by: @ran-zhao-yu --- install.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/install.py b/install.py index 31c7ad4..6bdff88 100755 --- a/install.py +++ b/install.py @@ -18,14 +18,16 @@ import os import subprocess import sys +THIS_FILE_PATH = os.path.dirname(os.parh.abspath(__file__)) -def untar_file(tar_file_path, extract_path, args): +def untar_file(tar_file_path, extract_path, extract_dir_path): try: if os.path.exists(extract_path): rm_cmd = ['rm', '-rf', extract_path] subprocess.run(rm_cmd, check=True) - tar_cmd = ['tar', '-zxvf', tar_file_path, '-C', args.gen_dir] + tar_cmd = ['tar', '-zxvf', tar_file_path, '-C', extract_dir_path] + print("tar_cmd:{}".format(tar_cmd)) subprocess.run(tar_cmd, check=True) except Exception as e: @@ -39,6 +41,7 @@ def apply_patch(patch_file, target_dir): return patch_cmd = ['patch', '-p1', "--fuzz=0", "--no-backup-if-mismatch", '-i', patch_file, '-d', target_dir] + print("tar_cmd:{}".format(patch_cmd)) subprocess.run(patch_cmd, check=True) except Exception as e: @@ -58,6 +61,21 @@ def do_patch(args, target_dir): file_path = os.path.join(args.source_file, patch) apply_patch(file_path, target_dir) +def do_patch(source_dir, target_dir): + try: + cp_cmd = ["cp", "-rf", source_dir, target_dir] + print("cp_cmd:{}".format(cp_cmd)) + subprocess.run(cp_cmd, check=True) + except Exception as e: + print("copy error!") + return +def do_remove(target_dir): + try: + rm_cmd = ["rm", "-rf", target_dir] + subprocess.run(rm_cmd, check=True) + except Exception as e: + print("remove dir:%s error!" % target_dir) + return def main(): libpng_path = argparse.ArgumentParser() -- Gitee From e5e3a6c110c666367de98c39156128ead586bbff Mon Sep 17 00:00:00 2001 From: "@ran-zhao-yu" Date: Mon, 6 Jan 2025 14:07:58 +0800 Subject: [PATCH 2/4] jsoncpp install script Signed-off-by: @ran-zhao-yu --- install.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/install.py b/install.py index 6bdff88..6f542c8 100755 --- a/install.py +++ b/install.py @@ -83,9 +83,11 @@ def main(): libpng_path.add_argument('--source-file', help='jsoncpp source compressed dir') args = libpng_path.parse_args() tar_file_path = os.path.join(args.source_file, "jsoncpp-1.9.5.tar.gz") - target_dir = os.path.join(args.gen_dir, "jsoncpp-1.9.5") - untar_file(tar_file_path, target_dir, args) - do_patch(args, target_dir) + tmp_dir = os.path.join(THIS_FILE_PATH, "jsoncpp-1.9.5") + untar_file(tar_file_path, tmp_dir, THIS_FILE_PATH) + do_patch(args, tmp_dir) + do_copy(tmp_dir, args.gen_dir) + do_remove(tmp_dir) return 0 -- Gitee From 98c5c1f5c9d88f05cad8527fe8b728b568377fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Tue, 7 Jan 2025 01:27:26 +0000 Subject: [PATCH 3/4] update install.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.py b/install.py index 6f542c8..bbde00c 100755 --- a/install.py +++ b/install.py @@ -18,7 +18,7 @@ import os import subprocess import sys -THIS_FILE_PATH = os.path.dirname(os.parh.abspath(__file__)) +THIS_FILE_PATH = os.path.dirname(os.path.abspath(__file__)) def untar_file(tar_file_path, extract_path, extract_dir_path): try: -- Gitee From 431fed0e79fdcba292afdf658f5161d196e73b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Tue, 7 Jan 2025 02:11:17 +0000 Subject: [PATCH 4/4] update install.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.py b/install.py index bbde00c..d272710 100755 --- a/install.py +++ b/install.py @@ -41,7 +41,7 @@ def apply_patch(patch_file, target_dir): return patch_cmd = ['patch', '-p1', "--fuzz=0", "--no-backup-if-mismatch", '-i', patch_file, '-d', target_dir] - print("tar_cmd:{}".format(patch_cmd)) + print("patch_cmd:{}".format(patch_cmd)) subprocess.run(patch_cmd, check=True) except Exception as e: @@ -61,7 +61,7 @@ def do_patch(args, target_dir): file_path = os.path.join(args.source_file, patch) apply_patch(file_path, target_dir) -def do_patch(source_dir, target_dir): +def do_copy(source_dir, target_dir): try: cp_cmd = ["cp", "-rf", source_dir, target_dir] print("cp_cmd:{}".format(cp_cmd)) -- Gitee