I would like to create an rpm package for python with Linux distribution specific requirements. Specifically, I would like to build an rpm which works across Amazon Linux, CentOS 7.x and RHEL 7.x (possibly 6.x for the last two). I am currently using setuptools to build a package.
The issue is that some of the package requirements do not have the same name across different distributions. Right now, I have a setup.cfg
file with a bdist_rpm
section as given below, where the first line is relevant for Amazon Linux while the second one is needed for RHEL 7.x.
[bdist_rpm]
requires = python27-boto, python27-boto3, python27-pycurl, python27-pytz, python27-PyYAML # Works on Amazon Linux
# requires = python2-boto, python2-boto3, python-pycurl, pytz, PyYAML, python-daemon # Works on RHEL 7.x
I understand that I could create a .spec file first (using the bdist_rpm --spec-only
option) and then use a dist tag as given here: https://fedoraproject.org/wiki/Packaging:DistTag. But is there a way in which I could do this directly using setuptools? Can I specify distribution specific requirements in the setup.cfg file Or MANIFEST.in file?