Subst.py (SCons-4.3.0) | : | Subst.py (SCons-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 132 | skipping to change at line 132 | |||
return str(arg) | return str(arg) | |||
class CmdStringHolder(collections.UserString): | class CmdStringHolder(collections.UserString): | |||
"""This is a special class used to hold strings generated by | """This is a special class used to hold strings generated by | |||
scons_subst() and scons_subst_list(). It defines a special method | scons_subst() and scons_subst_list(). It defines a special method | |||
escape(). When passed a function with an escape algorithm for a | escape(). When passed a function with an escape algorithm for a | |||
particular platform, it will return the contained string with the | particular platform, it will return the contained string with the | |||
proper escape sequences inserted. | proper escape sequences inserted. | |||
""" | """ | |||
def __init__(self, cmd, literal=None): | def __init__(self, cmd, literal=None): | |||
collections.UserString.__init__(self, cmd) | super().__init__(cmd) | |||
self.literal = literal | self.literal = literal | |||
def is_literal(self): | def is_literal(self): | |||
return self.literal | return self.literal | |||
def escape(self, escape_func, quote_func=quote_spaces): | def escape(self, escape_func, quote_func=quote_spaces): | |||
"""Escape the string with the supplied function. The | """Escape the string with the supplied function. The | |||
function is expected to take an arbitrary string, then | function is expected to take an arbitrary string, then | |||
return it with all special characters escaped and ready | return it with all special characters escaped and ready | |||
for passing to the command interpreter. | for passing to the command interpreter. | |||
skipping to change at line 486 | skipping to change at line 486 | |||
In addition, however, this class is used to track the state of | In addition, however, this class is used to track the state of | |||
the result(s) we're gathering so we can do the appropriate thing | the result(s) we're gathering so we can do the appropriate thing | |||
whenever we have to append another word to the result--start a new | whenever we have to append another word to the result--start a new | |||
line, start a new word, append to the current word, etc. We do | line, start a new word, append to the current word, etc. We do | |||
this by setting the "append" attribute to the right method so | this by setting the "append" attribute to the right method so | |||
that our wrapper methods only need ever call ListSubber.append(), | that our wrapper methods only need ever call ListSubber.append(), | |||
and the rest of the object takes care of doing the right thing | and the rest of the object takes care of doing the right thing | |||
internally. | internally. | |||
""" | """ | |||
def __init__(self, env, mode, conv, gvars): | def __init__(self, env, mode, conv, gvars): | |||
collections.UserList.__init__(self, []) | super().__init__([]) | |||
self.env = env | self.env = env | |||
self.mode = mode | self.mode = mode | |||
self.conv = conv | self.conv = conv | |||
self.gvars = gvars | self.gvars = gvars | |||
if self.mode == SUBST_RAW: | if self.mode == SUBST_RAW: | |||
self.add_strip = lambda x: self.append(x) | self.add_strip = lambda x: self.append(x) | |||
else: | else: | |||
self.add_strip = lambda x: None | self.add_strip = lambda x: None | |||
self.in_strip = None | self.in_strip = None | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |