Geu*_*uis 3 python variables scons
我正在为一个项目开发一个SConstruct构建文件,我正在尝试从Options更新为Variables,因为Options已被弃用.我不明白如何使用变量.我有0 python经验,这可能有助于此.
例如,我有这个:
opts = Variables()
opts.Add('fcgi',0)
print opts['fcgi']
Run Code Online (Sandbox Code Playgroud)
但是我收到一个错误:
AttributeError: Variables instance has no attribute '__getitem__':
Run Code Online (Sandbox Code Playgroud)
不知道这应该如何工作
通常,您会将变量存储在环境中以供以后测试.
opts = Variables()
opts.Add('fcgi',0)
env = Environment(variables=opts, ...)
Run Code Online (Sandbox Code Playgroud)
然后你可以测试:
if env['fcgi'] == 0:
# do something
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1565 次 |
| 最近记录: |