فهرست منبع

add python-grass.bat for Python initialization (#436)

* python-grass.bat draft

* remove python-grass bat when uninstalling GRASS

* package python-grass bat file

* add python caller

* fix typo in pythonpath
Martin Landa 5 سال پیش
والد
کامیت
cbc782674d
3فایلهای تغییر یافته به همراه26 افزوده شده و 0 حذف شده
  1. 4 0
      mswindows/osgeo4w/package.sh
  2. 1 0
      mswindows/osgeo4w/preremove.bat
  3. 21 0
      mswindows/osgeo4w/python-grass.bat.tmpl

+ 4 - 0
mswindows/osgeo4w/package.sh

@@ -242,6 +242,8 @@ mkdir -p $OSGEO4W_ROOT_MSYS/etc/preremove $OSGEO4W_ROOT_MSYS/etc/postinstall
 sed -e "s#@POSTFIX@#$POSTFIX#g" \
     mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.bat
 sed -e "s#@POSTFIX@#$POSTFIX#g" \
+    mswindows/osgeo4w/python-grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/python-${GRASS_EXECUTABLE}.bat
+sed -e "s#@POSTFIX@#$POSTFIX#g" \
     mswindows/osgeo4w/env.bat.tmpl >$OSGEO4W_ROOT_MSYS/apps/grass/grass$POSTFIX/etc/env.bat
 sed -e "s#@POSTFIX@#$POSTFIX#g" -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
     mswindows/osgeo4w/postinstall.bat >$OSGEO4W_ROOT_MSYS/etc/postinstall/grass${PACKAGE_POSTFIX}.bat
@@ -267,6 +269,7 @@ if [ -n "$PACKAGE_PATCH" ]; then
 
     # bat files - unix2dos
     unix2dos bin/${GRASS_EXECUTABLE}.bat.tmpl
+    unix2dos bin/python-${GRASS_EXECUTABLE}.bat
     unix2dos etc/postinstall/grass${PACKAGE_POSTFIX}.bat
     unix2dos etc/preremove/grass${PACKAGE_POSTFIX}.bat
 
@@ -279,6 +282,7 @@ if [ -n "$PACKAGE_PATCH" ]; then
     /bin/tar -cjf $PDIR/grass$PACKAGE_POSTFIX-$VERSION-$PACKAGE_PATCH.tar.bz2 \
 	apps/grass/grass$POSTFIX \
 	bin/${GRASS_EXECUTABLE}.bat.tmpl \
+        bin/python-${GRASS_EXECUTABLE}.bat \
 	etc/postinstall/grass${PACKAGE_POSTFIX}.bat \
 	etc/preremove/grass${PACKAGE_POSTFIX}.bat
 

+ 1 - 0
mswindows/osgeo4w/preremove.bat

@@ -2,4 +2,5 @@ del "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@.lnk"
 del "%OSGEO4W_DESKTOP%\GRASS GIS @VERSION@.lnk"
 
 del "%OSGEO4W_ROOT%\bin\@GRASS_EXECUTABLE@.bat"
+del "%OSGEO4W_ROOT%\bin\python-@GRASS_EXECUTABLE@.bat"
 del "%OSGEO4W_ROOT%"\apps\grass\grass@POSTFIX@\etc\fontcap

+ 21 - 0
mswindows/osgeo4w/python-grass.bat.tmpl

@@ -0,0 +1,21 @@
+@echo off
+rem #########################################################################
+rem #
+rem # GRASS initialization bat script for Python environment (OSGeo4W)
+rem #
+rem #########################################################################
+
+rem
+rem Set environmental variables
+rem
+call "%~dp0\o4w_env.bat"
+call "%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@\etc\env.bat"
+@echo off
+
+set PYTHONPATH=%OSGEO4W_ROOT%\apps\grass\grass@POSTFIX@\etc\python;%PYTHONPATH%
+"%GRASS_PYTHON%" %*
+
+rem
+rem Pause on error
+rem
+if %ERRORLEVEL% GEQ 1 pause