diff --git a/src/codechecker.bzl b/src/codechecker.bzl index 6030b201..a73cd094 100644 --- a/src/codechecker.bzl +++ b/src/codechecker.bzl @@ -27,7 +27,6 @@ load( ) load( "common.bzl", - "python_path", "python_toolchain_type", "version_specific_attributes", ) @@ -104,7 +103,6 @@ def _codechecker_impl(ctx): substitutions = { "{Mode}": "Run", "{Verbosity}": "DEBUG", - "{PythonPath}": python_path(ctx), # "/usr/bin/env python3", "{codechecker_bin}": CODECHECKER_BIN_PATH, "{compile_commands}": ctx.outputs.codechecker_commands.path, "{codechecker_skipfile}": ctx.outputs.codechecker_skipfile.path, @@ -233,7 +231,6 @@ def _codechecker_test_impl(ctx): substitutions = { "{Mode}": "Test", "{Verbosity}": "INFO", - "{PythonPath}": python_path(ctx), # "/usr/bin/env python3", "{codechecker_bin}": CODECHECKER_BIN_PATH, "{codechecker_files}": codechecker_files.short_path, "{Severities}": " ".join(ctx.attr.severities), diff --git a/src/codechecker_script.py b/src/codechecker_script.py index dd87a74a..4860a283 100644 --- a/src/codechecker_script.py +++ b/src/codechecker_script.py @@ -1,4 +1,4 @@ -#!{PythonPath} +#!/usr/bin/env python3 # Copyright 2023 Ericsson AB # diff --git a/src/common.bzl b/src/common.bzl index 198b800e..2a7ca856 100644 --- a/src/common.bzl +++ b/src/common.bzl @@ -50,23 +50,6 @@ def python_toolchain_type(): return "@bazel_tools//tools/python:toolchain_type" return "@rules_python//python:toolchain_type" -def python_path(ctx): - """ - Returns version specific Python path - """ - py_toolchain = ctx.toolchains[python_toolchain_type()] - if hasattr(py_toolchain, "py3_runtime_info"): - py_runtime_info = py_toolchain.py3_runtime_info - python_path = py_runtime_info.interpreter - elif hasattr(py_toolchain, "py3_runtime"): - py_runtime = py_toolchain.py3_runtime - python_path = py_runtime.interpreter_path - else: - fail("The resolved Python toolchain does not provide a Python3 runtime.") - if not python_path: - fail("The resolved Python toolchain does not provide a Python3 interpreter.") - return python_path - def warning(ctx, msg): """ Prints message if the debug tag is enabled. diff --git a/src/per_file.bzl b/src/per_file.bzl index 8a9be0fa..199791d6 100644 --- a/src/per_file.bzl +++ b/src/per_file.bzl @@ -126,7 +126,6 @@ def _create_wrapper_script(ctx, options, compile_commands_json, config_file): output = ctx.outputs.per_file_script, is_executable = True, substitutions = { - "{PythonPath}": ctx.attr._python_runtime[PyRuntimeInfo].interpreter_path, "{compile_commands_json}": compile_commands_json.path, "{codechecker_args}": options_str, "{config_file}": config_file.path, diff --git a/src/per_file_script.py b/src/per_file_script.py index 1cfad4b9..d64b7a6c 100644 --- a/src/per_file_script.py +++ b/src/per_file_script.py @@ -1,4 +1,4 @@ -#!{PythonPath} +#!/usr/bin/env python3 # Copyright 2023 Ericsson AB #