简体   繁体   中英

Creating deb or rpm with setuptools – data_files

I have a Python 3 project.

MKC
├── latex
│   ├── macros.tex
│   └── main.tex
├── mkc
│   ├── cache.py
│   ├── __init__.py
│   └── __main__.py
├── README.md
├── setup.py
└── stdeb.cfg

On install, I would like to move my latex files to known directory, say /usr/share/mkc/latex , so I've told setuptools to include data files

data_files=[("/usr/share/mkc/latex",
             ["latex/macros.tex", "latex/main.tex"])],

Now when I run

./setup.py bdist --formats=rpm

or

./setup.py --command-packages=stdeb.command bdist_deb

I get the following error:

error: can't copy 'latex/macros.tex': doesn't exist or not a regular file

Running just ./setup.py bdist works fine, so the problem must be in package creation.

When creating a deb file (I guess the same counts for a rpm file), ./setup.py --command-packages=stdeb.command bdist_deb first creates a source distribution and uses that archive for further processing. But your LaTeX files are not included there, so they're not found.

You need to add them to the source package. Such can be achieved by adding a MANIFEST.in with contents:

recursive-include latex *.tex

distutils from version 3.1 on would automatically include the data_files in a source distribution, while setuptools apparently works very differently.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM