From 0e179bdc6c68bd36e85f4cb9716a41b3ca2fffd5 Mon Sep 17 00:00:00 2001 From: Frederik Pfautsch Date: Tue, 17 Dec 2024 14:11:02 +0100 Subject: [PATCH] Get rid of unnecessary bash wrappers in subprocesses.Popen Signed-off-by: Frederik Pfautsch --- fpga/usrp3/tools/utils/repeat_fpga_build.py | 2 +- host/python/uhd/rfnoc_utils/image_builder.py | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/fpga/usrp3/tools/utils/repeat_fpga_build.py b/fpga/usrp3/tools/utils/repeat_fpga_build.py index 0003debce5..d613782df9 100755 --- a/fpga/usrp3/tools/utils/repeat_fpga_build.py +++ b/fpga/usrp3/tools/utils/repeat_fpga_build.py @@ -436,7 +436,7 @@ def run_ip_build( logging.info(f"Running IP build with command: {cmd}") output = "" with subprocess.Popen( - f'/bin/bash -c "{cmd}"', + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, diff --git a/host/python/uhd/rfnoc_utils/image_builder.py b/host/python/uhd/rfnoc_utils/image_builder.py index 006a133ab8..56a1677a5a 100644 --- a/host/python/uhd/rfnoc_utils/image_builder.py +++ b/host/python/uhd/rfnoc_utils/image_builder.py @@ -31,9 +31,6 @@ USRP3_LIB_RFNOC_DIR = os.path.join("usrp3", "lib", "rfnoc") -# Path to the system's bash executable -BASH_EXECUTABLE = "/bin/bash" # FIXME this should come from somewhere - # Map device names to the corresponding directory under usrp3/top DEVICE_DIR_MAP = { "x300": "x300", @@ -86,7 +83,7 @@ def get_vivado_path(fpga_top_dir, args): get_viv_path_cmd = '. ./setupenv.sh && echo "VIVADO_PATH=\$VIVADO_PATH"' try: output = subprocess.check_output( - f'{BASH_EXECUTABLE} -c "{get_viv_path_cmd}"', + get_viv_path_cmd, shell=True, cwd=fpga_top_dir, text=True, @@ -289,8 +286,6 @@ def build(fpga_top_dir, device, build_dir, use_secure_netlist, **args): logging.info(" * Build Artifacts Directory: %s", build_dir) logging.info(" * Build Output Directory: %s", build_output_dir) logging.info(" * Build IP Directory: %s", build_ip_dir) - # Wrap it into a bash call: - make_cmd = f'{BASH_EXECUTABLE} -c "{make_cmd}"' logging.info("Executing the following command: %s", make_cmd) my_env = os.environ.copy() ret_val = subprocess.call(make_cmd, shell=True, env=my_env, cwd=fpga_top_dir)