Fixed issues in setupvars.sh (#15884)
* Fixed issues with setupvar.sh * Fixes setupvars realpath error --------- Co-authored-by: Otoka, Tomasz <tomasz.otoka@intel.com>
This commit is contained in:
parent
eaf368a5f5
commit
98392a043b
@ -15,11 +15,6 @@ set(shellcheck_skip_list
|
|||||||
"${OpenVINO_SOURCE_DIR}/src/bindings/python/thirdparty/pybind11"
|
"${OpenVINO_SOURCE_DIR}/src/bindings/python/thirdparty/pybind11"
|
||||||
"${TEMP}")
|
"${TEMP}")
|
||||||
|
|
||||||
if(shellcheck_VERSION VERSION_GREATER_EQUAL 0.7.0)
|
|
||||||
list(APPEND shellcheck_skip_list
|
|
||||||
"${OpenVINO_SOURCE_DIR}/scripts/setupvars/setupvars.sh")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
ie_shellcheck_process(DIRECTORY "${OpenVINO_SOURCE_DIR}"
|
ie_shellcheck_process(DIRECTORY "${OpenVINO_SOURCE_DIR}"
|
||||||
SKIP ${shellcheck_skip_list})
|
SKIP ${shellcheck_skip_list})
|
||||||
|
|
||||||
|
@ -3,7 +3,13 @@
|
|||||||
# Copyright (C) 2018-2023 Intel Corporation
|
# Copyright (C) 2018-2023 Intel Corporation
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE[0]}")" )" >/dev/null 2>&1 && pwd )"
|
abs_path () {
|
||||||
|
path=$(eval echo "$1")
|
||||||
|
directory=$(dirname "$path")
|
||||||
|
echo "$(cd "$directory" || exit; pwd -P)/$(basename "$path")";
|
||||||
|
}
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "$(abs_path "${BASH_SOURCE[0]}")" )" >/dev/null 2>&1 && pwd )"
|
||||||
INSTALLDIR="${SCRIPT_DIR}"
|
INSTALLDIR="${SCRIPT_DIR}"
|
||||||
export INTEL_OPENVINO_DIR="$INSTALLDIR"
|
export INTEL_OPENVINO_DIR="$INSTALLDIR"
|
||||||
|
|
||||||
@ -79,10 +85,12 @@ fi
|
|||||||
|
|
||||||
# OpenCV environment
|
# OpenCV environment
|
||||||
if [ -f "$INSTALLDIR/opencv/setupvars.sh" ]; then
|
if [ -f "$INSTALLDIR/opencv/setupvars.sh" ]; then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$INSTALLDIR/opencv/setupvars.sh"
|
source "$INSTALLDIR/opencv/setupvars.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$INSTALLDIR/extras/opencv/setupvars.sh" ]; then
|
if [ -f "$INSTALLDIR/extras/opencv/setupvars.sh" ]; then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$INSTALLDIR/extras/opencv/setupvars.sh"
|
source "$INSTALLDIR/extras/opencv/setupvars.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -97,23 +105,12 @@ MAX_SUPPORTED_PYTHON_VERSION_MINOR="10"
|
|||||||
|
|
||||||
check_python_version () {
|
check_python_version () {
|
||||||
if [ -z "$python_version" ]; then
|
if [ -z "$python_version" ]; then
|
||||||
python_version=$(python3 -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')
|
python_version_major=$( python3 -c 'import sys; print(str(sys.version_info[0]))' )
|
||||||
fi
|
python_version_minor=$( python3 -c 'import sys; print(str(sys.version_info[1]))' )
|
||||||
|
python_version="$python_version_major.$python_version_minor"
|
||||||
# splitting Python version variable depending on the used shell
|
|
||||||
if [ -n "$ZSH_VERSION" ]; then
|
|
||||||
version_arr=(${(@s:.:)python_version})
|
|
||||||
if [ "${#version_arr[@]}" -ge "2" ]; then
|
|
||||||
# zsh starts indexing from 1
|
|
||||||
python_version_major=${version_arr[1]}
|
|
||||||
python_version_minor=${version_arr[2]}
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
version_arr=(${python_version//./ })
|
python_version_major=$( python3 -c "import sys; print(str(\"${python_version}\".split('.')[0]))" )
|
||||||
if [ "${#version_arr[@]}" -ge "2" ]; then
|
python_version_minor=$( python3 -c "import sys; print(str(\"${python_version}\".split('.')[1]))" )
|
||||||
python_version_major=${version_arr[0]}
|
|
||||||
python_version_minor=${version_arr[1]}
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PYTHON_VERSION_MAJOR" != "$python_version_major" ] ||
|
if [ "$PYTHON_VERSION_MAJOR" != "$python_version_major" ] ||
|
||||||
|
Loading…
Reference in New Issue
Block a user