I have an application that I am packaging as an RPM and installing on CentOS 7. When I install the RPM I want it to install some compiled binaries as well as some Python modules with their dependencies.
My Python modules require a newer version of Python than is provided by CentOS, so I will be installing the modules in a Python altinstall under /usr/local/lib/python2.7/site-packages
. This means I can't use CentOS-provided RPMs since they install under /usr/lib
. I can easily install the modules under /usr/local/lib
using pip
.
Is there a way to package my application such that:
- I can install my application from an RPM.
- My Python modules get installed under
/usr/local/lib
when the application is installed. - Any Python dependencies also get installed.
- I avoid maintaining RPM packages for the Python dependencies.
Is there a convention for this kind of thing? Or are there maybe some examples? I didn't see anything directly relevant in Fedora's Python Packaging documentation.
The options I have considered are:
Bundle my application, Python modules, and all Python dependencies into one RPM.
I don't like this option because I would not be able to update individual dependencies on the client system without upgrading my entire application to a new version.
Create individual RPMs for my application, my Python modules, and third-party dependencies.
I don't like this option because I would have to maintain RPMs for every single third-party module in my dependency tree.
Call
pip
from within my RPM.I don't like this option because RPM would not be able to track the changes that
pip
makes, and I would not be able to determine whether I can safely remove third-party Python modules when removing the RPM.