[Scons-users] use of abspath
Bill Deegan
bill at baddogconsulting.com
Fri Aug 11 14:01:52 EDT 2017
is FOO_SRC going to end up in a list of sources for a builder?
If so,
src_files = [ File(s) for s in list_of_local_src_files] # where entries in
list are like 'blah.c'
Should suffice.
-Bill
On Fri, Aug 11, 2017 at 10:18 AM, Mats Wichmann <mats at wichmann.us> wrote:
>
> Bear with me, this project is taking me a really long time to sort out,
> there are 20,000 lines in aggregate in the sconscripts.
>
> One of the things I've been chasing is builds which bypass VariantDir -
> where objects land in the src directory rather than in the variant.
>
> Some of the reasons for this are pretty obvious, those places using
> "native Python" in a way that leaves scons out of the loop:
>
> src_dir = os.path.abspath(os.curdir)
>
> some_env.PrependUnique(CPPPATH=[src_dir])
>
> src_files = [
> os.path.join(src_dir, 'somefile.c'),
> ...
>
>
> src_dir is thus an absolute path obtained outside scons which has no
> chance to do the appropriate substitution. A simple change to:
>
> src_dir = Dir('.').abspath
>
> moves things in the direction I want.
>
> that's not really the question, though. Along the way I get curious,
> why 'abspath'? Is there a compelling reason to use an absolute path
> _except_ when referring to things that are outside the project tree
> (system files, cross-compile toolchains, the like: there an abspath
> makes sense to me)? Since .path is relative to the top of the tree,
> wouldn't that do as well?
>
> In fact, is there a better model for referring to source files in
> target-specific subdirectories, which is what is happening here?
>
> Namely, a script in one directory starts building a list of files for
> eventually passing to a builder, call it FOO_SRC, from common files,
> then based on target, or based on selection from a list of supported
> interfaces, calls an sconscript in an appropriately named subdirectory
> which adds to FOO_SRC:
>
> some_env.AppendUnique(FOO_SRC=src_files)
>
> For building that list, is there a better model than using:
>
> os.path.join(full-path-to-current-subdir, 'somefile.c')
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170811/c531cd4a/attachment.html>
More information about the Scons-users
mailing list