Skip to content

Instantly share code, notes, and snippets.

@primalmotion
Created January 4, 2012 17:28
Show Gist options
  • Save primalmotion/1561092 to your computer and use it in GitHub Desktop.
Save primalmotion/1561092 to your computer and use it in GitHub Desktop.
Hack for adding dependencies with setuptools when generating RPMS
## add this in the beginning of your setup.py script
## and change the RPM_REQUIRED_DEPS variable to reflect your dependencies
RPM_REQUIRED_DEPS = "archipel-core, python-imaging, libvirt-python"
## HACK FOR DEPS IN RPMS
from setuptools.command.bdist_rpm import bdist_rpm
def custom_make_spec_file(self):
spec = self._original_make_spec_file()
lineDescription = "%description"
spec.insert(spec.index(lineDescription) - 1, "requires: %s" % RPM_REQUIRED_DEPS)
return spec
bdist_rpm._original_make_spec_file = bdist_rpm._make_spec_file
bdist_rpm._make_spec_file = custom_make_spec_file
## END OF HACK
@mantydze
Copy link

Hi, this hack can be simplified by creating setup.cfg alongside setup.py

[bdist_rpm]
requires=archipel-core,python-imaging,libvirt-python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment