Skip to content

Commit

Permalink
#24 Use PyProject.toml
Browse files Browse the repository at this point in the history
* Update pyproject.toml
* renamed script lotuspc to lrpcg
* Moved some files around
  • Loading branch information
tzijnge committed Oct 17, 2024
1 parent f9fa118 commit fe62b16
Show file tree
Hide file tree
Showing 76 changed files with 26 additions and 29 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package/lrpc/lotusrpc.py → lrpc/lrpcg.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def generate_rpc(lrpc_def: LrpcDef, output: os.PathLike[str]) -> None:
)
@click.option("-o", "--output", help="Path to put the generated files", required=False, default=".", type=click.Path())
@click.argument("input_file", type=click.File("r"), metavar="input")
def generate(warnings_as_errors: bool, output: os.PathLike[str], input_file: TextIO) -> None:
def run_cli(warnings_as_errors: bool, output: os.PathLike[str], input_file: TextIO) -> None:
"""Generate code for file INPUT"""

try:
Expand All @@ -59,4 +59,4 @@ def generate(warnings_as_errors: bool, output: os.PathLike[str], input_file: Tex
if __name__ == "__main__":
# parameters are inserted by Click
# pylint: disable=no-value-for-parameter
generate()
run_cli()
File renamed without changes.
2 changes: 1 addition & 1 deletion package/lrpc/schema/load.py → lrpc/schema/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def load_lrpc_schema() -> dict[str, Any]:
schema_file = resources.files(__package__).joinpath("lotusrpc-schema.json")
schema_text = schema_file.read_text()
schema_text = schema_file.read_text(encoding="utf-8")
schema = yaml.safe_load(schema_text)

if not isinstance(schema, dict):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion package/README

This file was deleted.

18 changes: 8 additions & 10 deletions package/pyproject.toml → pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ version = "0.1.0"
description = "A code generator for remote procedure calls on embedded systems"
readme = "README.md"
requires-python = ">=3.9"
license = { text = "MIT" }
authors = [{ name = "T Zijnge", email = "[email protected]" }]
license = { file = "LICENSE" }
authors = [{ name = "T Zijnge" }]
keywords = ["code generation", "embedded systems", "rpc"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: C++",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development :: Embedded Systems",
]
Expand All @@ -29,17 +28,17 @@ dependencies = [
"click==8.1.7",
]

[project.optional-dependencies]
serial = ["pyserial==3.5"]

[project.urls]
homepage = "https://github.com/tzijnge/LotusRpc"
"Bug Tracker" = "https://github.com/tzijnge/LotusRpc/issues"
"Documentation" = "https://github.com/tzijnge/LotusRpc/wiki"
"Source Code" = "https://github.com/tzijnge/LotusRpc"

[project.optional-dependencies]
serial = ["pyserial==3.5"]

[project.scripts]
lotusrpc = "lrpc.lotusrpc:generate"
lrpcg = "lrpc.lrpcg:run_cli"
lrpcc = "lrpc.lrpcc:run_cli"

[tool.setuptools.package-data]
Expand All @@ -64,7 +63,6 @@ disable = ["line-too-long"]
allow-reexport-from-package = true

[tool.mypy]
exclude = "external"
strict = true
# Increase strictness of checks
disallow_any_decorated = true
Expand Down
File renamed without changes.
File renamed without changes.
30 changes: 15 additions & 15 deletions language/cpp/tests/CMakeLists.txt → tests/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ mark_as_advanced(
gtest_hide_internal_symbols
)

add_subdirectory(../../../external/gtest External/gtest EXCLUDE_FROM_ALL)
add_subdirectory(../../external/gtest External/gtest EXCLUDE_FROM_ALL)

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server1/Server1.hpp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/package
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generate TestServer1 LRPC files"
DEPENDS ${CMAKE_SOURCE_DIR}/testdata/TestServer1.lrpc.yaml
COMMAND python -m lrpc.lotusrpc -w ${CMAKE_SOURCE_DIR}/testdata/TestServer1.lrpc.yaml -o ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server1)
DEPENDS ${CMAKE_SOURCE_DIR}/tests/testdata/TestServer1.lrpc.yaml
COMMAND python -m lrpc.lrpcg -w ${CMAKE_SOURCE_DIR}/tests/testdata/TestServer1.lrpc.yaml -o ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server1)

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server2/Server2.hpp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/package
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generate TestServer2 LRPC files"
DEPENDS ${CMAKE_SOURCE_DIR}/testdata/TestServer2.lrpc.yaml
COMMAND python -m lrpc.lotusrpc -w ${CMAKE_SOURCE_DIR}/testdata/TestServer2.lrpc.yaml -o ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server2)
DEPENDS ${CMAKE_SOURCE_DIR}/tests/testdata/TestServer2.lrpc.yaml
COMMAND python -m lrpc.lrpcg -w ${CMAKE_SOURCE_DIR}/tests/testdata/TestServer2.lrpc.yaml -o ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server2)

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server3/Server3.hpp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/package
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generate TestServer3 LRPC files"
DEPENDS ${CMAKE_SOURCE_DIR}/testdata/TestServer3.lrpc.yaml
COMMAND python -m lrpc.lotusrpc -w ${CMAKE_SOURCE_DIR}/testdata/TestServer3.lrpc.yaml -o ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server3)
DEPENDS ${CMAKE_SOURCE_DIR}/tests/testdata/TestServer3.lrpc.yaml
COMMAND python -m lrpc.lrpcg -w ${CMAKE_SOURCE_DIR}/tests/testdata/TestServer3.lrpc.yaml -o ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server3)

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server4/Server4.hpp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/package
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generate TestServer4 LRPC files"
DEPENDS ${CMAKE_SOURCE_DIR}/testdata/TestServer4.lrpc.yaml
COMMAND python -m lrpc.lotusrpc -w ${CMAKE_SOURCE_DIR}/testdata/TestServer4.lrpc.yaml -o ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server4)
DEPENDS ${CMAKE_SOURCE_DIR}/tests/testdata/TestServer4.lrpc.yaml
COMMAND python -m lrpc.lrpcg -w ${CMAKE_SOURCE_DIR}/tests/testdata/TestServer4.lrpc.yaml -o ${CMAKE_CURRENT_SOURCE_DIR}/generated/Server4)

set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/generated)

Expand All @@ -53,8 +53,8 @@ add_executable(UnitTests
${CMAKE_CURRENT_SOURCE_DIR}/generated/Server4/Server4.hpp)

target_include_directories(UnitTests PRIVATE .)
target_include_directories(UnitTests PRIVATE ../include)
target_include_directories(UnitTests SYSTEM PRIVATE ../../../external/etl/include)
target_include_directories(UnitTests PRIVATE ${CMAKE_SOURCE_DIR}/resources/cpp/include)
target_include_directories(UnitTests SYSTEM PRIVATE ${CMAKE_SOURCE_DIR}/external/etl/include)

if(MSVC)
target_compile_options(UnitTests PRIVATE /W4)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit fe62b16

Please sign in to comment.