Re: Re: [A-a-p-user] dependencies in generated C++ files

Bram Moolenaar <[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Adriaan de Groot wrote:

> On Monday 06 October 2003 22:14, you wrote:
> > That is a possible solution.  But we already have src2obj(), which does
> > something very similar.
> >
> > This assumes you know when a file could be in a build directory.  You
> > could then do:
> >
> > 	with_new_bdir = $BDIR/`strip_bdir(_no.with_old_bdir)`
> >
> > It's a bit longer than your proposed bdir() function though...
> 
> def bdir(s)
>   if s.starts_with(_no.get("BDIR")):
>     return s
>   else:
>     return _no.get("BDIR") + s
> 
> with perhaps a check that BDIR is defined. I'll play around and see what 
> works.

One problem with this solution is that the value of $BDIR may change,
depending on variants.  I have run into that problem before.  A rough
approach is to check for a directory name "build-*".  Also, it's
possible that both an absolute path and a relative path are used for the
same directory, that needs to be taken care of for robustness.

You need to use os.path.join() for concatenating parts of a path.

I start sounding like a teacher, don't I? :-)

-- 
I AM THANKFUL...
...for the piles of laundry and ironing because it means I
have plenty of clothes to wear.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.