"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "SCons/Tool/ninja/Utils.py" between
scons-4.2.0.tar.gz and SCons-4.3.0.tar.gz

About: SCons is a software construction tool (a Python script and a set of modules as a superior alternative to the classic "Make" build tool).

Utils.py  (scons-4.2.0):Utils.py  (SCons-4.3.0)
skipping to change at line 188 skipping to change at line 188
return src return src
return get_path(node) return get_path(node)
def get_rule(node, rule): def get_rule(node, rule):
tlist, slist = get_targets_sources(node) tlist, slist = get_targets_sources(node)
if invalid_ninja_nodes(node, tlist): if invalid_ninja_nodes(node, tlist):
return "TEMPLATE" return "TEMPLATE"
else: else:
return rule return rule
def generate_depfile(env, node, dependencies): def to_escaped_list(env, lst):
""" """
Ninja tool function for writing a depfile. The depfile should include Ninja tool function for returning an escaped list of strings from a subst
the node path followed by all the dependent files in a makefile format. generator.
dependencies arg can be a list or a subst generator which returns a list. env_var arg can be a list or a subst generator which returns a list.
""" """
depfile = os.path.join(get_path(env['NINJA_DIR']), str(node) + '.depfile')
# subst_list will take in either a raw list or a subst callable which genera tes # subst_list will take in either a raw list or a subst callable which genera tes
# a list, and return a list of CmdStringHolders which can be converted into raw strings. # a list, and return a list of CmdStringHolders which can be converted into raw strings.
# If a raw list was passed in, then scons_list will make a list of lists fro m the original # If a raw list was passed in, then scons_list will make a list of lists fro m the original
# values and even subst items in the list if they are substitutable. Flatten will flatten # values and even subst items in the list if they are substitutable. Flatten will flatten
# the list in that case, to ensure for either input we have a list of CmdStr ingHolders. # the list in that case, to ensure for either input we have a list of CmdStr ingHolders.
deps_list = env.Flatten(env.subst_list(dependencies)) deps_list = env.Flatten(env.subst_list(lst))
# Now that we have the deps in a list as CmdStringHolders, we can convert th em into raw strings # Now that we have the deps in a list as CmdStringHolders, we can convert th em into raw strings
# and make sure to escape the strings to handle spaces in paths. We also wil l sort the result # and make sure to escape the strings to handle spaces in paths. We also wil l sort the result
# keep the order of the list consistent. # keep the order of the list consistent.
escaped_depends = sorted([dep.escape(env.get("ESCAPE", lambda x: x)) for dep return sorted([dep.escape(env.get("ESCAPE", lambda x: x)) for dep in deps_li
in deps_list]) st])
depfile_contents = str(node) + ": " + ' '.join(escaped_depends)
def generate_depfile(env, node, dependencies):
"""
Ninja tool function for writing a depfile. The depfile should include
the node path followed by all the dependent files in a makefile format.
dependencies arg can be a list or a subst generator which returns a list.
"""
depfile = os.path.join(get_path(env['NINJA_DIR']), str(node) + '.depfile')
depfile_contents = str(node) + ": " + ' '.join(to_escaped_list(env, dependen
cies))
need_rewrite = False need_rewrite = False
try: try:
with open(depfile, 'r') as f: with open(depfile, 'r') as f:
need_rewrite = (f.read() != depfile_contents) need_rewrite = (f.read() != depfile_contents)
except FileNotFoundError: except FileNotFoundError:
need_rewrite = True need_rewrite = True
if need_rewrite: if need_rewrite:
os.makedirs(os.path.dirname(depfile) or '.', exist_ok=True) os.makedirs(os.path.dirname(depfile) or '.', exist_ok=True)
 End of changes. 6 change blocks. 
10 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)