Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_builder.py: Do not use os.system, as it encodes the return value #823

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fpga/usrp3/tools/utils/repeat_fpga_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 3 additions & 10 deletions host/python/uhd/rfnoc_utils/image_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -289,15 +286,11 @@ 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:
logging.debug("Temporarily changing working directory to %s", fpga_top_dir)
os.chdir(fpga_top_dir)
make_cmd = f'{BASH_EXECUTABLE} -c "{make_cmd}"'
logging.info("Executing the following command: %s", make_cmd)
ret_val = os.system(make_cmd)
my_env = os.environ.copy()
ret_val = subprocess.call(make_cmd, shell=True, env=my_env, cwd=fpga_top_dir)
if ret_val == 0 and args.get("secure_core"):
patch_netlist_constraints(device, build_dir)
os.chdir(cwd)
return ret_val


Expand Down
Loading