From 0a0ec505db4d5cd9b59340b0fdc892058260d5c1 Mon Sep 17 00:00:00 2001 From: Ofek Date: Thu, 21 Dec 2023 23:18:54 +0200 Subject: [PATCH] More fixes towards windows conformance --- scripts/common.py | 9 ++++++++- scripts/run_gen.py | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/common.py b/scripts/common.py index 564adfc..c25b2e8 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -27,6 +27,7 @@ import errno import logging import os +import platform import shutil import signal import subprocess @@ -231,7 +232,7 @@ def check_dir_and_create(directory): print_and_exit("Can't use '" + norm_dir + "' directory") -def run_cmd(cmd, time_out=None, num=-1, memory_limit=None): +def run_cmd(cmd, time_out=None, num=-1, memory_limit=None, compilation_cmd=True): is_time_expired = False shell = False if memory_limit is not None: @@ -239,6 +240,12 @@ def run_cmd(cmd, time_out=None, num=-1, memory_limit=None): new_cmd = "ulimit -v " + str(memory_limit) + " ; " new_cmd += " ".join(i for i in cmd) cmd = new_cmd + if platform.system() == "Windows" and compilation_cmd: + shell = True + new_cmd = "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat ; " + new_cmd += " ".join(i for i in cmd) + cmd = new_cmd + start_time = os.times() with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, start_new_session=True, shell=shell) as process: try: diff --git a/scripts/run_gen.py b/scripts/run_gen.py index 03ad5d1..0dddd98 100755 --- a/scripts/run_gen.py +++ b/scripts/run_gen.py @@ -29,6 +29,7 @@ import multiprocessing import multiprocessing.managers import os +import platform import re import shutil import stat @@ -1510,6 +1511,8 @@ def prepare_env_and_start_testing(out_dir, timeout, targets, num_jobs, config_fi # Check for binary of generator yarpgen_bin = os.path.abspath(common.yarpgen_scripts + os.sep + "yarpgen") + if(platform.system() == "Windows"): + yarpgen_bin += ".exe" common.check_and_copy(yarpgen_bin, out_dir) ret_code, output, err_output, time_expired, elapsed_time = common.run_cmd([yarpgen_bin, "-v"], yarpgen_timeout, 0) common.yarpgen_version_str = str(output, "utf-8")