Re: Scons-users Digest, Vol 133, Issue 9

Mats Wichmann <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
On 9/11/22 07:36, Lan Yang wrote:
> 
> Hi Bill:
> The Scons version I used was v3.1.0. Thank you.
> 
> Hi Mats
> Thank you for your notation. I've learned a lot from your words.
> I've changed the code " srcs = Glob(PATTERN) "  in my project to  "srcs 
> = sorted(Glob(PATTERN, key=lambda t: t.name <http://t.name/>)) " and 
> tested it.
> The test result is ... the change won't make the link order stable.
> I think it's because there are several " srcs = Glob(PATTERN) "  in 
> different Sconscript files of my project.
> Would you please offer a demo project, in which this change 
> (sorted(Glob....) works well.?
> 
> Thank you all.
> 
> Best regards
> Lan

Well... it turns out after I did some further research, I was wrong: 
results from Glob() are sorted already, so it's not a surprise this does 
not help.  However, results from Python's glob.glob() are not sorted.  I 
don't know enough about the project yet to know if they are a factor 
here, but I see from some grepping in rt-thread that

tools/kconfiglib.py uses iglob, but sorts it.
tools/eclipse.py and tools/building.py use glob, and do not appear to 
sort the results.

Perhaps the problem stems from something generated in the latter two?

 From kconfiglib we can see this telling comment:

     # - glob() doesn't support globbing relative to a directory, so
     #   we need to prepend $srctree to 'pattern'. Use join()
     #   instead of '+' so that an absolute path in 'pattern' is
     #   preserved.
     #
     # - Sort the glob results to ensure a consistent ordering of
     #   Kconfig symbols, which indirectly ensures a consistent
     #   ordering in e.g. .config files
     filenames = sorted(iglob(join(self._srctree_prefix, pattern)))

Hope this is of some use....



_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
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.