added server
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# Stage server/ next to the Host GUI, preserving an existing local config.
|
||||
if(NOT EXISTS "${CO_SERVER_SOURCE_DIR}")
|
||||
message(FATAL_ERROR "Server source directory not found: ${CO_SERVER_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${CO_SERVER_SOURCE_DIR}/consumer_server_cli.py")
|
||||
message(FATAL_ERROR
|
||||
"Server entrypoint not found: ${CO_SERVER_SOURCE_DIR}/consumer_server_cli.py")
|
||||
endif()
|
||||
|
||||
set(_preserve_config "")
|
||||
if(EXISTS "${CO_SERVER_STAGE_CONFIG}")
|
||||
file(READ "${CO_SERVER_STAGE_CONFIG}" _preserve_config)
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${CO_SERVER_STAGE_DIR}")
|
||||
file(MAKE_DIRECTORY "${CO_SERVER_STAGE_DIR}")
|
||||
|
||||
# Prefer a filtered copy so Python caches do not ship with the build.
|
||||
file(GLOB _server_entries RELATIVE "${CO_SERVER_SOURCE_DIR}" "${CO_SERVER_SOURCE_DIR}/*")
|
||||
foreach(_entry IN LISTS _server_entries)
|
||||
if(_entry STREQUAL "__pycache__" OR _entry STREQUAL ".pytest_cache")
|
||||
continue()
|
||||
endif()
|
||||
file(COPY "${CO_SERVER_SOURCE_DIR}/${_entry}"
|
||||
DESTINATION "${CO_SERVER_STAGE_DIR}"
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
PATTERN "*.pyc" EXCLUDE
|
||||
PATTERN ".pytest_cache" EXCLUDE
|
||||
)
|
||||
endforeach()
|
||||
|
||||
if(NOT "${_preserve_config}" STREQUAL "")
|
||||
file(WRITE "${CO_SERVER_STAGE_CONFIG}" "${_preserve_config}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${CO_SERVER_STAGE_DIR}/consumer_server_cli.py")
|
||||
message(FATAL_ERROR
|
||||
"Failed to stage server entrypoint to ${CO_SERVER_STAGE_DIR}/consumer_server_cli.py")
|
||||
endif()
|
||||
Reference in New Issue
Block a user