mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-01 03:45:06 +00:00
Remove flake8 check from CMake build. (#8662)
This commit is contained in:
parent
52a212e4f1
commit
20f006c580
11 changed files with 9 additions and 89 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -6,5 +6,4 @@ wheel
|
|||
git+http://github.com/onnx/onnx.git@1f63dcb7fcc3a8bf5c3c8e326867ecd6f5c43f35#egg=onnx
|
||||
protobuf
|
||||
sympy==1.1.1
|
||||
flake8
|
||||
flatbuffers
|
||||
|
|
|
|||
|
|
@ -7,5 +7,4 @@ wheel
|
|||
git+http://github.com/onnx/onnx.git@d75fb0502c9d8fef817d82c15223b4aaae8e8b6e#egg=onnx
|
||||
argparse
|
||||
sympy==1.1.1
|
||||
flake8
|
||||
flatbuffers
|
||||
|
|
|
|||
Loading…
Reference in a new issue