diff options
author | Mats Wichmann <mats@linux.com> | 2023-08-19 12:44:38 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2023-10-28 14:01:49 (GMT) |
commit | d7904efb2c949647341d364d2235b85b21fc71b9 (patch) | |
tree | 5a09bd0c6285fcc12025f3ee838d54a8de6d2e32 /SCons/PathList.py | |
parent | 2bfab82c0d902ce36bd67e950308d4dcc5b6afac (diff) | |
download | SCons-d7904efb2c949647341d364d2235b85b21fc71b9.zip SCons-d7904efb2c949647341d364d2235b85b21fc71b9.tar.gz SCons-d7904efb2c949647341d364d2235b85b21fc71b9.tar.bz2 |
Add LIBLITERAL to support gcc -l:filename
This is done in a general way. using a construction var, although
at the moment only the GNU linker is known to handle things this way.
Had to do something funky, or it won't work when os.pathsep and
LIBLITRAL are the same, as they are on Linux (i.e. ':'). That's because
SCons.PathList.PathList is called and it does:
class _Pathlist:
def __init__(self, pathlist) -> None:
if SCons.Util.is_String(pathlist):
pathlist = pathlist.split(os.pathsep)
Splitting has the effect of turning ":libm.a" into ((0, ''), (0, 'libm.a')]
That is, the ':' is lost as part of the library specifier - so need to
try to avoid that.
Fixes #3951
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/PathList.py')
-rw-r--r-- | SCons/PathList.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/SCons/PathList.py b/SCons/PathList.py index dab8b2c..33ac7e5 100644 --- a/SCons/PathList.py +++ b/SCons/PathList.py @@ -64,10 +64,9 @@ def node_conv(obj): return result class _PathList: - """ - An actual PathList object. - """ - def __init__(self, pathlist) -> None: + """An actual PathList object.""" + + def __init__(self, pathlist, split=True) -> None: """ Initializes a PathList object, canonicalizing the input and pre-processing it for quicker substitution later. @@ -94,7 +93,10 @@ class _PathList: over and over for each target. """ if SCons.Util.is_String(pathlist): - pathlist = pathlist.split(os.pathsep) + if split: + pathlist = pathlist.split(os.pathsep) + else: # no splitting, but still need a list + pathlist = [pathlist] elif not SCons.Util.is_Sequence(pathlist): pathlist = [pathlist] @@ -141,8 +143,7 @@ class _PathList: class PathListCache: - """ - A class to handle caching of PathList lookups. + """A class to handle caching of PathList lookups. This class gets instantiated once and then deleted from the namespace, so it's used as a Singleton (although we don't enforce that in the @@ -161,7 +162,7 @@ class PathListCache: The main type of duplication we're trying to catch will come from looking up the same path list from two different clones of the same construction environment. That is, given - + env2 = env1.Clone() both env1 and env2 will have the same CPPPATH value, and we can @@ -189,7 +190,7 @@ class PathListCache: return pathlist @SCons.Memoize.CountDictCall(_PathList_key) - def PathList(self, pathlist): + def PathList(self, pathlist, split=True): """ Returns the cached _PathList object for the specified pathlist, creating and caching a new object as necessary. @@ -206,7 +207,7 @@ class PathListCache: except KeyError: pass - result = _PathList(pathlist) + result = _PathList(pathlist, split) memo_dict[pathlist] = result |