From a977ddce0de404c0df730265d7dcc0274ab6ce65 Mon Sep 17 00:00:00 2001 From: akuporos Date: Thu, 16 Sep 2021 10:34:59 +0300 Subject: [PATCH] fix azure ci --- .ci/azure/linux.yml | 5 +++- runtime/bindings/python/CMakeLists.txt | 2 ++ runtime/bindings/python/setup.py | 25 ++++++++----------- .../python/src/pyopenvino/CMakeLists.txt | 1 - 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index d949cf656b4541..cf60403f78918f 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -184,7 +184,10 @@ jobs: continueOnError: false # Skip test_onnx/test_zoo_models and test_onnx/test_backend due to long execution time - - script: . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_TEST_DIR)/pyngraph --junitxml=TEST-Pyngraph.xml --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_zoo_models.py --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_backend.py + - script: | + export DATA_PATH=$(MODELS_PATH) + export MODELS_PATH=$(MODELS_PATH) + . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_TEST_DIR)/pyngraph --junitxml=TEST-Pyngraph.xml --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_zoo_models.py --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_backend.py displayName: 'nGraph Python Bindings Tests' continueOnError: false diff --git a/runtime/bindings/python/CMakeLists.txt b/runtime/bindings/python/CMakeLists.txt index 4cd2d7b6efcebe..cd0df6ac4c1ca1 100644 --- a/runtime/bindings/python/CMakeLists.txt +++ b/runtime/bindings/python/CMakeLists.txt @@ -8,6 +8,8 @@ project(OpenVINOPython DESCRIPTION "OpenVINO Runtime Python bindings") add_subdirectory(thirdparty/pybind11 EXCLUDE_FROM_ALL) +find_package(PythonLibs 3 REQUIRED) + if(PYTHONLIBS_VERSION_STRING MATCHES "^([0-9]+)\.([0-9]+).*") set(PYTHON_VERSION python${CMAKE_MATCH_1}.${CMAKE_MATCH_2}) else() diff --git a/runtime/bindings/python/setup.py b/runtime/bindings/python/setup.py index 0b7b43b3f640ee..82c4404c63ffaa 100644 --- a/runtime/bindings/python/setup.py +++ b/runtime/bindings/python/setup.py @@ -17,12 +17,13 @@ from distutils.command.build import build as _build __version__ = os.environ.get("NGRAPH_VERSION", "0.0.0.dev0") -PYNGRAPH_ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) -OPENVINO_ROOT_DIR = os.path.normpath(os.path.join(PYNGRAPH_ROOT_DIR, "../../..")) +PYTHON_API_ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) +PYNGRAPH_ROOT_DIR = os.path.normpath(os.path.join(PYTHON_API_ROOT_DIR, "src", "compatibility")) +OPENVINO_ROOT_DIR = os.path.normpath(os.path.join(PYTHON_API_ROOT_DIR, "../../..")) # Change current working directory to runtime/bindings/python os.chdir(PYNGRAPH_ROOT_DIR) -NGRAPH_LIBS = ["ngraph", "onnx_ngraph_frontend", "inference_engine"] +NGRAPH_LIBS = ["ngraph", "onnx_ngraph_frontend"] packages = [ "ngraph", @@ -40,18 +41,16 @@ "ngraph.impl.op.util", "ngraph.impl.passes", "ngraph.frontend", - "openvino", - "openvino.inference_engine" ] - data_files = [] -with open(os.path.join(PYNGRAPH_ROOT_DIR, "requirements.txt")) as req: +with open(os.path.join(PYTHON_API_ROOT_DIR, "requirements.txt")) as req: requirements = req.read().splitlines() cmdclass = {} for super_class in [_build, _install, _develop]: + class command(super_class): """Add user options for build, install and develop commands.""" @@ -61,6 +60,7 @@ class command(super_class): ("jobs=", None, "Specifies the number of jobs to use with make."), ("cmake-args=", None, "Additional options to be passed to CMake.") ] + def initialize_options(self): """Set default values for all the options that this command supports.""" super().initialize_options() @@ -130,8 +130,6 @@ def finalize_options(self): def run(self): """Run CMake build for modules.""" for extension in self.extensions: - if extension.name == "pyopenvino": - self.build_cmake(extension) if extension.name == "_pyngraph": self.build_cmake(extension) @@ -143,8 +141,6 @@ def build_cmake(self, extension: Extension): build_dir = pathlib.Path(self.build_temp) extension_path = pathlib.Path(self.get_ext_fullpath(extension.name)) - if extension.name == "pyopenvino": - extension_path = pathlib.Path(os.path.join(extension_path.parent.absolute(), "openvino")) os.makedirs(build_dir, exist_ok=True) os.makedirs(extension_path.parent.absolute(), exist_ok=True) @@ -161,8 +157,7 @@ def build_cmake(self, extension: Extension): ext_args = self.cmake_args.split() if self.cmake_args else [] self.spawn(["cmake", "-S" + root_dir, "-B" + self.build_temp, "-DCMAKE_BUILD_TYPE={}".format(self.config), - "-DPYTHON_EXECUTABLE={}".format(sys.executable), - "-DNGRAPH_PYTHON_BUILD_ENABLE=ON", + "-DENABLE_PYTHON=ON", "-DNGRAPH_ONNX_FRONTEND_ENABLE=ON"] + ext_args) self.announce("Building binaries", level=3) @@ -222,8 +217,8 @@ def run(self): author="Intel Corporation", url="https://github.com/openvinotoolkit/openvino", license="License :: OSI Approved :: Apache Software License", - ext_modules=[CMakeExtension(name="_pyngraph"), CMakeExtension(name="pyopenvino")], - package_dir={"": "src/compatibility"}, + ext_modules=[CMakeExtension(name="_pyngraph")], + package_dir={"": ""}, packages=packages, install_requires=requirements, data_files=data_files, diff --git a/runtime/bindings/python/src/pyopenvino/CMakeLists.txt b/runtime/bindings/python/src/pyopenvino/CMakeLists.txt index d56d33e96824ef..ec94ceb94ad1d9 100644 --- a/runtime/bindings/python/src/pyopenvino/CMakeLists.txt +++ b/runtime/bindings/python/src/pyopenvino/CMakeLists.txt @@ -41,7 +41,6 @@ if(OpenVINO_SOURCE_DIR) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../openvino ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PROJECT_NAME}.*.so ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ) endif()