How to keep data_files between package updates?

╄→гoц情女王★ 提交于 2020-01-04 09:04:18

问题


I'm using the data_files argument of setuptools.setup() to install config files to /etc and the users home directory. However updating the package with pip install <package-name> uninstalls the old version and all config files before it installs the new version.

How do I keep the config files during updates if they have been changed?


回答1:


I very much doubt that eggs or wheels "installers" can do that. They are rather primitive distribution formats suitable for simple things (uninstall the previous version, install the new one overriding files) but that's all.

To do what you want you probably need a real installer (rpm or deb) — they can preserve changed config files. But they are complex, hard to create formats.

If you insist on using simple wheels I can recommend stop distributing config files at all. Instead distribute config files' templates and teach users to create config files from these templates. Then new versions will only override templates but not real config files.



来源:https://stackoverflow.com/questions/47241274/how-to-keep-data-files-between-package-updates

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