Skip to content

Commit

Permalink
fix: Implement review findings
Browse files Browse the repository at this point in the history
  • Loading branch information
CzBalti committed May 13, 2024
1 parent 4f9f8af commit 42e1ffa
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
11 changes: 6 additions & 5 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def requirements(self):
self.requires("fmt/9.1.0")
self.requires("inja/3.4.0")
self.requires("nlohmann_json/3.11.2")
self.requires("incbin/cci.20211107"),
self.requires("incbin/cci.20211107"),
self.requires("spdlog/1.11.0")
self.requires("eigen/3.4.0")
self.requires("cli11/2.3.2", private=True)
Expand Down Expand Up @@ -133,7 +133,6 @@ def generate(self):
tc.cache_variables["CLOE_ENGINE_WITH_SERVER"] = self.options.engine_server
tc.cache_variables["CLOE_ENGINE_WITH_LRDB"] = self.options.engine_lrdb
tc.cache_variables["CLOE_PYTHON_API"] = self.options.python_api
tc.cache_variables["PYTHON_BINDINGS_LOCAL_DEV"] = not self.in_local_cache
tc.generate()

def build(self):
Expand Down Expand Up @@ -202,23 +201,25 @@ def package_info(self):
pydir = os.path.join(self.build_folder, "lib/cloe/python")
py_path = os.path.join(self.source_folder, "python/python_api")
libdir = os.path.join(self.build_folder, "lib")
cloe_lib_path = libdir
else:
self.cpp_info.builddirs.append(os.path.join("lib", "cmake", "cloe"))
bindir = os.path.join(self.package_folder, "bin")
luadir = os.path.join(self.package_folder, "lib/cloe/lua")
pydir = os.path.join(self.package_folder, "lib/cloe/python")
py_path = pydir
cloe_lib_path = os.path.join(self.package_folder, "lib/cloe/python/cloe")
libdir = None

self.output.info(f"Appending PATH environment variable: {bindir}")
self.runenv_info.prepend_path("PATH", bindir)
self.output.info(f"Appending CLOE_LUA_PATH environment variable: {luadir}")
self.runenv_info.prepend_path("CLOE_LUA_PATH", luadir)
if libdir is not None:
#TODO
self.output.info(f"Appending LD_LIBRARY_PATH environment variable: {libdir}")
self.runenv_info.append_path("LD_LIBRARY_PATH", libdir)
if self.options.python_api:
self.output.info(f"Appending PYHTONPATH and BASIC_CLOE_PYTHON_BINDINGS environment variables: {pydir}")
self.output.info(f"Appending PYHTONPATH and CLOE_PYTHON_BINDINGS environment variables: {pydir}")
self.runenv_info.prepend_path("PYTHONPATH", str(py_path))
self.runenv_info.prepend_path("BASIC_CLOE_PYTHON_BINDINGS", str(pydir))
self.runenv_info.prepend_path("PYTHONPATH", str(cloe_lib_path))
self.runenv_info.prepend_path("CLOE_PYTHON_BINDINGS", str(pydir))
5 changes: 2 additions & 3 deletions plugins/basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ set_target_properties(_basic_bindings PROPERTIES
CXX_STANDARD_REQUIRED ON
)

if(PYTHON_BINDINGS_LOCAL_DEV)
set_target_properties(_basic_bindings
set_target_properties(_basic_bindings
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cloe/python"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cloe/python"
)
endif()


install(TARGETS _basic_bindings LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/cloe/python)

Expand Down
2 changes: 1 addition & 1 deletion python/python_api/cloe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from ._runner import TestRunner, Simulation
from ._cloe_bindings import CallbackResult
from _cloe_bindings import CallbackResult
9 changes: 5 additions & 4 deletions python/python_api/cloe/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from typing import Optional, Dict, Any
from queue import Queue, Empty

from ._cloe_bindings import SimulationDriver, CallbackResult, DataBrokerAdapter, SimulationDriver, Stack
from ._cloe_bindings import Simulation as _Simulation
from _cloe_bindings import SimulationDriver, CallbackResult, DataBrokerAdapter, SimulationDriver, Stack
from _cloe_bindings import Simulation as _Simulation


@dataclass
Expand Down Expand Up @@ -113,6 +113,7 @@ def run():
t = Thread(target=run)
t.start()
self.q.get(True)
#minimater error, no vehicle

def __next__(self):
return self
Expand Down Expand Up @@ -208,11 +209,11 @@ def __init__(self, stack: Optional[Dict[str, Any]] = None):

self._sim = _Simulation(full_config_stack, self.driver, uuid="123")

if "BASIC_CLOE_PYTHON_BINDINGS" in os.environ:
if "CLOE_PYTHON_BINDINGS" in os.environ:
import importlib.util
import sys
binding_libs = []
for binding_dir in os.environ["BASIC_CLOE_PYTHON_BINDINGS"].split(":"):
for binding_dir in os.environ["CLOE_PYTHON_BINDINGS"].split(":"):
if len(str(binding_dir)) > 1:
binding_path = Path(binding_dir)
if binding_path.exists():
Expand Down
9 changes: 0 additions & 9 deletions python/python_api/cloe/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set(PYTHON_BINDINGS_LOCAL_DEV OFF CACHE BOOL "This sets the compiler output to the local source tree so
the cloe python project can be simply imported.")
set(CLOE_FIND_PACKAGES ON CACHE BOOL "Call find_package() for cloe packages")
set(CLOE_ENGINE_VERSION ${CLOE_PROJECT_VERSION})
if(CLOE_FIND_PACKAGES)
Expand All @@ -24,13 +22,6 @@ set_target_properties(_cloe_bindings PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
)
if(PYTHON_BINDINGS_LOCAL_DEV)
set_target_properties(_cloe_bindings
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/.."
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/.."
)
endif()

target_link_libraries(_cloe_bindings PUBLIC cloe::stacklib cloe::databroker-bindings cloe::simulation)
target_include_directories(_cloe_bindings PRIVATE ${PROJECT_SOURCE_DIR}/engine/src)
Expand Down

0 comments on commit 42e1ffa

Please sign in to comment.