为什么默认情况下 scons 不会在 ~/.scons/site_scons 中查找?
我这里有一个谜:我正在使用Ubuntu SCons(软件包版本1.2.0.d20100117-1)。我有一个目录 $HOME/.scons/site_scons/
,所有文档都说它应该是默认搜索的站点目录之一。有一个模块子目录fpga
。在我的项目目录中,我有一个 SConstruct
文件,仅包含:
import fpga
奇怪的是:当我运行 scons
时,出现以下错误:
$ scons
scons: Reading SConscript files ...
ImportError: No module named fpga:
File "BLAh/foo/SConstruct", line 1:
import fpga
如果我运行 scons --site-dir=$HOME/.scons/site_scons
,这看起来无论如何都应该是默认的,然后一切都像魅力一样。
另一个奇怪的地方是:当我运行 strace scons 时,它从不尝试 stat 或 open 或 $HOME/.scons -- 事实上,它查找 site_scons
的唯一位置是 ./site_scons
。
还有其他人见过这个吗?
I have a mystery here: I'm using Ubuntu SCons (package version 1.2.0.d20100117-1). I have a directory $HOME/.scons/site_scons/
, which all the documentation says should be one of the site directories searched by default. There's a module subdirectory fpga
. In my project directory, I have an SConstruct
file consisting solely of:
import fpga
Here's the oddity: When I just run scons
, I get the following error:
$ scons
scons: Reading SConscript files ...
ImportError: No module named fpga:
File "BLAh/foo/SConstruct", line 1:
import fpga
If I run scons --site-dir=$HOME/.scons/site_scons
, which seems like it should be the default anyway, then everything works like a charm.
An additional oddity: When I run strace scons
, it never tries to stat
or open
$HOME/.scons
-- in fact the only place it looks for site_scons
is ./site_scons
.
Has anyone else ever seen this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要更新到更高版本才能让 ~/.scons 自动被 SCons 拾取。
这是 1.2 文档,其中没有提到 ~/.scons
http: //scons.org/doc/1.2.0/HTML/scons-man.html
You'll need to update to a later version to get ~/.scons to automatically get picked up by SCons.
Here's the 1.2 docs, which don't mention the ~/.scons
http://scons.org/doc/1.2.0/HTML/scons-man.html
据我所知, site_scons 文件夹应该与 SConstruct 文件位于同一文件夹中。然后就可以正常工作了。当您拥有计算机范围的 site_scons 文件夹时,可以使用 --site-dir 选项。
As far as I know, the site_scons folder is supposed to be in the same folder as the SConstruct file. Then it works fine. The --site-dir option is there for when you have a machine-wide site_scons folder.
经过一番挖掘后,在 SCons 2.1.0.r5357 上,如果站点初始化文件名为:
$HOME/.scons/site_scons/site_init.py
,这将起作用,这当然不是从文档中显而易见。如果这仍然是一个问题,例如使用替代的计算机范围站点,您可以在
_load_site_scons_dir
函数的SCons/Scripts/Main.py
中添加一些调试输出。After a fair bit of digging, on SCons 2.1.0.r5357, this will work if the site initialisation file is named:
$HOME/.scons/site_scons/site_init.py
,This certainly wasn't obvious from the documentation. If this continues to be a problem, for example with an alternative machine wide site, you can add some debug output in
SCons/Scripts/Main.py
in the_load_site_scons_dir
function.