即使安装程序包含子目录,conda构建也会忽略数据文件子目录 [英] conda build is omitting data file sub-directories, even though setup is including them

查看:99
本文介绍了即使安装程序包含子目录,conda构建也会忽略数据文件子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 MANIFEST.in 文件和 conda build 与包含文档的Python项目一起使用在 MANIFEST.in中> setup()的> package_data 选项:

I'm using conda build with a Python project that includes documentation, via a MANIFEST.in file and the package_data option to setup():

recursive-include pybert/doc/_build/html *

setup.py 中:

setup(
  name='PyBERT',
  version=pybert.__version__,
  packages=['pybert',],
  package_data={'pybert': ['doc/_build/html/*',]},

我发现设置包括我的 html 目录的子目录:

I'm finding that while setup includes the subdirectories of my html directory:

(pybert) Davids-Air-2:PyBERT dbanas$ tar xjf ~/anaconda/conda-bld/noarch/pybert-2.4.1-py_0.tar.bz2 -C ~/tmp/

(pybert) Davids-Air-2:PyBERT dbanas$ ls ~/tmp/site-packages/
PyBERT-2.4.1-py2.7.egg-info     pybert

(pybert) Davids-Air-2:PyBERT dbanas$ cat ~/tmp/site-packages/PyBERT-2.4.1-py2.7.egg-info/SOURCES.txt | grep 'html'
pybert/doc/_build/html/.nojekyll
pybert/doc/_build/html/genindex.html
pybert/doc/_build/html/index.html
pybert/doc/_build/html/intro.html
pybert/doc/_build/html/modules.html
pybert/doc/_build/html/objects.inv
pybert/doc/_build/html/py-modindex.html
pybert/doc/_build/html/search.html
pybert/doc/_build/html/searchindex.js
pybert/doc/_build/html/_modules/index.html
{8 more from _modules/ snipped.}
pybert/doc/_build/html/_sources/index.rst.txt
pybert/doc/_build/html/_sources/intro.rst.txt
pybert/doc/_build/html/_sources/modules.rst.txt
pybert/doc/_build/html/_static/ajax-loader.gif
{21 more from _static/ snipped.}
pybert/doc/_build/html/test_dir/dummy.html

conda构建实际安装的文件集缺少 html 的子目录(以及 .nojekyll 文件):

The set of files actually installed by conda build is missing the subdirectories of html (as well as the .nojekyll file):

(pybert) Davids-Air-2:PyBERT dbanas$ ls -A ~/tmp/site-packages/pybert/doc/_build/html/
genindex.html           intro.html              objects.inv             search.html
index.html              modules.html            py-modindex.html        searchindex.js

请注意, test_dir / 子目录由请确保不只是其他子目录名称的 _前缀造成了问题。显然不是,因为 test_dir / 也丢失了。

Note that the test_dir/ subdirectory was added by hand, to ensure that it wasn't just the '_' prefix of the other subdirectory names that was fouling things up. Apparently, it wasn't, since test_dir/ is also missing.

推荐答案

package_data 要求我们明确列出所有子目录,,。请参见 https://github.com/sqlobject/sql 20d035deaf0f0b6e5d3d5163a3f15281b5dc6c95#diff-2eeaed663bd0d25b7e608891384b7298R102

package_data requires us to list all subdirectories explicitly, alas. See an example at https://github.com/sqlobject/sqlobject/commit/20d035deaf0f0b6e5d3d5163a3f15281b5dc6c95#diff-2eeaed663bd0d25b7e608891384b7298R102

所以您应该写

package_data={'pybert': [
    'doc/_build/html/.nojekyll',
    'doc/_build/html/*',
    'doc/_build/html/_modules/*',
    'doc/_build/html/_sources/*',
    'doc/_build/html/_static/*',
    'doc/_build/html/test_dir/*',
]},

这篇关于即使安装程序包含子目录,conda构建也会忽略数据文件子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆