为什么默认情况下 scons 不会在 ~/.scons/site_scons 中查找?

发布于 2024-12-27 23:23:30 字数 697 浏览 0 评论 0原文

我这里有一个谜:我正在使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

命比纸薄 2025-01-03 23:23:30

您需要更新到更高版本才能让 ~/.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

我最亲爱的 2025-01-03 23:23:30

据我所知, 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.

弃爱 2025-01-03 23:23:30

经过一番挖掘后,在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文