At the top of our Python packaging page
), there's a note which
reads 'In theory /usr/lib/rpm/pythondeps.sh would also automatically
generate "Provides" lines'
This is also true for python modules : distutils and setuptools have a way
to specify provides and requires, but those are not reflected in the RPM.
It means that they must be entered and maintained by hand in the spec file.
In my opinion, this is not optimal.
The perl modules have an interesting way of reflecting their dependencies in
the rpm: they add a dependency on "perl(Module::Name)". I believe the same
system can be applicable to python modules.
Currently, there are two main packaging systems in python : distutils and
setuptools. Distutils declares the dependencies in an egg-info file, which
is RFC-822-formatted. Setuptools turns this file into a PKG-INFO file in a
subdirectory, and adds a requires.txt files with additional dependencies, in
a different format.
The pythondeps.sh script should be able to extract requires from these
files. To match the dependencies, pythondeps.sh should create virtual
provides like "python(ModuleName) = version".
The good news is : I've written it already ;-)
It's based on the pythondeps.sh script from Git master (which changed a
little bit due to python3, see bug 532118). Also, the script does not try to
be too smart with versionned dependencies, because the format is a little
bit different in python and in rpm. For those complicated cases, handwritten
requirements can still be added to the spec file. The script only covers the
For reference, the dependency format in distutils is described here:
The dependency format in setuptools is described here:
A patch would not make much sense due to the size of the addition, so here's
the full script: http://aurelien.bompard.org/projects/divers/pythondeps.sh
I've tested it with quite a few packages, but to make sure I've written a
few unit tests (very simple, bash-based) :
I do believe it would be a valuable addition to RPM (of course, even if
accepted shortly, I don't expect it to land in F-13 since it requires
recompiling all the python packages).
Do you think it's a good idea ? What about the implementation ?
If it looks good to you I'll propose it to rpm.org
~~~~ Jabber : abompard(a)jabber.fr
"Everyone thinks of changing the world, but no one thinks of changing
himself." -- Tolstoï