From bf4244cbe0c9c3638a2b4c2a59187edbd60f21e4 Mon Sep 17 00:00:00 2001 From: Alicja Miloszewska Date: Fri, 13 Dec 2024 21:26:00 +0100 Subject: [PATCH] Fix _add_openvino_libs_to_search_path Signed-off-by: Alicja Miloszewska --- src/bindings/python/src/openvino/__init__.py | 2 +- .../python/src/openvino/{utils => }/package_utils.py | 12 ++++++------ src/bindings/python/src/openvino/utils/__init__.py | 10 ++++------ tools/benchmark_tool/openvino/__init__.py | 2 +- tools/ovc/openvino/__init__.py | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) rename src/bindings/python/src/openvino/{utils => }/package_utils.py (93%) diff --git a/src/bindings/python/src/openvino/__init__.py b/src/bindings/python/src/openvino/__init__.py index e4d1a247520332..c3f6dece338c70 100644 --- a/src/bindings/python/src/openvino/__init__.py +++ b/src/bindings/python/src/openvino/__init__.py @@ -7,7 +7,7 @@ # Required for Windows OS platforms # Note: always top-level try: - from openvino.utils import _add_openvino_libs_to_search_path + from openvino.package_utils import _add_openvino_libs_to_search_path _add_openvino_libs_to_search_path() except ImportError: pass diff --git a/src/bindings/python/src/openvino/utils/package_utils.py b/src/bindings/python/src/openvino/package_utils.py similarity index 93% rename from src/bindings/python/src/openvino/utils/package_utils.py rename to src/bindings/python/src/openvino/package_utils.py index d0046bc5e4c5f8..6aa3f3ed39b556 100644 --- a/src/bindings/python/src/openvino/utils/package_utils.py +++ b/src/bindings/python/src/openvino/package_utils.py @@ -18,12 +18,12 @@ def _add_openvino_libs_to_search_path() -> None: # If you're using a custom installation of openvino, # add the location of openvino dlls to your system PATH. openvino_libs = [] - if os.path.isdir(os.path.join(os.path.dirname(__file__), os.pardir, "libs")): + if os.path.isdir(os.path.join(os.path.dirname(__file__), "libs")): # looking for the libs in the pip installation path. - openvino_libs.append(os.path.join(os.path.dirname(__file__), os.pardir, "libs")) - elif os.path.isdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir, "Library", "bin")): + openvino_libs.append(os.path.join(os.path.dirname(__file__), "libs")) + elif os.path.isdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, "Library", "bin")): # looking for the libs in the conda installation path - openvino_libs.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir, "Library", "bin")) + openvino_libs.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, "Library", "bin")) else: # setupvars.bat script set all libs paths to OPENVINO_LIB_PATHS environment variable. openvino_libs_installer = os.getenv("OPENVINO_LIB_PATHS") @@ -33,7 +33,7 @@ def _add_openvino_libs_to_search_path() -> None: sys.exit("Error: Please set the OPENVINO_LIB_PATHS environment variable. " "If you use an install package, please, run setupvars.bat") for lib in openvino_libs: - lib_path = os.path.join(os.path.dirname(__file__), os.pardir, lib) + lib_path = os.path.join(os.path.dirname(__file__), lib) if os.path.isdir(lib_path): # On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH. os.add_dll_directory(os.path.abspath(lib_path)) @@ -45,7 +45,7 @@ def get_cmake_path() -> str: :return: The path to the directory containing CMake files, if found. Otherwise, returns empty string. :rtype: str """ - package_path = Path(__file__).parent.parent + package_path = Path(__file__).parent cmake_file = "OpenVINOConfig.cmake" for dirpath, _, filenames in os.walk(package_path): diff --git a/src/bindings/python/src/openvino/utils/__init__.py b/src/bindings/python/src/openvino/utils/__init__.py index 7cec47f587a81d..2ccc79d20cce84 100644 --- a/src/bindings/python/src/openvino/utils/__init__.py +++ b/src/bindings/python/src/openvino/utils/__init__.py @@ -6,9 +6,7 @@ from openvino._pyopenvino.util import numpy_to_c, replace_node, replace_output_update_name -from openvino.utils.package_utils import _add_openvino_libs_to_search_path -from openvino.utils.package_utils import get_cmake_path -from openvino.utils.package_utils import deprecated -from openvino.utils.package_utils import _ClassPropertyDescriptor -from openvino.utils.package_utils import classproperty -from openvino.utils.package_utils import deprecatedclassproperty +from openvino.package_utils import get_cmake_path +from openvino.package_utils import deprecated +from openvino.package_utils import classproperty +from openvino.package_utils import deprecatedclassproperty diff --git a/tools/benchmark_tool/openvino/__init__.py b/tools/benchmark_tool/openvino/__init__.py index e4d1a247520332..c3f6dece338c70 100644 --- a/tools/benchmark_tool/openvino/__init__.py +++ b/tools/benchmark_tool/openvino/__init__.py @@ -7,7 +7,7 @@ # Required for Windows OS platforms # Note: always top-level try: - from openvino.utils import _add_openvino_libs_to_search_path + from openvino.package_utils import _add_openvino_libs_to_search_path _add_openvino_libs_to_search_path() except ImportError: pass diff --git a/tools/ovc/openvino/__init__.py b/tools/ovc/openvino/__init__.py index e4d1a247520332..c3f6dece338c70 100644 --- a/tools/ovc/openvino/__init__.py +++ b/tools/ovc/openvino/__init__.py @@ -7,7 +7,7 @@ # Required for Windows OS platforms # Note: always top-level try: - from openvino.utils import _add_openvino_libs_to_search_path + from openvino.package_utils import _add_openvino_libs_to_search_path _add_openvino_libs_to_search_path() except ImportError: pass