Creating deb or rpm with setuptools – data_files

1.5k views Asked by At

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.

1

There are 1 answers

1
tynn On BEST ANSWER

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.