Repository navigation
build: prepare for FHS, where GISBASE is not the absolute truth - #5630
Conversation
5acbd05 to
518072c
Compare
91955b8 to
d852aef
Compare
(This is extracted from OSGeo#5630 to simplify review.) The transitional period from the traditional GRASS installation structure to a Filesystem Hierarchy Standard (FHS) complying structure (enabled by CMake build) requires an alternative way to find resources. Currently all resources are located in relation to GISBASE, that is no longer the case with a FHS installation. In addition, and instead of GISBASE, the following environment variables will be needed (not included in this update): - GRASS_SHAREDIR - GRASS_LOCALEDIR - GRASS_PYDIR - GRASS_GUIWXDIR - GRASS_GUISCRIPTDIR - GRASS_GUIRESDIR - GRASS_FONTSDIR - GRASS_ETCDIR Setting up all these variables would bloat the grass.py file, therefore this update suggests to move this to the grass.app Python module. Summary of changes: - grass.py: to simplify Conda adoption, the variable GRASS_PREFIX is added, which is essentially equal to installation prefix, but easily changeable if needed. - grass.py need to find the Python module to be able to set necessary variables, a new variable GRASS_PYDIR is configured into the file to do just this. - python/grass/app/resource_paths.py is a configurable file (like grass.py) - update copy_python_files_in_subdir.cmake to be able to exclude files
(This is extracted from OSGeo#5630 to simplify review.) The transitional period from the traditional GRASS installation structure to a Filesystem Hierarchy Standard (FHS) complying structure (enabled by CMake build) requires an alternative way to find resources. Currently all resources are located in relation to GISBASE, that is no longer the case with a FHS installation. In addition, and instead of GISBASE, the following environment variables will be needed (not included in this update): - GRASS_SHAREDIR - GRASS_LOCALEDIR - GRASS_PYDIR - GRASS_GUIWXDIR - GRASS_GUISCRIPTDIR - GRASS_GUIRESDIR - GRASS_FONTSDIR - GRASS_ETCDIR Setting up all these variables would bloat the grass.py file, therefore this update suggests to move this to the grass.app Python module. Summary of changes: - grass.py: to simplify Conda adoption, the variable GRASS_PREFIX is added, which is essentially equal to installation prefix, but easily changeable if needed. - grass.py need to find the Python module to be able to set necessary variables, a new variable GRASS_PYDIR is configured into the file to do just this. - python/grass/app/resource_paths.py is a configurable file (like grass.py) - update copy_python_files_in_subdir.cmake to be able to exclude files
(This is extracted from OSGeo#5630 to simplify review.) The transitional period from the traditional GRASS installation structure to a Filesystem Hierarchy Standard (FHS) complying structure (enabled by CMake build) requires an alternative way to find resources. Currently all resources are located in relation to GISBASE, that is no longer the case with a FHS installation. In addition, and instead of GISBASE, the following environment variables will be needed (not included in this update): - GRASS_SHAREDIR - GRASS_LOCALEDIR - GRASS_PYDIR - GRASS_GUIWXDIR - GRASS_GUISCRIPTDIR - GRASS_GUIRESDIR - GRASS_FONTSDIR - GRASS_ETCDIR Setting up all these variables would bloat the grass.py file, therefore this update suggests to move this to the grass.app Python module. Summary of changes: - grass.py: to simplify Conda adoption, the variable GRASS_PREFIX is added, which is essentially equal to installation prefix, but easily changeable if needed. - grass.py need to find the Python module to be able to set necessary variables, a new variable GRASS_PYDIR is configured into the file to do just this. - python/grass/app/resource_paths.py is a configurable file (like grass.py) - update copy_python_files_in_subdir.cmake to be able to exclude files
(This is extracted from OSGeo#5630 to simplify review.) The transitional period from the traditional GRASS installation structure to a Filesystem Hierarchy Standard (FHS) complying structure (enabled by CMake build) requires an alternative way to find resources. Currently all resources are located in relation to GISBASE, that is no longer the case with a FHS installation. In addition, and instead of GISBASE, the following environment variables will be needed (not included in this update): - GRASS_SHAREDIR - GRASS_LOCALEDIR - GRASS_PYDIR - GRASS_GUIWXDIR - GRASS_GUISCRIPTDIR - GRASS_GUIRESDIR - GRASS_FONTSDIR - GRASS_ETCDIR Setting up all these variables would bloat the grass.py file, therefore this update suggests to move this to the grass.app Python module. Summary of changes: - grass.py: to simplify Conda adoption, the variable GRASS_PREFIX is added, which is essentially equal to installation prefix, but easily changeable if needed. - grass.py need to find the Python module to be able to set necessary variables, a new variable GRASS_PYDIR is configured into the file to do just this. - python/grass/app/resource_paths.py is a configurable file (like grass.py) - update copy_python_files_in_subdir.cmake to be able to exclude files
1ebd308 to
dd7c201
Compare
# Conflicts: # general/CMakeLists.txt
|
Hmm, the Windows tests fail with "ERROR: Incomplete GRASS session: Variable 'GRASS_ETCDIR' not set". However, running the tests with added |
|
I only have a limited plan and no Fable. But ya, I'd rather have an agent loose its time rather than me so I could do more reviewing/deciding |
|
The Windows CI runner's build script does not install with grass/mswindows/osgeo4w/build_osgeo4w.sh Line 144 in 1a88e4e This unusual solution has made things work so far with a lot of hacks. This is now failing because of the install-step configuration of Line 1788 in 1a88e4e and https://github.com/OSGeo/grass/blob/main/python/grass/app/resource_paths.py are skipped and the build-step configurations gets installed. |
Ok, I made opus 5.5 take a look.
It flagged a possible issue on the non-python side, in C. See the end of the third thread I'm adding the thread here, in details Details (first plan)
#5630: Windows CI fails with "Variable 'GRASS_ETCDIR' not set"ContextThe PR replaces hard-coded Root causeThe The real cause is a shortcut in
This is not only a CI problem. Any user script that sets Proposed fix (on
|
|
I know it's a lot, but I wanted you to be able to judge correctly without hiding anything that I saw. Do you know if some parts of this kinda large could be merged independently and like now, in a more timely matter? It's been a long time since this work has been opened, and if I could be able to individually review something I'm certain of, it could get pieces in early |
|
The Python changes make sense: The ensure env code was not made for FHS. The C code looks like it should be a different PR. Gathered from reading the text. |
|
Now I took a closer look at the Claude analysis and suggestions. It was as I feared, it just adds another layer of hacks. First of all it starts out with the premise that the current way Windows is setup and run is the correct way; that GISBASE is supposed to be set manually (via env.bat file). The whole point of this PR is to "re-define" or degrade the importance of GISBASE because it is not the same on legacy and FHS build. Everything that is needed is located in the python/grass/app/[resource_paths.py|runtime.py] combo. For very special cases (Conda?) we may need to allow manual setting of GRASS_PREFIX (which in legacy build is the same as GISBASE). In a normal GRASS session the resource paths are loaded with grass.py, now what we need is to load it with python scripts too. |
|
Seems the python suggestion at least make the Win runner pass. What do you say, shall I add it (with added TODOs to remove/rework) and merge this beast? (This will have consequences for third parties like QGIS which depend on GISBASE.) |
|
@wenzeslaus Can fable take a look |
|
It’s my understanding that setup.py needs a rework, including delegate relevant parts to runtime.py. That might just as well be addressed in a follow-up PR. |
|
(in case of too long AI outputs, maybe try https://github.com/ayghri/i-have-adhd, a "skill to stop your coding agent from burying the answer") |
|
Tests are all green, I believe we should merge. |
|
I can't look in detail right now, not sure if it is worth looking superficially. I'm fine either way, this is WIP even after merge. |
There's a lot to do still for FHS, this is only one big and crucial (non-breaking) step. |
|
An approval is needed for bringing this in bay. I’m sure things will need to be worked out, I’m having a PR dropping hardcoded GRASS_PYDIR/GRASS_PREFIX up the sleeve. Good to get this moving forward. |
echoix
left a comment
There was a problem hiding this comment.
Go ahead, and we’ll work from there
|
While working on the FHS successor PR, I hit some minor issues that belong to this. Please re-approve. (We will need a FHS runner soon, I'm thinking of replacing the "GCC C/C++ standards check" could be an option. I noticed it often only runs way after one of the tests, not seldom the Mac runner, already finished. So it doesn't add much value anymore). |
|
build: decouple resource paths from GISBASE in preparation for FHS Traditionally, GRASS resources have been located relative to GISBASE, This assumption is no longer valid with installations following the Introduce dedicated environment variables for locating GRASS resources This allows the same resource lookup mechanisms to support both the These changes are part of the transition towards FHS-compliant Co-authored-by: Vaclav Petras wenzeslaus@gmail.com |
|
Thank you! |
GISBASEis used as a means to retrieve paths to various resources in source code. With FHS (#3661) this is no longer possible. This adds a number of new environment variables to address this.Currently this is addressed with following workaround:
grass/CMakeLists.txt
Lines 176 to 194 in 5e998d3
This is work in progress.