[Bug] PATH setting discrepancy between the main exectable and Python API for scripts on Windows
While the grass init script (the main executable) sets this:
if not WINDOWS:
path_prepend(gpath("scripts"), "PATH")
path_prepend(gpath("bin"), "PATH")
the Python API in grass.script sets the following:
path_addition = os.pathsep + os.path.join(gisbase, "bin")
path_addition += os.pathsep + os.path.join(gisbase, "scripts")
if WINDOWS:
path_addition += os.pathsep + os.path.join(gisbase, "extrabin")
The difference in adding extrabin in grass.script is given by the fact that the init script on Windows is wrapped with a .bat script which sets extrabin, so the init script does not need to add that.
However, I'm not clear about scripts. On everything else except Windows, things are in scripts, but not on Windows. Is that correct? Should the new code be:
path_addition = os.pathsep + os.path.join(gisbase, "bin")
if WINDOWS:
path_addition += os.pathsep + os.path.join(gisbase, "extrabin")
else:
path_addition += os.pathsep + os.path.join(gisbase, "scripts")
?
in winGRASS 'everything' is in bin; it means the bat-wrappers for scripts are living there beside the exes:
C:\OSGeo4W\apps\grass\grass83\bin>dir /b
#Rscript2.bat
ANNOUNCE
batchfiles.md
batchfiles.tex
clip2r.js
copydir.bat
COPYING
d.background.bat
d.barscale.exe
d.colorlist.exe
d.colortable.exe
d.correlate.bat
d.erase.exe
d.font.exe
d.fontlist.exe
d.frame.bat
[...]
extrabin is used in winGRASS standalone, where all external depencies (e.g. gdal, etc) are copied:
@echo.
@echo -----------------------------------------------------------------------------------------------------------------------
@echo Copy extrabins to PACKAGE_DIR\extrabin
@echo -----------------------------------------------------------------------------------------------------------------------
@echo.
mkdir %PACKAGE_DIR%\extrabin
mkdir %PACKAGE_DIR%\extrabin\gdalplugins
copy %OSGEO4W_PKG_DIR%\bin\* %PACKAGE_DIR%\extrabin
xcopy %OSGEO4W_PKG_DIR%\bin\gdalplugins\* %PACKAGE_DIR%\extrabin\gdalplugins /S/V/F/I
rem msvcrt2019
del %PACKAGE_DIR%\extrabin\*140*.dll
C:\OSGeo4W\bin>dir /b
1033
adal.dll
adrg.dll
api-ms-win-core-path-l1-1-0.dll.w7
applygeo.exe
arrow.dll
arrow_acero.dll
arrow_dataset.dll
avcdelete.exe
avcexport.exe
avcimport.exe
bgspawn.exe
brotli.exe
brotlicommon.dll
brotlidec.dll
brotlienc.dll
cairo.dll
cblas.dll
cct.exe
charset-1.dll
concrt140.dll
cs2cs.exe
curl-ca-bundle.crt
curl.exe
dllupdate.exe
elevate.exe
exiv2.dll
freetype.dll
[...]
make sense?
It does. Thanks. I adjusted #3694 accordingly. Now it always sets extrabin on Windows if extrabin exists.
Do you want me to update it in the .bat in one PR (#3694) or do you prefer to do it separately afterwards? I assume this would be tested in CI, but I'm not sure which file to change.