SCons if/then 语句
我在顶级目录中有一个 SConscript 文件,并且有许多子目录,其中包含包含不同键/值对的 JSON 文件。我的 SConscript 文件中有一个 env.Command()
,我希望根据特定键的值来调用它。在 Scons 中执行此操作的最佳方法是什么?
我在想这样的事情:
env.Command(
test = Value(params['json_key'])
if test == "True":
target = out.txt,
source = in.txt,
action = 'function $SOURCE $TARGET'
else:
pass
)
I have a single SConscript file in a top level directory and I have many subdirectories with JSON files containing different key/value pair. I have one env.Command()
in my SConscript file that I want to be called based on the value of a particular key. What is the best way to do this in Scons?
I was thinking something like:
env.Command(
test = Value(params['json_key'])
if test == "True":
target = out.txt,
source = in.txt,
action = 'function $SOURCE $TARGET'
else:
pass
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 Python,你不能将 if/else 放在类似的东西中。但是,您可以使用字典将参数传递给
env.Command
。This is Python, you cannot put an if/else inside something else like that. However, you can pass arguments to
env.Command
using a dictionary.