From 20f006c58053ee77d440ed4aa28837b07f85aedd Mon Sep 17 00:00:00 2001 From: Edward Chen <18449977+edgchen1@users.noreply.github.com> Date: Mon, 9 Aug 2021 14:10:36 -0700 Subject: [PATCH] Remove flake8 check from CMake build. (#8662) --- cmake/CMakeLists.txt | 2 - cmake/flake8.cmake | 76 ------------------- .../perf/build/install_common_deps.sh | 2 +- .../azure-pipelines/win-ci-fuzz-testing.yml | 2 +- .../azure-pipelines/win-ci-pipeline.yml | 6 +- .../azure-pipelines/win-gpu-ci-pipeline.yml | 2 +- .../win-gpu-cuda-10-2-pipeline.yml | 2 +- .../win-gpu-tensorrt-ci-pipeline.yml | 2 +- .../azure-pipelines/win-wasm-ci-pipeline.yml | 2 +- .../docker/scripts/manylinux/requirements.txt | 1 - .../linux/docker/scripts/requirements.txt | 1 - 11 files changed, 9 insertions(+), 89 deletions(-) delete mode 100644 cmake/flake8.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7dad46c79a..6b053a9a69 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1802,8 +1802,6 @@ if (WINDOWS_STORE) endif() endif() -include(flake8.cmake) - if(UNIX) option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" ON) else() diff --git a/cmake/flake8.cmake b/cmake/flake8.cmake deleted file mode 100644 index efaa09fa30..0000000000 --- a/cmake/flake8.cmake +++ /dev/null @@ -1,76 +0,0 @@ -# -# Setup running flake8 on python scripts to enforce PEP8 -# NOTE: Currently skips the check if flake8 is not installed. PRs editing python scripts are rare -# so don't want to add a hard dependency on flake8 to all builds. -# - -find_program(flake8_BIN NAMES flake8) - -if(flake8_BIN) - exec_program(${flake8_BIN} ARGS "--version" OUTPUT_VARIABLE FLAKE8_VERSION) -else() - # see if we can run the python module instead if there's no executable - set(FLAKE8_NOT_FOUND false) - exec_program("${Python_EXECUTABLE}" - ARGS "-m flake8 --version" - OUTPUT_VARIABLE FLAKE8_VERSION - RETURN_VALUE FLAKE8_NOT_FOUND) - if(${FLAKE8_NOT_FOUND}) - message(WARNING "Could not find 'flake8' to check python scripts. Please install flake8 using pip.") - else() - set(flake8_BIN ${Python_EXECUTABLE} "-m" "flake8") - endif(${FLAKE8_NOT_FOUND}) -endif() - -if(flake8_BIN) - # check flake8 version - string(REGEX MATCH "^([0-9])+\\.([0-9])+\\.([0-9])+" _flake8_ver_check "${FLAKE8_VERSION}") - if(NOT "${_flake8_ver_check}" STREQUAL "") - set(FLAKE8_VERSION_MAJOR ${CMAKE_MATCH_1}) - set(FLAKE8_VERSION_MINOR ${CMAKE_MATCH_2}) - else() - set(FLAKE8_VERSION_MAJOR 0) - set(FLAKE8_VERSION_MINOR 0) - endif() - - math(EXPR FLAKE8_VERSION_DECIMAL "(${FLAKE8_VERSION_MAJOR} * 100) + ${FLAKE8_VERSION_MINOR}") - - # require minimum version that we've tested with (3.8) - if (${FLAKE8_VERSION_DECIMAL} GREATER_EQUAL 308) - # need to exclude a subset of scripts from ${ONNXRUNTIME_ROOT} so create a complete - # list and then filter it - file(GLOB_RECURSE python_scripts CONFIGURE_DEPENDS - "${ONNXRUNTIME_ROOT}/*.py" - ) - - # generated flatbuffer schema files - list(FILTER python_scripts EXCLUDE REGEX "onnxruntime/core/flatbuffers/ort_flatbuffers_py") - - # scripts in these directories still need updating - list(FILTER python_scripts EXCLUDE REGEX "onnxruntime/core/providers/nuphar") - list(FILTER python_scripts EXCLUDE REGEX "onnxruntime/python/tools") - list(FILTER python_scripts EXCLUDE REGEX "onnxruntime/test") - - # can just add the 'tools' directory and flake8 will recurse into it - list(APPEND python_scripts ${REPO_ROOT}/tools/) - - # Training scripts need updating to make PEP8 compliant. - # file(GLOB_RECURSE training_scripts CONFIGURE_DEPENDS - # "${ORTTRAINING_ROOT}/*.py" - # ) - - source_group(TREE ${REPO_ROOT} FILES ${python_scripts}) - - add_custom_target(pep8_check - ALL - DEPENDS ${python_scripts} - WORKING_DIRECTORY - COMMAND echo "Checking python scripts for PEP8 conformance using flake8" - #MESSAGE(${python_scripts}) - COMMAND ${flake8_BIN} "--config" "${REPO_ROOT}/.flake8" ${python_scripts} - VERBATIM - ) - else() - message(WARNING "'flake8' version is too old. Requires 3.8 or later. Found ${FLAKE8_VERSION}") - endif() -endif() diff --git a/onnxruntime/python/tools/tensorrt/perf/build/install_common_deps.sh b/onnxruntime/python/tools/tensorrt/perf/build/install_common_deps.sh index 23b62f8ae8..fb830fceaf 100644 --- a/onnxruntime/python/tools/tensorrt/perf/build/install_common_deps.sh +++ b/onnxruntime/python/tools/tensorrt/perf/build/install_common_deps.sh @@ -13,7 +13,7 @@ apt-get update && apt-get install -y --no-install-recommends \ protobuf-compiler \ pciutils -pip install pandas coloredlogs numpy flake8 onnx Cython onnxmltools sympy packaging psutil mysql-connector-python SQLAlchemy +pip install pandas coloredlogs numpy onnx Cython onnxmltools sympy packaging psutil mysql-connector-python SQLAlchemy # Dependencies: cmake wget --quiet https://github.com/Kitware/CMake/releases/download/v3.18.3/cmake-3.18.3-Linux-x86_64.tar.gz diff --git a/tools/ci_build/github/azure-pipelines/win-ci-fuzz-testing.yml b/tools/ci_build/github/azure-pipelines/win-ci-fuzz-testing.yml index 4cf66690cf..a2b3917b67 100644 --- a/tools/ci_build/github/azure-pipelines/win-ci-fuzz-testing.yml +++ b/tools/ci_build/github/azure-pipelines/win-ci-fuzz-testing.yml @@ -37,7 +37,7 @@ jobs: workingFolder: '$(Build.BinariesDirectory)' - script: | - python -m pip install -q pyopenssl setuptools wheel numpy flake8 + python -m pip install -q pyopenssl setuptools wheel numpy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' diff --git a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml index fd5cc1408d..7fa0db13ab 100644 --- a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml @@ -81,7 +81,7 @@ jobs: displayName: 'API Documentation Check and generate' - script: | - python -m pip install -q pyopenssl setuptools wheel numpy flake8 + python -m pip install -q pyopenssl setuptools wheel numpy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' @@ -241,7 +241,7 @@ jobs: workingFolder: '$(Build.BinariesDirectory)' - script: | - python -m pip install -q pyopenssl setuptools wheel numpy flake8 + python -m pip install -q pyopenssl setuptools wheel numpy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' @@ -358,7 +358,7 @@ jobs: workingFolder: '$(Build.BinariesDirectory)' - script: | - python -m pip install -q pyopenssl setuptools wheel numpy flake8 + python -m pip install -q pyopenssl setuptools wheel numpy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml index 4fcb87c7ed..582b627d99 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml @@ -72,7 +72,7 @@ jobs: displayName: 'API Documentation Check and generate' - script: | - python -m pip install -q pyopenssl setuptools wheel numpy flake8 + python -m pip install -q pyopenssl setuptools wheel numpy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-cuda-10-2-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-cuda-10-2-pipeline.yml index 278e2cf3f5..fe667ddaf7 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-cuda-10-2-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-cuda-10-2-pipeline.yml @@ -35,7 +35,7 @@ jobs: workingFolder: '$(Build.BinariesDirectory)' - script: | - python -m pip install -q pyopenssl setuptools wheel numpy flake8 + python -m pip install -q pyopenssl setuptools wheel numpy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml index f528f68ea2..255c2aa62e 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml @@ -29,7 +29,7 @@ jobs: workingFolder: '$(Build.BinariesDirectory)' - script: | - python -m pip install -q pyopenssl setuptools wheel numpy flake8 + python -m pip install -q pyopenssl setuptools wheel numpy workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' diff --git a/tools/ci_build/github/azure-pipelines/win-wasm-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-wasm-ci-pipeline.yml index 1a438b1ebe..700c744547 100644 --- a/tools/ci_build/github/azure-pipelines/win-wasm-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-wasm-ci-pipeline.yml @@ -69,7 +69,7 @@ jobs: modifyEnvironment: true workingFolder: '$(Build.BinariesDirectory)' - script: | - python -m pip install -q pyopenssl setuptools wheel numpy ninja flake8 + python -m pip install -q pyopenssl setuptools wheel numpy ninja workingDirectory: '$(Build.BinariesDirectory)' displayName: 'Install python modules' - task: PythonScript@0 diff --git a/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt b/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt index a863e7c3c7..6f747474b0 100644 --- a/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt +++ b/tools/ci_build/github/linux/docker/scripts/manylinux/requirements.txt @@ -6,5 +6,4 @@ wheel git+http://github.com/onnx/onnx.git@1f63dcb7fcc3a8bf5c3c8e326867ecd6f5c43f35#egg=onnx protobuf sympy==1.1.1 -flake8 flatbuffers diff --git a/tools/ci_build/github/linux/docker/scripts/requirements.txt b/tools/ci_build/github/linux/docker/scripts/requirements.txt index dc99f91897..6d26f52fa4 100644 --- a/tools/ci_build/github/linux/docker/scripts/requirements.txt +++ b/tools/ci_build/github/linux/docker/scripts/requirements.txt @@ -7,5 +7,4 @@ wheel git+http://github.com/onnx/onnx.git@d75fb0502c9d8fef817d82c15223b4aaae8e8b6e#egg=onnx argparse sympy==1.1.1 -flake8 flatbuffers