[Scons-dev] Can Node.FS.Base.Rfindalldirs return uniquified results?
Paweł Tomulik
ptomulik at meil.pw.edu.pl
Tue Oct 27 08:08:19 EDT 2015
W dniu 27.10.2015 o 12:45, Simon Tegelid pisze:
> Hi,
>
> Node.FS.Base.Rfindalldirs is used for include flag generation and lookup
> of directories from *PATH vars. It might occur duplicate paths of
> various reasons (eg. after variable substitution) in the return value
> from Rfindalldirs. Wouldn't it be neat to uniqify that list to avoid
> duplicate include flags for example?
>
> diff --git a/scons-local-2.3.4/SCons/Node/FS.py
> b/scons-local-2.3.4/SCons/Node/FS.py
> index 4b95613..41dd8c7 100644
> --- a/scons-local-2.3.4/SCons/Node/FS.py
> +++ b/scons-local-2.3.4/SCons/Node/FS.py
> @@ -847,9 +847,15 @@ class Base(SCons.Node.Node):
> dir = create_dir_relative_to_self(path)
> result.extend(dir.get_all_rdirs())
>
> - memo_dict[pathlist] = result
> -
> - return result
> + seen = set()
> + uniqresult = []
> + for r in result:
> + if r.path not in seen:
> + uniqresult.append(r)
> + seen.add(r.path)
> + memo_dict[pathlist] = uniqresult
> +
> + return uniqresult
>
> def RDirs(self, pathlist):
> """Search for a list of directories in the Repository list."""
>
> --
> Simon Tegelid
>
>
> _______________________________________________
> Scons-dev mailing list
> Scons-dev at scons.org
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>
Just FYI: Scons.Util.unique(), SCons.Util.uniquer(),
SCons.Util.uniquer_hashables()
https://bitbucket.org/scons/scons/src/9983e5d6e0bbbe5f2d3543e379e4a31e25cb3c71/src/engine/SCons/Util.py?at=default&fileviewer=file-view-default#Util.py-1052
https://bitbucket.org/scons/scons/src/9983e5d6e0bbbe5f2d3543e379e4a31e25cb3c71/src/engine/SCons/Util.py?at=default&fileviewer=file-view-default#Util.py-1129
https://bitbucket.org/scons/scons/src/9983e5d6e0bbbe5f2d3543e379e4a31e25cb3c71/src/engine/SCons/Util.py?at=default&fileviewer=file-view-default#Util.py-1148
--
Paweł Tomulik, tel. (22) 234 7925
Instytut Techniki Lotniczej i Mechaniki Stosowanej
Politechnika Warszawska
More information about the Scons-dev
mailing list