使用 setuptools 创建 deb 或 rpm – data_files
Creating deb or rpm with setuptools – data_files
我有一个 Python 3 项目。
MKC
├── latex
│ ├── macros.tex
│ └── main.tex
├── mkc
│ ├── cache.py
│ ├── __init__.py
│ └── __main__.py
├── README.md
├── setup.py
└── stdeb.cfg
安装时,我想将我的乳胶文件移动到已知目录,比如 /usr/share/mkc/latex
,所以我告诉 setuptools
包含数据文件
data_files=[("/usr/share/mkc/latex",
["latex/macros.tex", "latex/main.tex"])],
现在当我运行
./setup.py bdist --formats=rpm
或
./setup.py --command-packages=stdeb.command bdist_deb
我收到以下错误:
error: can't copy 'latex/macros.tex': doesn't exist or not a regular file
运行 只是 ./setup.py bdist
工作正常,所以问题一定是在包创建中。
创建 deb 文件时(我猜 rpm 文件也是如此),./setup.py --command-packages=stdeb.command bdist_deb
首先创建源代码分发并使用该存档进行进一步处理。但是您的 LaTeX 文件不包含在那里,所以找不到它们。
您需要将它们添加到源码包中。这可以通过添加 MANIFEST.in 内容来实现:
recursive-include latex *.tex
distutils from version 3.1 on would automatically include the data_files
in a source distribution, while setuptools 显然工作方式非常不同。
我有一个 Python 3 项目。
MKC
├── latex
│ ├── macros.tex
│ └── main.tex
├── mkc
│ ├── cache.py
│ ├── __init__.py
│ └── __main__.py
├── README.md
├── setup.py
└── stdeb.cfg
安装时,我想将我的乳胶文件移动到已知目录,比如 /usr/share/mkc/latex
,所以我告诉 setuptools
包含数据文件
data_files=[("/usr/share/mkc/latex",
["latex/macros.tex", "latex/main.tex"])],
现在当我运行
./setup.py bdist --formats=rpm
或
./setup.py --command-packages=stdeb.command bdist_deb
我收到以下错误:
error: can't copy 'latex/macros.tex': doesn't exist or not a regular file
运行 只是 ./setup.py bdist
工作正常,所以问题一定是在包创建中。
创建 deb 文件时(我猜 rpm 文件也是如此),./setup.py --command-packages=stdeb.command bdist_deb
首先创建源代码分发并使用该存档进行进一步处理。但是您的 LaTeX 文件不包含在那里,所以找不到它们。
您需要将它们添加到源码包中。这可以通过添加 MANIFEST.in 内容来实现:
recursive-include latex *.tex
distutils from version 3.1 on would automatically include the data_files
in a source distribution, while setuptools 显然工作方式非常不同。