conda build is omitting data file sub-directories, even though setup is including them

醉酒当歌 提交于 2019-12-23 02:32:09

问题


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

In MANIFEST.in:

recursive-include pybert/doc/_build/html *

In setup.py:

setup(
  name='PyBERT',
  version=pybert.__version__,
  packages=['pybert',],
  package_data={'pybert': ['doc/_build/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

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

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.


回答1:


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

So you should write

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/*',
]},



回答2:


Although this is about setuptools, not conda -- reason why I came here (i.e, question title)...

Actually, you can define sub-directories copy with */* syntax. In your case, the following should work:

setup(
  ...
  package_data={'pybert': ['doc/_build/html/*/*',]},
  ...


来源:https://stackoverflow.com/questions/47935680/conda-build-is-omitting-data-file-sub-directories-even-though-setup-is-includin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!