Re: PREFIX and DESTDIR not working

Bram Moolenaar <[email protected]> Sun, 18 Jan 2004 12:35:35 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Scott Henry Harrison wrote:

> Despite the thread about PREFIX and DESTDIR always working,
> I cannot create one test scenario where they work.  What
> am I doing wrong? 

[...]

It appears there is a bug in install_files(), causing $DESTDIR not being
used.  What happens is that os.path.join("/foo", "/bar") results in
"/bar".  Apparently it cleverly decides that "/bar" is an absolute path
and prepending something to it is wrong?  Strange...

Anyway, it's easy to fix:

*** RecPython.py~	Sun Jan 18 12:20:34 2004
--- RecPython.py	Sun Jan 18 12:20:35 2004
***************
*** 1041,1046 ****
--- 1041,1048 ----
      dest = os.path.join(os.path.expanduser(prefix), destlist[0]["name"])
      destdir = get_var_val(0, recdict, "_no", "DESTDIR")
      if destdir:
+         while dest[0] in "/\\":
+             dest = dest[1:]     # remove leading slashes before joining
          dest = os.path.join(os.path.expanduser(destdir), dest)
  
      for item in str2dictlist(recdict, source):

-- 
ARTHUR:    Well, it doesn't matter.  Will you go and tell your master that
           Arthur from the Court of Camelot is here.
GUARD #1:  Listen, in order to maintain air-speed velocity, a swallow
           needs to beat its wings 43 times every second, right?
ARTHUR:    Please!
                                  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