Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
specified `local_only`, but the code and tests were using `keep_local`. The functionality
more closely matches local only. NOTE: It doesn't seem like any code in the wild was using
local_only as we'd not received any reports of such until PR #4606 from hedger.
- Fix Issue #2281, AddPreAction() & AddPostAction() were being ignored if no action
was specified when the Alias was initially created.

From Alex James:
- On Darwin, PermissionErrors are now handled while trying to access
Expand Down
2 changes: 2 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ FIXES
more closely matches local only. NOTE: It doesn't seem like any code in the wild was using
local_only as we'd not received any reports of such until PR #4606 from hedger.

- Fix Issue #2281, AddPreAction() & AddPostAction() were being ignored if no action
was specified when the Alias was initially created.

IMPROVEMENTS
------------
Expand Down
10 changes: 8 additions & 2 deletions SCons/Node/Alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,15 @@ def sconsign(self) -> None:
#
#

def build(self) -> None:
def build(self, **kw) -> None:
"""A "builder" for aliases."""
pass
if len(self.executor.post_actions) + len(self.executor.pre_actions) > 0:
# Only actually call Node's build() if there are any
# pre or post actions.
# Alias nodes will get 1 action and Alias.build()
# This fixes GH Issue #2281
return self.really_build(**kw)


def convert(self) -> None:
try: del self.builder
Expand Down
16 changes: 16 additions & 0 deletions test/Alias/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ def bar(target, source, env):
env.Alias('build-add3', f6)
env.Alias('build-add3', action=foo)
env.Alias('build-add3', action=bar)


f7 = env.Cat('f7.out', 'f6.in')
def build_it(target, source, env):
print("build_it: Goodbye")
return 0

def string_it(target, source, env):
return("string it: Goodbye")

s = Action(build_it, string_it)
env.Alias('add_post_action', f7)
env.AddPostAction('add_post_action', s)
""")

test.write('f1.in', "f1.in 1\n")
Expand Down Expand Up @@ -133,6 +146,9 @@ def bar(target, source, env):
test.must_match('foo', "foo(['build-add3'], ['f6.out'])\n")
test.must_match('bar', "bar(['build-add3'], ['f6.out'])\n")

test.run(arguments = 'add_post_action')
test.must_contain_all(test.stdout(), 'string it: Goodbye')

test.pass_test()

# Local Variables:
Expand Down