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

Python upgrade 3.0 #19

Open
wants to merge 1 commit into
base: 5.0.0
Choose a base branch
from
Open
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
24 changes: 12 additions & 12 deletions scripts/CodeCoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def get_project_name_from_CMakeLists_file(full_file_path):
return False, ""

def print_error_and_usage(argParser, error):
print "Error: " + error + "\n"
print argParser.print_help()
print("Error: " + error + "\n")
print(argParser.print_help())
sys.exit(2)

def santize_input_args(arg_parser, args):
Expand Down Expand Up @@ -94,9 +94,9 @@ def run_gcovr(project_name, whitelist_filter, blacklist_filter):
GCOVR_CMD_STR = GCOVR + ' ' + FLAGS + ' ' + OUTPUT_FILE
try:
ret_code = subprocess.check_call([GCOVR_CMD_STR], stderr=subprocess.STDOUT, shell=True)
print "Gcovr process return code: " + str(ret_code)
print("Gcovr process return code: " + str(ret_code))
except:
print "ERROR: Gcovr process failed! : \n" + GCOVR_CMD_STR
print("ERROR: Gcovr process failed! : \n" + GCOVR_CMD_STR)
sys.exit(1)

def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir):
Expand All @@ -113,16 +113,16 @@ def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir):

try:
ret_code = subprocess.check_call([CP_COV_FILES_STR], stderr=subprocess.STDOUT, shell=True)
print "Copy coverage files into coverage directory return code: " + str(ret_code)
print("Copy coverage files into coverage directory return code: " + str(ret_code))
except:
print "ERROR: Copy coverage files into coverage directory failed!"
print("ERROR: Copy coverage files into coverage directory failed!")
sys.exit(1)

def format_user_list(user_list):
formatted_list = None
if user_list is not None:
for whitelist_item in user_list.split():
print "Split into : " + whitelist_item
print("Split into : " + whitelist_item)
if formatted_list is None:
formatted_list = '.*' + whitelist_item + '$'
else:
Expand Down Expand Up @@ -153,7 +153,7 @@ def main(argv):

found_project_name, project_name = get_project_name_from_CMakeLists_file(full_file_path=CMAKEFILEPATH)
if not found_project_name:
print "ERROR: No project name found in CMakeLists.txt"
print("ERROR: No project name found in CMakeLists.txt")
sys.exit(2)

LAUNCH_DIR = os.getcwd()
Expand All @@ -167,20 +167,20 @@ def main(argv):
global DEFAULT_BLACKLIST
if os.path.exists("/usr/local/probe/bin/gcovr"):
PROBE_BUILD=True
print "Using /usr/local/gcc/bin and /usr/local/probe/bin as the default paths"
print("Using /usr/local/gcc/bin and /usr/local/probe/bin as the default paths")
else:
PROBE_BUILD=False
print "Using /usr/local/ as the default path"
print("Using /usr/local/ as the default path")
DEFAULT_BLACKLIST = "/usr/local/.*"



if args.whitelist:
USER_WHITELIST = args.whitelist
print "USER_WHITELIST = " + USER_WHITELIST
print("USER_WHITELIST = " + USER_WHITELIST)
if args.blacklist:
USER_BLACKLIST = args.blacklist
print "USER_BLACKLIST = " + USER_BLACKLIST
print("USER_BLACKLIST = " + USER_BLACKLIST)

unzip_file(full_file_path=GTEST_ZIP_PATH, directory_to_extract_to="thirdparty")
clean_and_build_directory(dir_path="coverage")
Expand Down