Skip to content

Commit

Permalink
Move to using protogen's .pyi file generator
Browse files Browse the repository at this point in the history
Signed-off-by: Madhav Kumar <47245900+kumar-ish@users.noreply.github.com>
  • Loading branch information
kumar-ish committed Apr 22, 2024
1 parent c459890 commit 0f3e011
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 458 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -81,7 +81,6 @@ compile_commands.json
# generated files
onnx/version.py
compile_commands.json
tools/protoc-gen-mypy.sh

# test generated files
.cache
Expand Down Expand Up @@ -112,4 +111,4 @@ docs/docsgen/**/*.onnx
docs/docsgen/**/*.pb

# PyEnv files
.python-version
.python-version
4 changes: 2 additions & 2 deletions .reuse/dep5
Expand Up @@ -130,11 +130,11 @@ Files: cmake/ONNXConfig*.in CMakeLists.txt cmake/*cmake cmake/
COPYRIGHT: Copyright (c) ONNX Project Contributors
License: Apache-2.0

Files: .vscode/settings.json docs/docsgen/source/_templates/layout.html docs/docsgen/source/_templates/sidebar-nav-bs.html docs/images/onnx_hub_arch.svg docs/onnx-horizontal-color.png tools/protoc-gen-mypy.sh.in
Files: .vscode/settings.json docs/docsgen/source/_templates/layout.html docs/docsgen/source/_templates/sidebar-nav-bs.html docs/images/onnx_hub_arch.svg docs/onnx-horizontal-color.png
COPYRIGHT: Copyright (c) ONNX Project Contributors
License: Apache-2.0

Files: onnx/gen_proto.py tools/protoc-gen-mypy.bat onnx/reference/op_run.py
Files: onnx/gen_proto.py onnx/reference/op_run.py
COPYRIGHT: Copyright (c) ONNX Project Contributors
License: Apache-2.0

Expand Down
26 changes: 4 additions & 22 deletions CMakeLists.txt
Expand Up @@ -373,29 +373,11 @@ function(RELATIVE_PROTOBUF_GENERATE_CPP NAME SRCS HDRS ROOT_DIR DEPEND)
--cpp_out
${ONNX_DLLEXPORT_STR}${CMAKE_CURRENT_BINARY_DIR})
if(BUILD_ONNX_PYTHON)
list(APPEND PROTOC_ARGS --python_out
${CMAKE_CURRENT_BINARY_DIR})
list(APPEND PROTOC_ARGS --python_out)
if(ONNX_GEN_PB_TYPE_STUBS)
if(NOT WIN32)
# use PYTHON_EXECUTABLE to python protoc-gen-mypy.py
configure_file(
${ROOT_DIR}/tools/protoc-gen-mypy.sh.in
${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh
@ONLY)
execute_process(COMMAND chmod +x ${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh)
configure_file(
${ROOT_DIR}/tools/protoc-gen-mypy.py
${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.py
COPYONLY)
set(PROTOC_MYPY_PLUGIN_FILE ${PROJECT_BINARY_DIR}/tools/protoc-gen-mypy.sh)
else()
set(PROTOC_MYPY_PLUGIN_FILE ${ROOT_DIR}/tools/protoc-gen-mypy.bat)
endif()
list(APPEND PROTOC_ARGS
--plugin
protoc-gen-mypy=${PROTOC_MYPY_PLUGIN_FILE}
--mypy_out
${ONNX_DLLEXPORT_STR}${CMAKE_CURRENT_BINARY_DIR})
list(APPEND PROTOC_ARGS pyi_out:${CMAKE_CURRENT_BINARY_DIR})
else()
list(APPEND PROTOC_ARGS ${CMAKE_CURRENT_BINARY_DIR})
endif()
endif()
if(NOT ONNX_PROTOC_EXECUTABLE)
Expand Down
4 changes: 0 additions & 4 deletions tools/protoc-gen-mypy.bat

This file was deleted.

0 comments on commit 0f3e011

Please sign in to comment.