Skip to content

Commit

Permalink
is link should use the base nodes lstat instead of local fs stat
Browse files Browse the repository at this point in the history
builder is not garunteed to be in the environment, so check if the node is the ninja_file

fix sider issues
  • Loading branch information
dmoody256 committed May 14, 2020
1 parent 0d1602a commit c786703
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
7 changes: 3 additions & 4 deletions SCons/Node/FS.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,12 +762,11 @@ def isfile(self):

if hasattr(os, 'symlink'):
def islink(self):
try: st = self.fs.lstat(self.get_abspath())
except os.error: return 0
return stat.S_ISLNK(st[stat.ST_MODE])
st = self.lstat()
return st is not None and stat.S_ISLNK(st[stat.ST_MODE])
else:
def islink(self):
return 0 # no symlinks
return False # no symlinks

def is_under(self, dir):
if self is dir:
Expand Down
7 changes: 4 additions & 3 deletions SCons/Tool/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ def action_to_ninja_build(self, node, action=None):
# Ninja builders out of being sources of ninja builders but I
# can't fix every DAG problem so we just skip ninja_builders
# if we find one
if node.builder == self.env["BUILDERS"]["Ninja"]:
global NINJA_STATE
if NINJA_STATE.ninja_file == str(node):
build = None
elif isinstance(action, SCons.Action.FunctionAction):
if isinstance(action, SCons.Action.FunctionAction):
build = self.handle_func_action(node, action)
elif isinstance(action, SCons.Action.LazyAction):
# pylint: disable=protected-access
Expand Down Expand Up @@ -1043,7 +1044,7 @@ def ninja_builder(env, target, source):
if env["PLATFORM"] == "win32":
# this is not great, its doesn't consider specific
# node environments, which means on linux the build could
# behave differently, becuase on linux you can set the environment
# behave differently, because on linux you can set the environment
# per command in the ninja file. This is only needed if
# running ninja directly from a command line that hasn't
# had the environment setup (vcvarsall.bat)
Expand Down
2 changes: 1 addition & 1 deletion test/ninja/build_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
_exe = TestSCons._exe

ninja_bin = os.path.abspath(os.path.join(
importlib.import_module(".ninja_syntax", package='ninja').__file__,
ninja.__file__,
os.pardir,
'data',
'bin',
Expand Down
2 changes: 1 addition & 1 deletion test/ninja/copy_function_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
_exe = TestSCons._exe

ninja_bin = os.path.abspath(os.path.join(
importlib.import_module(".ninja_syntax", package='ninja').__file__,
ninja.__file__,
os.pardir,
'data',
'bin',
Expand Down
2 changes: 1 addition & 1 deletion test/ninja/generate_and_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
_exe = TestSCons._exe

ninja_bin = os.path.abspath(os.path.join(
importlib.import_module(".ninja_syntax", package='ninja').__file__,
ninja.__file__,
os.pardir,
'data',
'bin',
Expand Down
2 changes: 1 addition & 1 deletion test/ninja/generate_and_build_cxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
_exe = TestSCons._exe

ninja_bin = os.path.abspath(os.path.join(
importlib.import_module(".ninja_syntax", package='ninja').__file__,
ninja.__file__,
os.pardir,
'data',
'bin',
Expand Down
2 changes: 1 addition & 1 deletion test/ninja/generate_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
_exe = TestSCons._exe

ninja_bin = os.path.abspath(os.path.join(
importlib.import_module(".ninja_syntax", package='ninja').__file__,
ninja.__file__,
os.pardir,
'data',
'bin',
Expand Down
10 changes: 5 additions & 5 deletions test/ninja/iterative_speedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
_exe = TestSCons._exe

ninja_bin = os.path.abspath(os.path.join(
importlib.import_module(".ninja_syntax", package='ninja').__file__,
ninja.__file__,
os.pardir,
'data',
'bin',
Expand Down Expand Up @@ -220,14 +220,14 @@ def mod_source_orig(test_num):
scons_times += [stop - start]

full_build_print = True
for ninja, scons in zip(ninja_times, scons_times):
if ninja > scons:
for ninja_time, scons_time in zip(ninja_times, scons_times):
if ninja_time > scons_time:
test.fail_test()
if full_build_print:
full_build_print = False
print("Clean build {} files - SCons: {:.3f}s Ninja: {:.3f}s".format(num_source, scons, ninja))
print("Clean build {} files - SCons: {:.3f}s Ninja: {:.3f}s".format(num_source, scons_time, ninja_time))
else:
print("Single File Rebuild - SCons: {:.3f}s Ninja: {:.3f}s".format(scons, ninja))
print("Single File Rebuild - SCons: {:.3f}s Ninja: {:.3f}s".format(scons_time, ninja_time))

test.pass_test()

Expand Down
2 changes: 1 addition & 1 deletion test/ninja/multi_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
_exe = TestSCons._exe

ninja_bin = os.path.abspath(os.path.join(
importlib.import_module(".ninja_syntax", package='ninja').__file__,
ninja.__file__,
os.pardir,
'data',
'bin',
Expand Down
2 changes: 1 addition & 1 deletion test/ninja/shell_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
_exe = TestSCons._exe

ninja_bin = os.path.abspath(os.path.join(
importlib.import_module(".ninja_syntax", package='ninja').__file__,
ninja.__file__,
os.pardir,
'data',
'bin',
Expand Down

0 comments on commit c786703

Please sign in to comment.