Files
openvino/tests/utils/path_utils.py
Ilya Lavrenov 0df7dab345 New IRC package structure (#6255)
* OV new package structure

* Fixes

* More fixes

* Fixed code style in ngraph tests

* Fixes

* Paths to setupvars inside demo scripts

* Fixed demo_security_barrier_camera.sh

* Added setupvars.sh to old location as well

* Fixed path

* Fixed MO install path in .co

* Fixed install of public headers

* Fixed frontends installation

* Updated DM config files

* Keep opencv in the root

* Improvements

* Fixes for demo scripts

* Added path to TBB

* Fix for MO unit-tests

* Fixed tests on Windows

* Reverted arch

* Removed arch

* Reverted arch back: second attemp

* System type

* Fix for Windows

* Resolve merge conflicts

* Fixed path

* Path for Windows

* Added debug for Windows

* Added requirements_dev.txt to install

* Fixed wheel's setup.py

* Fixed lin build

* Fixes after merge

* Fix 2

* Fixes

* Frontends path

* Fixed deployment manager

* Fixed Windows

* Added cldnn unit tests installation

* Install samples

* Fix samples

* Fix path for samples

* Proper path

* Try to fix MO hardcodes

* samples binary location

* MO print

* Added install for libopencv_c_wrapper.so

* Added library destination

* Fixed install rule for samples

* Updated demo scripts readme.md

* Samples

* Keep source permissions for Python samples

* Fixed python

* Updated path to fast run scripts

* Fixed C samples tests

* Removed debug output

* Small fixes

* Try to unify prefix
2021-09-15 16:49:11 +03:00

59 lines
1.7 KiB
Python

#!/usr/bin/env python3
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
""" Common utilities for working with paths
"""
import argparse
import os
import sys
from pathlib import Path
# add utils folder to imports
UTILS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, str(UTILS_DIR))
from platform_utils import get_os_name
def expand_env_vars(obj):
"""Expand environment variables in provided object."""
if isinstance(obj, list):
for i, value in enumerate(obj):
obj[i] = expand_env_vars(value)
elif isinstance(obj, dict):
for name, value in obj.items():
obj[name] = expand_env_vars(value)
else:
obj = os.path.expandvars(obj)
return obj
def get_lib_path(lib_name):
"""Function for getting absolute path in OpenVINO directory to specific lib"""
os_name = get_os_name()
all_libs = {
'inference_engine_transformations': {
'Windows': Path('runtime/bin/intel64/Release/inference_engine_transformations.dll'),
'Linux': Path('runtime/lib/intel64/libinference_engine_transformations.so')},
'MKLDNNPlugin': {
'Windows': Path('runtime/bin/intel64/Release/MKLDNNPlugin.dll'),
'Linux': Path('runtime/lib/intel64/libMKLDNNPlugin.so')},
'ngraph': {
'Windows': Path('runtime/bin/intel64/Release/ngraph.dll'),
'Linux': Path('runtime/lib/intel64/libngraph.so')}
}
return all_libs[lib_name][os_name]
def check_positive_int(val):
"""Check argsparse argument is positive integer and return it"""
value = int(val)
if value < 1:
msg = "%r is less than 1" % val
raise argparse.ArgumentTypeError(msg)
return value