Repository navigation
Conversation
|
Would prepending GRASS_PYDIR to sys.path: Line 2098 in 92dc5b8 be an alternative to versioning the file name? |
|
Hm, regardless, we should prepend. I'll adjust my PR. We could also import in more low level way to avoid the version. |
No, it doesn't work. Still trying to self-import because the main script name is the same as the package name. |
|
It's OK on UN*X because the main script is |
Oh, too bad. Not sure what to do, it is not ideal to re-add the version to the main executive. |
This PR doesn't change anything for UN*X. |
I understand it is only for Win. If you will do scripting on Win, wouldn't |
For Python scripting, yes |
|
If I understand correctly, the situation now is:
This looks platform-appropriate to me. Anyway, I made the change with prepend in #6393. In my local test on Linux, it seems that
|
wenzeslaus
left a comment
There was a problem hiding this comment.
I would be for merging the versioned part of this PR right now. If we want to make it better in the future, we can refine #6393, use importlib, or the __main__.py file Python mechanics.
The scripts part is not clear to me. With Autotools we don't have separate scripts on Linux, but we may have them for Windows. I don't know what is the exact reasoning behind that. It is clear that Linux just treats all the executables the same, while more care is needed to run a Python script on Windows.
|
I made even further changes to #6393 and it works for me on Linux with grass.py. I would give it a try before merging the version piece here. We may still want to avoid the failed import with the "versioned" file, but we don't have to, because that's handled gracefully with #6393. #6393 needs a review. Edit: #6393 is now merged. |
Testing the main without this PR. |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Getting the same error: I'm renaming |
|
First Windows conda packages: https://grass-conda.isnew.info/ |
wenzeslaus
left a comment
There was a problem hiding this comment.
It is disappointing that the rename is needed since my tests on Linux with conda seemed to show it works. I'm for renaming anyway, though, because it is more robust solution. The Python script is not touched by anything user related. Python imports don't use it and executable is the .bat file, so the name is internal.
The rest looks reasonable. The scripts on path is a confusion which we are hopefully finally addressing by this.
Suggested commit message (please check; PR description out of date at this point):
Rename the Windows startup script from grass.py to grass_main.py to avoid a name collision with the grass Python package, which caused import grass to fail because Python treated the script itself as the grass module/package.
Generate grass.bat from lib/init/grass.bat.in during the CMake build and install it to bin, and resolve GISBASE relative to the script location instead of baking in the build-tree path.
Always add the script directory to PATH when it exists so Windows batch wrappers in scripts/ are reachable. Non-Windows behavior is unchanged because it was already behaving that way.
|
Hmm... I'm not sure why @wenzeslaus any ideas? |
|
The r.coin failed test seems to be failing because of « missing » r.stats. |
Yes
No, it uses its own template |
|
Also note that what we build as « osgeo4w » here is not using the same scripts and all as what is actually shipped by « osgeo4w », some differences being in the unit (paths and bat file names), among others. Fixing CI might still cause problems in the nightlies of osgeo4w |
|
Before going too far, I launched a rerun |
This PR
grass.pytograss<VERSION>.pyto avoidgrass.batfromlib/init/grass.bat.in, andscriptstoPATHfor batch files.