Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/init/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()
# START_UP is the variable used in grass.py, grass.sh.in and grass.bat.in
set(START_UP ${PROJECT_NAME_LOWER})
if(WIN32)
set(START_UP "${START_UP}.py")
set(START_UP "${START_UP}${GRASS_VERSION_NUMBER}.py")
Comment on lines 13 to +16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would appreciate a comment in the source code providing the reason. Something like "Python file has version to avoid issues with import grass statements". It could also be called grass_main.py instead of using the version if that would simplify things or help clarity.

set(script_file_name "grass.bat")
set(script_input_file_name ${script_file_name}.in)
else()
Expand All @@ -36,7 +36,11 @@ list(APPEND DLL_PATH_LIST ${DEPS_DLL_PATH})

# configure and install grass.py
set(GRASS_PYDIR ${GRASS_INSTALL_PYDIR_RUNTIME_PATH})
configure_file(grass.py ${OUTDIR}/${CMAKE_INSTALL_BINDIR}/${START_UP} @ONLY)
if(WIN32)
configure_file(grass.py ${OUTDIR}/${GRASS_INSTALL_ETCDIR}/${START_UP} @ONLY)
else()
configure_file(grass.py ${OUTDIR}/${CMAKE_INSTALL_BINDIR}/${START_UP} @ONLY)
endif()

set(GRASS_PYDIR ${GRASS_INSTALL_PYDIR_PATH})
configure_file(grass.py ${CMAKE_CURRENT_BINARY_DIR}/${START_UP} @ONLY)
Expand All @@ -47,6 +51,11 @@ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${START_UP}

file(TO_NATIVE_PATH "${OUTDIR}/${GISBASE_DIR}" gisbase_init_dir)

if(WIN32)
set(GRASS_PYTHON ${PYTHON_EXECUTABLE})
configure_file(${script_input_file_name} ${OUTDIR}/${CMAKE_INSTALL_BINDIR}/${script_file_name} @ONLY)
endif()

file(TO_NATIVE_PATH ${OUTDIR}/${GRASS_INSTALL_BINDIR} grass_dll_dir)
set(DLL_PATH_LIST)
list(APPEND DLL_PATH_LIST ${grass_dll_dir})
Expand Down
10 changes: 5 additions & 5 deletions python/grass/app/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ def append_left_main_executable_paths(paths, install_path):
path = os.path.join(install_path, "extrabin")
if os.path.exists(path):
paths.appendleft(path)
else:
# Without FHS, scripts are separated like in the source code.
path = os.path.join(install_path, "scripts")
if os.path.exists(path):
paths.appendleft(path)

# Without FHS, scripts are separated like in the source code.
path = os.path.join(install_path, "scripts")
if os.path.exists(path):
paths.appendleft(path)
Comment on lines -134 to +138
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusing, I would say the original code was wrong for Windows with Autotools because it would skip it. Both the old code and new code should be fine for Linux because there should be no scripts directory AFAIK, but then the comment is misleading. I didn't look at blame - if I'm the author, I would be twice as confused as I'm now. :-)

In any case, testing os.path.exists(path) is good, but skipping based on the platform is even better if we already have that info.



def append_left_addon_paths(paths, config_dir, env):
Expand Down
Loading