I'm packaging some Python packages currently without RPMs, and some of those depend on others that I'm packaging.

While packaging I noticed a format where people do: Require: python(pkg-name), but I'm trying to understand whether there's any particular syntax to using this? Because when it's used it doesn't seem to care about versions of the required package.


Requires: Python(gocd-cli) >= 0.9

Shows up in the requires list after I build my RPM:

$ rpm -qp --requires dist/gocd-cli.encryption.blowfish-1.0-1.noarch.rpm
Python(gocd-cli) >= 0.9
python(abi) = 2.6
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1

This package installs perfectly fine, despite the gocd-cli package version >= 0.9 hasn't been built and made available yet.

In summary what I'm trying to understand is:

  1. How is Requires: Python() supposed to be used?
  2. What is the Python() portion called? I've also seen it for Ruby, Perl and others…

While Ruby and Perl modules use those virtual provides, AFAIK python do not use them.

It is nothing than virtual provides (see chapter Creating Virtual CAPABILITIES). It is useful if you know which module you want to use but you do not know which package contains it. While in most cases it is very simple and perl-foo provides perl(foo), there are cases which are not so simple. E.g. perl(APR) is provided by mod_perl.

Virtual provides for Perl are quite old and are handled directly by rpm and rpmbuild. In past in Ruby you had to add them manually but now it is handled by rpm too. For python there was no one who would drive this change and it generaly does not use those virtual provides. So you must require exact package name.


If you are packaging python library there is no harm in putting in spec:

Provides: python(foo) = %{version}-%{release}

However you should not expect that other python modules have this provides and you need to require them using normal package name.

And one final note - Requires/Provides are case sensitive so Python(foo) != python(foo).

  • Ooh. If I understand it correctly: python(foo) isn't actually special syntax, the parens has no meanings, it's just a unique name that groups together nicely? :) And thanks for pointing out it's virtual capabilities! – gaqzi Oct 26 '15 at 18:56
  • Yes, you understand it correctly. – msuchy Oct 27 '15 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.