Created
May 5, 2021 03:22
-
-
Save acmorrow/db74587167e0e83d8ebfde702228c9cb to your computer and use it in GitHub Desktop.
Repro for _concat not forwarding for_signature to generators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import atexit | |
calls = 0 | |
signature_calls = 0 | |
def some_generator(target, source, env, for_signature): | |
global calls, signature_calls | |
calls += 1 | |
if for_signature: | |
signature_calls += 1 | |
return "magic" | |
env = DefaultEnvironment() | |
env['GEN'] = some_generator | |
gen1 = env.Command( | |
target="#genny1", | |
source=[], | |
action="echo $GEN", | |
) | |
env.Pseudo(gen1) | |
env.Alias('good', gen1) | |
env['GENLIST'] = ['$GEN'] | |
env['GENPREFIX'] = 'PRE' | |
env['GENSUFFIX'] = 'SUF' | |
env['CONCAT_GEN'] = '$( ${_concat(GENPREFIX, GENLIST, GENSUFFIX, __env__, lambda x: x, TARGET, SOURCE)} $) ' | |
gen2 = env.Command( | |
target="#genny2", | |
source=[], | |
action="echo $CONCAT_GEN", | |
) | |
env.Pseudo(gen2) | |
env.Alias('bad', gen2) | |
env.Default(None) | |
def print_counts(): | |
global calls, signature_calls | |
print('some_generator was called', calls) | |
print('some_generaator was called for sig', signature_calls) | |
atexit.register(print_counts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment