[GRASS-dev] [GRASS GIS] #2333: choose python interpreter during the GRASS installation on windows

GRASS GIS trac at osgeo.org
Mon Jun 16 02:24:15 PDT 2014


#2333: choose python interpreter during the GRASS installation on windows
--------------------------------------------------+-------------------------
 Reporter:  zarch                                 |       Owner:  grass-dev@…              
     Type:  enhancement                           |      Status:  new                      
 Priority:  normal                                |   Milestone:  7.1.0                    
Component:  Python                                |     Version:  svn-trunk                
 Keywords:  windows installer python interpreter  |    Platform:  MSWindows 8              
      Cpu:  All                                   |  
--------------------------------------------------+-------------------------

Comment(by zarch):

 Replying to [comment:11 hellik]:
 > Replying to [comment:10 zarch]:
 > >
 > > ok, next week I will try to look in to the nsis script to see if
 > > it is possible to add this option during the installation process.
 >
 > some steps may be:
 >
 > - add e new installer gui-section "Customize python" (or something like
 that)
 >
 > - add some explanations to the gui-section "Customize python": e.g.
 compatible wxpython, numpy, matplotlib, etc. are needed, ...
 >
 > - default option: %GRASS_PYTHON% is the packaged python
 >
 > - user option: ask the user for the %PATH% to the user wanted python

 [[BR]]

 Thank you Helmut for your help.

 I'm not sure If I understood how to add a new section, I wrote:

 {{{
 Section "Customize python" CustomizePython
         ;Declares variables for optional Python interpreter
         Var /GLOBAL PYINTERPRETER
         Var /GLOBAL PYHOME

         ;Set default values for the Python Interpreter
         ${If} $ASK_FOR_PYINTERP == "NO"
                 StrCpy $PYINTERPRETER "%GISBASE%\extrabin\python.exe"
         ${Else}
                 StrCpy $PYINTERPRETER "$INST_PYINTERP"
         ${EndIf}

         ;Set default values for the Python home folder
         ${If} $ASK_FOR_PYHOME == "NO"
                 StrCpy $PYHOME "%GISBASE%\Python27"
         ${Else}
                 StrCpy $PYHOME "$INST_PYHOME"
         ${EndIf}


         ;Create the etc\env.bat
         ClearErrors
         FileOpen $0 $INSTALL_DIR\etc\env.bat w
         IfErrors done_create_grass_environments.bat
         FileWrite $0 '@echo off$\r$\n'
         FileWrite $0 'rem
 #########################################################################$\r$\n'
         FileWrite $0 'rem #$\r$\n'
         FileWrite $0 'rem # File dynamically created by NSIS installer
 script;$\r$\n'
         FileWrite $0 'rem #$\r$\n'
         FileWrite $0 'rem
 #########################################################################$\r$\n'
         FileWrite $0 'rem #$\r$\n'
         FileWrite $0 'rem # Environmental variables for GRASS stand-alone
 installer$\r$\n'
         FileWrite $0 'rem #$\r$\n'
         FileWrite $0 'rem
 #########################################################################$\r$\n'
         FileWrite $0 '$\r$\n'
         FileWrite $0 'set GRASS_SH=%GISBASE%\msys\bin\sh.exe$\r$\n'
         FileWrite $0 '$\r$\n'
         FileWrite $0 'set GRASS_HTML_BROWSER=explorer"$\r$\n'
         FileWrite $0 '$\r$\n'
         FileWrite $0 'set GRASS_PYTHON=$PYINTERPRETER$\r$\n'
         FileWrite $0 'set PYTHONHOME=$PYHOME$\r$\n'
         FileWrite $0 '$\r$\n'
         FileWrite $0 'set GRASS_PROJSHARE=%GISBASE%\share\proj$\r$\n'
         FileWrite $0 '$\r$\n'
         FileWrite $0 'set PROJ_LIB=%GISBASE%\share\proj$\r$\n'
         FileWrite $0 'set GDAL_DATA=%GISBASE%\share\gdal$\r$\n'
         FileWrite $0 'set GEOTIFF_CSV=%GISBASE%\share\epsg_csv$\r$\n'
         FileWrite $0 '$\r$\n'
         FileWrite $0 'set PATH=%GISBASE%\msys\bin;%PATH%$\r$\n'
         FileWrite $0 'set PATH=%GISBASE%\extrabin;%PATH%$\r$\n'
         FileWrite $0 'set PATH=%GISBASE%\bin;%PATH%$\r$\n'
         FileClose $0
 SectionEnd
 }}}

 Do you see any better way to implement this, avoiding to generate the
 env.bat file?

 How can I define as optional to set the path to the python interpreter and
 to the python home in the GUI?
 Where should I add the description with the python requirements (numpy,
 wxpython, etc)?

 There is a way to view/test the modified NSIS file?

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2333#comment:12>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list