2

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?

Handle
  • 21
  • 1
  • Have you seen the [platform specific dependencies](http://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-platform-specific-dependencies) settings that you can use in setuptools? – idjaw Jun 12 '17 at 00:38
  • Oh snap. I was sitting on that page and I searched for "setup.cfg" on it instead of "platform". I will try this and report back. But I do want to mention that I have had problems with the combination of `bdist_rpm` and specifying dependencies in the `setup.py` file. The package sometimes does not register the dependencies. That's why I am using the `setup.cfg` file in the first place. – Handle Jun 12 '17 at 00:43

0 Answers0