[osgeo4w-dev] o4w-apt: an apt-get like utility for OSGeo4W

Matt Wilkie matt.wilkie at gov.yk.ca
Fri Jul 4 15:47:02 EDT 2008


Here is a batch file to test a "from scratch" install (requires an 
existing python.exe). It's runs successfully with r37 of o4w-apt.py 
(which I'm about to rename simply "apt.py")

-----------
@echo off
echo.
echo.	Install OSGeo4W from scratch
echo.
echo.	THIS WILL REMOVE EXISTING C:\OSGEO_4W!
echo.

if not [%1]==[yes] goto :Usage

:SetEnv
	setlocal
	set pythonpath=
	set osgeo4w_root=C:\OSGeo4W
	set osgeo4w_root_msys=%osgeo4w_root%
	set o4w-apt=c:\OSGeo4W.extras\bin\o4w-apt.py
	set python=d:\PortablePython1.0\python.exe
	echo %python% %o4w-apt% %%* > apt.bat

:CleanSlate
	if exist %osgeo4w_root% rd /s/q %osgeo4w_root%
	md %osgeo4w_root%

:DoIt
	call apt setup
	call apt update
	call apt install gdal

:Test
	%osgeo4w_root%\bin\gdalinfo --version

goto :eof

:Usage
echo.   if you don't say "%0 yes" I won't do it.
--------------




matt wilkie
--------------------------------------------
Geographic Information,
Information Management and Technology,
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
http://environmentyukon.gov.yk.ca/geomatics/
--------------------------------------------


Frank Warmerdam wrote:
> Matt Wilkie wrote:
>>>  - I did not have a setup.ini in c:/osgeo4w/etc/setup, so I ended up 
>>> copying
>>>    it there manually from my cache directory.
>>
>> Ahhh, that is because one needs to run 'o4w-apt setup' first on a new 
>> machine. I neglected to document that.
> 
> Matt,
> 
> Ah!
> 
>>>  - The openev postinstall target did not work on an upgrade because the
>>>    OSGEO4W_ROOT and OSGEO4W_ROOT_MSYS environment variables were not 
>>> defined.
>>
>> I'm getting that error too, even when the env is set:
>> ---------
>> C:\Osgeo4W> set osg
>> OSGEO4W_ROOT=C:\Osgeo4W
> 
> You also need to set OSGEO4W_ROOT_MSYS which should be an MSYS
> compatible path.  Usually something like "/c/OSGeo4W" I think.
> 
>>>  - The setup command does not run \bin\osgeo4w-setup.exe
>>
>> What would the purpose of that be? What will that do that is not 
>> covered by o4w-apt?
> 
> Sorry, I misunderstood the role of the setup command.  I assumed it
> was a way of running the gui.  Disregard my comment.
> 
>> (We've got to find a different name. Mixing numbers and letters 
>> mid-word like that is just too difficult to type!)
> 
> I'd be in favor of just calling your program "apt" instead of o4w-apt -
> I have the same problem with that being very ackward to type.
> 
>>> I'm interested in getting this packaged up (including a "covering"
>>> bat file since the osgeo4w shell does not know how to run .py files).
>>
>> I've got a batch file which does this for all .py in osgeo/bin[1], see 
>> :MakeBats function:
>>    cd /d %OSGEO4W_ROOT%\bin
>>    for %%g in (*.py) do (
>>       if not exist %%~ng.bat echo @python "%%OSGEO4W_ROOT%%\bin\%%g" 
>> %%*  > %%~ng.bat
>>       )
>>    goto :EOF
>>
>> [1] 
>> http://code.google.com/p/maphew/source/browse/trunk/gis/o4w_extras/install-o4w-extras.bat 
>>
>>
>> I'd love to have this included within osgeo4w. I'm sure more skilled 
>> eyes than mine checking it out would be of great benefit.
> 
> This could be a useful addition to the python package, making it easy for
> other packages to create all the stub .bat files as part of their post 
> install
> step.  Perhaps you could file a ticket with the details, and I could update
> the python package to include this, and the gdal-python package to use 
> this.
> 
> PS. While I agree with Jeff that this apt utility will not be the primary
> interface for new users, I think it is very handy for the not insignificant
> group of us who are keen on commandline mechanisms.  I think the hardest
> challenge is ensuring it integrates smoothly with other installation 
> mechanisms
> (like handling of postinstall steps, use of a common cache directory).
> 
> Best regards,



More information about the osgeo4w-dev mailing list