Skip to content

Commit

Permalink
BUG: Ensure launcher scripts installed from wheels are accessible
Browse files Browse the repository at this point in the history
This commit addresses an issue where launcher scripts installed from wheels
were not correctly added to the PATH. Specifically, it updates the PATH for
both "Slicer" and "PythonSlicer" launcher settings in the build and install
tree. This adjustment ensures that convenience executables created after
installing wheels with specified entry-points such as "project.scripts" or
"project.gui-scripts" can be easily located and accessed within the project
environment.
  • Loading branch information
jcfr committed Feb 16, 2024
1 parent b2be7c3 commit 9c49644
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
22 changes: 21 additions & 1 deletion SuperBuild/External_python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,14 @@ if((NOT DEFINED PYTHON_INCLUDE_DIR
endif()
mark_as_superbuild(PYTHON_VALGRIND_SUPPRESSIONS_FILE:FILEPATH)

#-----------------------------------------------------------------------------
# Directory where executable scripts associated with "project.scripts" or "project.gui-scripts"
# entry-points are generated
set(_scripts_subdir bin)
if(WIN32)
set(_scripts_subdir Scripts)
endif()

#-----------------------------------------------------------------------------
# Slicer Launcher setting specific to build tree

Expand All @@ -293,7 +301,10 @@ if((NOT DEFINED PYTHON_INCLUDE_DIR
)

# paths
set(${proj}_PATHS_LAUNCHER_BUILD ${python_DIR}/bin)
set(${proj}_PATHS_LAUNCHER_BUILD
${python_DIR}/bin
${python_DIR}/${_scripts_subdir}
)
mark_as_superbuild(
VARS ${proj}_PATHS_LAUNCHER_BUILD
LABELS "PATHS_LAUNCHER_BUILD"
Expand Down Expand Up @@ -333,6 +344,15 @@ if((NOT DEFINED PYTHON_INCLUDE_DIR
)
endif()

# paths
set(${proj}_PATHS_LAUNCHER_INSTALLED
<APPLAUNCHER_SETTINGS_DIR>/../lib/Python/${_scripts_subdir}
)
mark_as_superbuild(
VARS ${proj}_PATHS_LAUNCHER_INSTALLED
LABELS "PATHS_LAUNCHER_INSTALLED"
)

# pythonpath
set(${proj}_PYTHONPATH_LAUNCHER_INSTALLED
<APPLAUNCHER_SETTINGS_DIR>/../lib/Python/${PYTHON_STDLIB_SUBDIR}
Expand Down
9 changes: 9 additions & 0 deletions SuperBuild/python_configure_python_launcher.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ endforeach()

find_package(CTKAppLauncher REQUIRED)

# Directory where executable scripts associated with "project.scripts" or "project.gui-scripts"
# entry-points are generated.
set(_scripts_subdir bin)
if(WIN32)
set(_scripts_subdir Scripts)
endif()

#
# Settings specific to the build tree.
#
Expand Down Expand Up @@ -129,6 +136,7 @@ slicer_dll_directories.add()
# PATHS
set(PYTHONLAUNCHER_PATHS_BUILD
<APPLAUNCHER_DIR>
<APPLAUNCHER_DIR>/../${_scripts_subdir}
)

# LIBRARY_PATHS
Expand Down Expand Up @@ -184,6 +192,7 @@ set(PYTHONHOME "<APPLAUNCHER_DIR>/../lib/Python")
# PATHS
set(PYTHONLAUNCHER_PATHS_INSTALLED
<APPLAUNCHER_DIR>
<APPLAUNCHER_DIR>/../lib/Python/${_scripts_subdir}
)

# LIBRARY_PATHS
Expand Down

0 comments on commit 9c49644

Please sign in to comment.