Skip to content

Commit

Permalink
Refs #22463: Remove .bat.in and call .exe from python
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Dec 13, 2024
1 parent 090d010 commit 1a5cf4e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
11 changes: 8 additions & 3 deletions tools/fastdds/discovery/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ def __find_tool_path(self):
elif os.name == 'nt':
ret = tool_path / 'fast-discovery-server.exe'
if not os.path.exists(ret):
ret = tool_path / 'fast-discovery-server.bat'
if not os.path.exists(ret):
print('fast-discovery-server tool not installed')
exe_files = [f for f in tool_path.glob('*.exe') if re.match(r'fast-discovery-server.*\.exe$', f.name)]
if len(exe_files) == 0:
print("Unable to find fast-discovery-server tool. Check installation")
elif len(exe_files) == 1:
ret = exe_files[0]
print(f'[PYTHON] Found executable: {ret}')
else:
print('Multiple candidates for fast-discovery-server.exe. Check installation')
sys.exit(1)
else:
print(f'{os.name} not supported')
Expand Down
2 changes: 1 addition & 1 deletion tools/fds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ install(EXPORT ${PROJECT_NAME}-targets
if( WIN32 )
# Use powershell to generate the link
install(
CODE "execute_process( COMMAND PowerShell -Command \"if( test-path ${PROJECT_NAME}.exe -PathType Leaf ) { rm ${PROJECT_NAME}.exe } ; New-Item -ItemType SymbolicLink -Target $<TARGET_FILE_NAME:${PROJECT_NAME}> -Path ${PROJECT_NAME}.exe \" ERROR_QUIET RESULTS_VARIABLE SYMLINK_FAILED WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}\") \n if( SYMLINK_FAILED ) \n message(STATUS \"Windows requires admin installation rights to create symlinks. A bat script will be provided instead.\") \n set(FAST_SERVER_BINARY_NAME $<TARGET_FILE_NAME:${PROJECT_NAME}>) \n configure_file(${CMAKE_CURRENT_LIST_DIR}/fast-discovery-server.bat.in ${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION}/${PROJECT_NAME}.bat @ONLY) \n endif()"
CODE "execute_process( COMMAND PowerShell -Command \"if( test-path ${PROJECT_NAME}.exe -PathType Leaf ) { rm ${PROJECT_NAME}.exe } ; New-Item -ItemType SymbolicLink -Target $<TARGET_FILE_NAME:${PROJECT_NAME}> -Path ${PROJECT_NAME}.exe \" ERROR_QUIET RESULTS_VARIABLE SYMLINK_FAILED WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}\") \n if( SYMLINK_FAILED ) \n message(STATUS \"Windows requires admin installation rights to create symlinks. Build again with privileges to create symlink. Tool will try to find executable if no symlink is found.\") \n endif()"
COMPONENT discovery)
else()
# Use ln to create the symbolic link. We remove the version from the file name but keep the debug suffix
Expand Down
15 changes: 0 additions & 15 deletions tools/fds/fast-discovery-server.bat.in

This file was deleted.

0 comments on commit 1a5cf4e

Please sign in to comment.