Re: python-django update to Django-1.6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
diff --git a/python-django14.spec b/python-django14.spec
index 33f0f7c..bd750b7 100644
--- a/python-django14.spec
+++ b/python-django14.spec
@@ -7,7 +7,7 @@
 
 Name:           python-django14
 Version:        1.4.8
-Release:        1%{?dist}
+Release:        1%{?dist}.1
 Summary:        A high-level Python Web framework
 
 Group:          Development/Languages
@@ -24,6 +24,9 @@ Patch2:         Django-1.4-no-egg-test.patch
 # patch tests to skip tests requiring internet connection
 Patch3:         Django-1.4-no-internet-connection-tests.patch
 
+# Use setuptools so that we can parallel install
+Patch100: django1.4-parallel-version.patch
+
 BuildArch:      noarch
 # Note: No longer required in development version > 0.95
 # BuildRequires:  python-setuptools
@@ -42,7 +45,6 @@ Provides:       %{pkgname} = %{version}-%{release}
 Provides:       python-django = %{version}-%{release}
 Provides:       Django = %{version}-%{release}
 Obsoletes:      python-django < 1.4.5-3
-Conflicts:      python-django >= 1.5
 
 %description
 Django is a high-level Python Web framework that encourages rapid
@@ -78,6 +80,8 @@ find . -name "*.egg" -exec rm -f '{}' \;
 #%patch3 -p1 -b .no-internet-connection-tests
 %endif
 
+%patch100 -p1
+
 # empty files
 for f in \
     django/contrib/humanize/models.py \
@@ -98,12 +102,12 @@ cp -p %{SOURCE1} __init__.py
 
 
 %build
-%{__python} setup.py build
-
+CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py bdist_egg
 
 %install
 rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT%{python2_sitelib}
+easy_install -m --prefix $RPM_BUILD_ROOT%{_usr} -Z dist/*.egg
 
 
 %find_lang django
@@ -132,10 +136,12 @@ find $RPM_BUILD_ROOT -name "*.po" | xargs rm -f
 
 # Fix permissions
 chmod +x \
-  $RPM_BUILD_ROOT%{python_sitelib}/django/contrib/admin/static/admin/js/compress.py \
-  $RPM_BUILD_ROOT%{python_sitelib}/django/bin/profiling/gather_profile_stats.py
-
+  $RPM_BUILD_ROOT%{python_sitelib}/*.egg/django/contrib/admin/static/admin/js/compress.py \
+  $RPM_BUILD_ROOT%{python_sitelib}/*.egg/django/bin/profiling/gather_profile_stats.py
 
+# Renames to not conflict with the main python-django
+mv $RPM_BUILD_ROOT/%{_bindir}/django-admin $RPM_BUILD_ROOT/%{_bindir}/django1.4-admin
+mv $RPM_BUILD_ROOT%{_mandir}/man1/django-admin.1 $RPM_BUILD_ROOT%{_mandir}/man1/django1.4-admin.1
 
 %check
 export PYTHONPATH=$(pwd)
@@ -146,154 +152,12 @@ cd tests
 
 %files -f django.lang 
 %doc AUTHORS LICENSE README django/contrib/admin/static/admin/js/LICENSE-JQUERY.txt
-%{_bindir}/django-admin
+%{_bindir}/django1.4-admin
 %{_mandir}/man1/*
-%attr(0755,root,root) %{python_sitelib}/django/bin/*-messages.py*
-%attr(0755,root,root) %{python_sitelib}/django/bin/daily_cleanup.py*
-%attr(0755,root,root) %{python_sitelib}/django/bin/django-admin.py*
 %dir %{_sysconfdir}/bash_completion.d/
 %config(noreplace) %{_sysconfdir}/bash_completion.d/django_bash_completion
-%{python_sitelib}/django/bin/profiling/
-%{python_sitelib}/django/bin/__init__.py*
-# Include everything but the locale data ...
-%dir %{python_sitelib}/django
-%dir %{python_sitelib}/django/bin
-%{python_sitelib}/django/db/
-%{python_sitelib}/django/*.py*
-%{python_sitelib}/django/shortcuts/
-%{python_sitelib}/django/utils/
-%{python_sitelib}/django/dispatch/
-%{python_sitelib}/django/template/
-%{python_sitelib}/django/views/
-%dir %{python_sitelib}/django/conf/
-%dir %{python_sitelib}/django/conf/locale/
-%dir %{python_sitelib}/django/conf/locale/??/
-%dir %{python_sitelib}/django/conf/locale/??_*/
-%dir %{python_sitelib}/django/conf/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/
-%{python_sitelib}/django/contrib/*.py*
-%dir %{python_sitelib}/django/contrib/admin/
-%dir %{python_sitelib}/django/contrib/admin/locale
-%dir %{python_sitelib}/django/contrib/admin/locale/??/
-%dir %{python_sitelib}/django/contrib/admin/locale/??_*/
-%dir %{python_sitelib}/django/contrib/admin/locale/*/LC_MESSAGES
-%{python_sitelib}/django/contrib/admin/static/
-%dir %{python_sitelib}/django/contrib/admindocs/
-%dir %{python_sitelib}/django/contrib/admindocs/locale/
-%dir %{python_sitelib}/django/contrib/admindocs/locale/??/
-%dir %{python_sitelib}/django/contrib/admindocs/locale/??_*/
-%dir %{python_sitelib}/django/contrib/admindocs/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/auth/
-%dir %{python_sitelib}/django/contrib/auth/locale/
-%dir %{python_sitelib}/django/contrib/auth/locale/??/
-%dir %{python_sitelib}/django/contrib/auth/locale/??_*/
-%dir %{python_sitelib}/django/contrib/auth/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/comments/
-%dir %{python_sitelib}/django/contrib/comments/locale/
-%dir %{python_sitelib}/django/contrib/comments/locale/??/
-%dir %{python_sitelib}/django/contrib/comments/locale/??_*/
-%dir %{python_sitelib}/django/contrib/comments/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/contenttypes/
-%dir %{python_sitelib}/django/contrib/contenttypes/locale
-%dir %{python_sitelib}/django/contrib/contenttypes/locale/??/
-%dir %{python_sitelib}/django/contrib/contenttypes/locale/??_*/
-%dir %{python_sitelib}/django/contrib/contenttypes/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/databrowse/
-%dir %{python_sitelib}/django/contrib/flatpages/
-%dir %{python_sitelib}/django/contrib/flatpages/locale/
-%dir %{python_sitelib}/django/contrib/flatpages/locale/??/
-%dir %{python_sitelib}/django/contrib/flatpages/locale/??_*/
-%dir %{python_sitelib}/django/contrib/flatpages/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/formtools/
-%dir %{python_sitelib}/django/contrib/formtools/locale/
-%dir %{python_sitelib}/django/contrib/formtools/locale/??/
-%dir %{python_sitelib}/django/contrib/formtools/locale/??_*/
-%dir %{python_sitelib}/django/contrib/formtools/locale/*/LC_MESSAGES
-%{python_sitelib}/django/contrib/formtools/wizard/
-%dir %{python_sitelib}/django/contrib/gis/
-%dir %{python_sitelib}/django/contrib/gis/locale/
-%dir %{python_sitelib}/django/contrib/gis/locale/??/
-%dir %{python_sitelib}/django/contrib/gis/locale/??_*/
-%dir %{python_sitelib}/django/contrib/gis/locale/*/LC_MESSAGES
-%{python_sitelib}/django/contrib/gis/geoip/
-%dir %{python_sitelib}/django/contrib/humanize/
-%dir %{python_sitelib}/django/contrib/humanize/locale/
-%dir %{python_sitelib}/django/contrib/humanize/locale/??/
-%dir %{python_sitelib}/django/contrib/humanize/locale/??_*/
-%dir %{python_sitelib}/django/contrib/humanize/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/localflavor/
-%dir %{python_sitelib}/django/contrib/localflavor/??/
-%dir %{python_sitelib}/django/contrib/localflavor/??_??/
-%{python_sitelib}/django/contrib/localflavor/??/*
-%{python_sitelib}/django/contrib/localflavor/??_??/*
-%dir %{python_sitelib}/django/contrib/localflavor/locale
-%dir %{python_sitelib}/django/contrib/localflavor/locale/??/
-%dir %{python_sitelib}/django/contrib/localflavor/locale/??_*/
-%dir %{python_sitelib}/django/contrib/localflavor/locale/*/LC_MESSAGES/
-%dir %{python_sitelib}/django/contrib/markup/
-%dir %{python_sitelib}/django/contrib/messages/
-%dir %{python_sitelib}/django/contrib/messages/locale
-%dir %{python_sitelib}/django/contrib/messages/locale/??/
-%dir %{python_sitelib}/django/contrib/messages/locale/??_*/
-%dir %{python_sitelib}/django/contrib/messages/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/redirects
-%dir %{python_sitelib}/django/contrib/redirects/locale
-%dir %{python_sitelib}/django/contrib/redirects/locale/??/
-%dir %{python_sitelib}/django/contrib/redirects/locale/??_*/
-%dir %{python_sitelib}/django/contrib/redirects/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/sessions/
-%dir %{python_sitelib}/django/contrib/sessions/locale/
-%dir %{python_sitelib}/django/contrib/sessions/locale/??/
-%dir %{python_sitelib}/django/contrib/sessions/locale/??_*/
-%dir %{python_sitelib}/django/contrib/sessions/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/sitemaps/
-%dir %{python_sitelib}/django/contrib/sites/
-%dir %{python_sitelib}/django/contrib/sites/locale/
-%dir %{python_sitelib}/django/contrib/sites/locale/??/
-%dir %{python_sitelib}/django/contrib/sites/locale/??_*/
-%dir %{python_sitelib}/django/contrib/sites/locale/*/LC_MESSAGES
-%dir %{python_sitelib}/django/contrib/staticfiles/
-%dir %{python_sitelib}/django/contrib/syndication/
-%dir %{python_sitelib}/django/contrib/webdesign/
-%{python_sitelib}/django/contrib/*/*.py*
-%{python_sitelib}/django/contrib/*/fixtures/
-%{python_sitelib}/django/contrib/*/handlers/
-%{python_sitelib}/django/contrib/*/management/
-%{python_sitelib}/django/contrib/*/plugins/
-%{python_sitelib}/django/contrib/*/templates/
-%{python_sitelib}/django/contrib/*/templatetags/
-%{python_sitelib}/django/contrib/*/tests/
-%{python_sitelib}/django/contrib/*/views/
-%{python_sitelib}/django/contrib/gis/admin/
-%{python_sitelib}/django/contrib/gis/db/
-%{python_sitelib}/django/contrib/gis/forms/
-%{python_sitelib}/django/contrib/gis/gdal/
-%{python_sitelib}/django/contrib/gis/geometry/
-%{python_sitelib}/django/contrib/gis/geos/
-%{python_sitelib}/django/contrib/gis/maps/
-%{python_sitelib}/django/contrib/gis/sitemaps/
-%{python_sitelib}/django/contrib/gis/utils/
-%{python_sitelib}/django/contrib/localflavor/generic/
-%{python_sitelib}/django/contrib/localflavor/in_/
-%{python_sitelib}/django/contrib/localflavor/is_/
-%{python_sitelib}/django/contrib/messages/storage/
-%{python_sitelib}/django/contrib/sessions/backends/
-%{python_sitelib}/django/forms/
-%{python_sitelib}/django/templatetags/ 
-%{python_sitelib}/django/core/
-%{python_sitelib}/django/http/
-%{python_sitelib}/django/middleware/
-%{python_sitelib}/django/test/
-%{python_sitelib}/django/conf/*.py*
-%{python_sitelib}/django/conf/project_template/
-%{python_sitelib}/django/conf/app_template/
-%{python_sitelib}/django/conf/urls/
-%{python_sitelib}/django/conf/locale/*/*.py*
-%{python_sitelib}/django/conf/locale/*.py*
-
-%{python_sitelib}/*.egg-info
-
- 
+
+%{python_sitelib}/*.egg
 
 %files doc
 %defattr(-,root,root,-)
@@ -301,6 +165,9 @@ cd tests
 
 
 %changelog
+* Fri Feb 21 2014 Toshio Kuratomi <toshio@xxxxxxxxxxxxxxxxx> - 1.4.8-1.1
+- Initial test of parallel installable version
+
 * Mon Sep 16 2013 Matthias Runge <mrunge@xxxxxxxxxx> - 1.4.8-1
 - update to 1.4.8, fix CVE-2013-1443 (DoS via large passwords)
 - fixes rhbz#1008282
Index: Django-1.4.8/setup.py
===================================================================
--- Django-1.4.8.orig/setup.py
+++ Django-1.4.8/setup.py
@@ -1,4 +1,4 @@
-from distutils.core import setup
+from setuptools import setup
 from distutils.command.install_data import install_data
 from distutils.command.install import INSTALL_SCHEMES
 import os

Attachment: pgpVxGIAmtw0X.pgp
Description: PGP signature

-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux