On Fri, Feb 21, 2014 at 02:41:31PM -0500, Stephen Gallagher wrote:
>
>
> I'm having a parallel conversation about this with Toshio on
> #fedora-devel right now. He believes it may be possible to get
> Django to be parallel-installable on the base system without SCLs
> and is running some tests. If he can make this work, that would
> make our lives a lot easier. More to come, stay tuned...
>
>
Ok, so it turns out that Python Eggs are a lot smarter than I gave
them credit for. If you turn your attention to
http://fedoraproject.org/wiki/Packaging:Python_Eggs, you will find
that it describes quite well how to modify a Python compat package
(such as python-django14) to be parallel-installable with the newer
package.
Toshio has been testing this implementation with ReviewBoard 1.7.21
(Django 1.4) and ReviewBoard 2.0beta2 (Django 1.5) this afternoon and
so far it appears to work properly, with both python-django14 and
python-django installed on the same system.
We need to do some more testing to be certain, but it seems this may
be the easy way forward. Hooray!
Okay, here's some diff's to the current python-django14 package that will
make it parallel installable. Once you have the parallel installable
package you may also have to modify a few things in the dependent packages
to make them choose the parallel installed version of django instead of the
default version. sgallagh and I worked on reviewboard today and found that
one script, rb-site worked out of the box (once we restored the requires.txt
to the reviewboard egg-info ;-). The reviewboard.wsgi file needed some
patching but we got that to work as well.
http://fedoraproject.org/wiki/Packaging:Python_Eggs#Multiple_Versions has
the information but feel free to ping me if you have questions. In
particular, wsgi scripts seem to need a slight variant of the
__requires__. setuptools is looking for __requires__ in the __main__ module
(the toplevel of the script that's executed). With wsgi, that's not the
.wsgi script, there's another level on top of it. So you have to do
something like this in the wsgi script:
import __main__
__main__.__requires__ = ['Django >= 1.4, < 1.5']
import pkg_resources
Usually you don't have to specify Django specifically in the __requires__
either. If you have a python application/module that specifies the version
of Django that you need, then you can use that instead. For instance,
Reviewboard specifies that it requires Django > 1.4.10, < 1.5 in the
install_requires section of its setup.py. That ends up in the
ReviewBoard-1.7.21-py2.7.egg-info/requires.txt file. So you can do this:
import __main__
__main__.__requires__ = ['ReviewBoard']
import pkg_resources
and pkg_resources will find the versioned Django dependency in the
Reviewboard egg-info and use that to find the correct Django version.
Feel free to ping me on IRC or email me if you need more information or
encounter one of setuptools'/pkg_resources' crazy corner cases.
-Toshio