Re: Installing A-A-P with a non-existent PREFIX

Bram Moolenaar <[email protected]> Sat, 17 Jan 2004 13:44:04 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Johan Svedberg wrote:

> Just a small suggestion for improvement when installing A-A-P with a
> non-existent PREFIX (i.e. aap install PREFIX=/no/such/path); I think it
> would be nice if A-A-P asked the user if it's ok to proceed and create
> the PREFIX directory. Currently it will just quit stating that
> /no/such/path isn't writable (yes, there is a typo in main.aap :-)).

How about this patch:

*** main.aap~	Thu Sep 25 20:53:34 2003
--- main.aap	Sat Jan 17 13:29:25 2004
***************
*** 32,38 ****
      @if os.name == 'posix':
  	PREFIX = `os.path.expanduser(_no.PREFIX)`
  	@if not os.access(_no.PREFIX, os.W_OK):
! 	    :error Install directory is not writable: $PREFIX
  
  	# Get the version string from AapVersion.py, because $VERSIONSTR is
  	# from the current Aap, which may be older.
--- 32,45 ----
      @if os.name == 'posix':
  	PREFIX = `os.path.expanduser(_no.PREFIX)`
  	@if not os.access(_no.PREFIX, os.W_OK):
! 	    @if os.access(_no.PREFIX, os.R_OK):
!                 :error Install directory is not writable: $PREFIX
!             @r = raw_input(('\nThe $PREFIX directory does not exist: "%s"\n'
!             @               % _no.PREFIX) +
!             @           "Do you want to try creating it? (y/n) ")
!             @if not r or (r[0] != 'y' and r[0] != 'Y'):
!                 :error Install directory does not exist: $PREFIX
!             :mkdir {r} $PREFIX
  
  	# Get the version string from AapVersion.py, because $VERSIONSTR is
  	# from the current Aap, which may be older.

-- 
    [clop clop]
GUARD #1:  Halt!  Who goes there?
ARTHUR:    It is I, Arthur, son of Uther Pendragon, from the castle of
           Camelot.  King of the Britons, defeator of the Saxons, sovereign of
           all England!
GUARD #1:  Pull the other one!
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn