From Fedora Project Wiki

Revision as of 21:03, 17 February 2009 by Toshio (talk | contribs) (PackagingDrafts/Python moved to Python virtual provides: Natural language title)

Virtual Provides

Dave Malcolm has proposed writing an rpm script to detect, at least, Python Eggs that are installed by a package. To go along with that, we should have virtual provides that map the package to egg name.

We could copy the ruby/rubygem syntax and have something like this:

 Provides: python(bar) = %{version}
 Provides: python(foo) = %{version}
 Provides: pythonegg(foo) = %{version}
 Requires: pythonegg(foo) >= 0.3
 Requires: python(bar)

I think that Dave Malcolm's approach should be expandable to:

  • Providing normal python modules: look for them on the filesystem in site-packages.
  • Providing Python Eggs: Examine the egg info.
  • Requiring Python Eggs: Examine the egg info.

Requiring of normal python modules would still have to be done by hand (there's some ways this might be done but they're more complex). This also doesn't attempt to manage submodules of a normal python module: ie:

 bzr:
   %{python_sitearch}/bzrlib
   # Automatically found:
   Provides: python(bzrlib)
 bzr-gtk:
   %{python_sitearch}/bzrlib/plugins/gtk
   # Would have to manually specify:
   Provides: python(bzrlib.plugins.gtk)

My suggestion for this draft would be to specify submodules manually. Especially because some submodules will be necessary to specify while others will not (We shouldn't need to specify any submodules of bzrlib that are provided by bzrlib, for instance.)

If we don't want to convert packages to using Requires: python(bar) instead of Requires: python-bar because of the manual nature of the Requires, the pythonegg portion of this draft still has benefits.