使用不同的 conda-build 根目录

using a different conda-build root directory

我正在创建我自己的 conda 配方,我用 git 结帐。存储库很少。我不想在 ~/conda-bld 中结帐,而是希望在 /ssd 中结帐,这样会更快。我该如何指定它? 另外,如何在克隆时指定 git 深度?

I would like it to checkout in /ssd which is going to be faster. How can I specify it?

conda-build 通过以下方式为其所有工作选择一个根目录:

  1. 如果在您的环境中定义了 CONDA_BLD_PATH,请使用它
  2. 否则,如果存在名为~/.condarc 的文件,请检查是否定义了conda-build/root-dir。例如:
   # .condarc
   conda-build:
     root-dir: /ssd/conda-bld
  1. 否则,尝试$(conda info --root)/conda-bld
  2. 如果该位置不可写,请使用 ~/conda-bld

(如果您有兴趣,请参阅 source code 了解这些步骤。)

Also, how can I specify git depth when doing a clone?

您可以在 meta.yamlsource 部分使用 git_depth:

# meta.yaml
package:
  name: foo
  version: '1.0'

source:
  git_url: https://github.com/foo/bar
  git_depth: 1

注意:我不推荐使用git_depth。如果您还指定 git_tag,则效果不佳——如果标签在 HEAD 的 N 次提交(对于 git_depth: N)中不可见,那么您的签出将失败。