Re: :action depend for D
"Lars Ivar Igesund" <[email protected]> Fri, 14 Nov 2003 11:25:30 +0100
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <01f201c3aa99$a0f8bd40$0200000a@mesmer> |
----- Original Message ----- From: "Bram Moolenaar" <[email protected]> > > Asking the user for a path to install in at least offers a solution that > can work. This is a step in the right direction. > > The wording of the choices could be a bit better. The user must have a > good idea of what happens when he makes the choice. > > ---------- > The "ddepcheck" program cannot be found. > Aap can build and install it for you, but you don't have write > access to the Aap binaries directory. > > 1. Become root and install in the Aap binaries directory. > 2. Specify another location to install ddepcheck. > q. Quit > Select an option: > > It's nice to make a loop, so that a retry is done for an invalid answer. > > Note that with the seocnd choice, for this one instance Aap knows where > ddepcheck is located, thus Aap can continue. Only the next time the > directory must be in $PATH. Ok, patch to replace yesterday's patch is attached. > > A luxury version would parse $PATH and offer a choice in which of the > directories to install (only writable directories to be offered). This and maybe more would probably qualify as a python function that can be used for other projects as well. Lars Ivar Igesund
d.diff
(application/octet-stream, 2.2 KB)
Index: d.aap
===================================================================
RCS file: /cvsroot/a-a-p/Exec/modules/d.aap,v
retrieving revision 1.9
diff -u -r1.9 d.aap
--- d.aap 5 Nov 2003 16:21:34 -0000 1.9
+++ d.aap 14 Nov 2003 10:18:26 -0000
@@ -37,9 +37,39 @@
:mkdir {force} $bindir
:print ddepcheck not found, building from: $toolsdir/ddepcheck.d
:progsearch dc dmd
- :sys $dc -O -of$bindir`os.sep`ddepcheck$EXESUF $toolsdir`os.sep`ddepcheck.d
+ @if not os.access(Global.aap_bindir, os.W_OK):
+ :print -----------
+ :print The "ddepcheck" program cannot be found
+ :print Aap can build and install it for you, but you don't have write
+ :print access to the Aap binaries directory.
+ @r = " "
+ @while not r == '1' and not r == '2':
+ :print 1. Become root/administrator and install in the Aap binaries
+ directory.
+ :print 2. Specify another location to install ddepcheck.
+ :print q. Quit
+ @r = raw_input("Select an option: ")
+ @if r == '1':
+ :asroot $dc -O -of$bindir`os.sep`ddepcheck$EXESUF
+ $toolsdir`os.sep`ddepcheck.d
+ @elif r == '2':
+ :print The path entered must be writable from your user.
+ @bindir = raw_input("Enter install path for ddepcheck ")
+ :sys $dc -O -of$bindir`os.sep`ddepcheck$EXESUF
+ $toolsdir`os.sep`ddepcheck.d
+ :print NOTE: It might be necessary to add $bindir to your PATH
+ before the next execution of Aap.
+ :print Also, if you are using a shell, it might be necessary to
+ restart it.
+ _top.DDEPCHECK = $bindir`os.sep`ddepcheck$EXESUF
+ @elif r == 'q':
+ :quit
+ @else:
+ :sys $dc -O -of$bindir`os.sep`ddepcheck$EXESUF
+ $toolsdir`os.sep`ddepcheck.d
:del {q} ddepcheck$OBJSUF ddepcheck.map
- :progsearch _top.DDEPCHECK ddepcheck
+ @if not _top.DDEPCHECK:
+ :progsearch _top.DDEPCHECK ddepcheck
@if not _top.DDEPCHECK:
:error Building ddepcheck failed or the program cannot be found.