From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hartmut Goebel Subject: [PATCH 1/2] gnu: add python-django. Date: Mon, 22 Aug 2016 13:31:36 +0200 Message-ID: <1471865497-7324-2-git-send-email-h.goebel@crazy-compilers.com> References: <1471865497-7324-1-git-send-email-h.goebel@crazy-compilers.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbnSL-0006tX-Jp for guix-devel@gnu.org; Mon, 22 Aug 2016 07:31:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbnSE-0006ik-2o for guix-devel@gnu.org; Mon, 22 Aug 2016 07:31:52 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:40638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbnSD-0006iY-Of for guix-devel@gnu.org; Mon, 22 Aug 2016 07:31:45 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3sHrxn6mNtz3hjR6 for ; Mon, 22 Aug 2016 13:31:41 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3sHrxn6hGkzvkG3 for ; Mon, 22 Aug 2016 13:31:41 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id Avsy5fSPUWOA for ; Mon, 22 Aug 2016 13:31:40 +0200 (CEST) Received: from hermia.goebel-consult.de (ppp-188-174-142-77.dynamic.mnet-online.de [188.174.142.77]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS for ; Mon, 22 Aug 2016 13:31:40 +0200 (CEST) Received: from lenashee.goebel-consult.de (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id 21E5C60DFB for ; Mon, 22 Aug 2016 13:31:38 +0200 (CEST) In-Reply-To: <1471865497-7324-1-git-send-email-h.goebel@crazy-compilers.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * gnu/packages/django.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/patches/django-fix-testcase.patch: New file. --- gnu/local.mk | 1 + gnu/packages/django.scm | 110 +++++++++++++++++++++ .../patches/python-django-fix-testcase.patch | 42 ++++++++ 3 files changed, 153 insertions(+) create mode 100644 gnu/packages/django.scm create mode 100644 gnu/packages/patches/python-django-fix-testcase.patch diff --git a/gnu/local.mk b/gnu/local.mk index b8c5378..df8d235 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -95,6 +95,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/dictionaries.scm \ %D%/packages/dillo.scm \ %D%/packages/disk.scm \ + %D%/packages/django.scm \ %D%/packages/djvu.scm \ %D%/packages/dns.scm \ %D%/packages/docbook.scm \ diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm new file mode 100644 index 0000000..ec3f25f --- /dev/null +++ b/gnu/packages/django.scm @@ -0,0 +1,110 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2016 Hartmut Goebel +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages django) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system python) + #:use-module (gnu packages) ; for search-patches + #:use-module (gnu packages base) + #:use-module (gnu packages python)) + +(define-public python-django + (package + (name "python-django") + (version "1.10") + (source (origin + (method url-fetch) + (uri (pypi-uri "Django" version)) + (sha256 + (base32 + "01bh5yra6zyxcpqacahbwfbn0y4ivw07j2jsw3crvmjzivb6if26")) + ; fix test-case failures due to translation updates + ; - was fixed shortly after release + (patches (search-patches "python-django-fix-testcase.patch")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'check 'set-tzdir + (lambda* (#:key inputs #:allow-other-keys) + (setenv "TZDIR" + (string-append (assoc-ref inputs "tzdata") + "/share/zoneinfo")) + #t)) + (replace + 'check + (lambda* _ + (let* ((old-path (getenv "PYTHONPATH"))) + (setenv "PYTHONPATH" + (string-append "." (if old-path + (string-append ":" old-path)))) + (zero? (system* "python" "tests/runtests.py")))))))) + ;; todo: install extras/django_bash_completion + (inputs + ; Django uses pkg_resources (which is part of setuptools) to + ; locate templates at run-time. + `(("python-setuptools" ,python-setuptools))) + (native-inputs + `(;; bcrypt and argon2-cffi are extra requirements not yet in guix + ;;("python-argon2-cffi" ,python-argon2-cffi) ; >= 16.1.0 + ;;("python-bcrypt" ,python-bcrypt) ; not py-bcrypt! + ; The test-suite tests some timezone dependant functions, + ; thus tzdata needs to be installed. + ("tzdata", tzdata) + ; these are taken from tests/requirements/py3.txt + ("python-docutils" ,python-docutils) + ; optional for tests: ("python-geoip2" ,python-geoip2) + ("python-jinja2" ,python-jinja2) ; >= 2.7 + ; optional for tests: ("python-memcached" ,python-memcached) + ("python-numpy" ,python-numpy) + ("python-pillow" ,python-pillow) + ("python-pyyaml" ,python-pyyaml) + ("python-pytz" ,python-pytz) + ; optional for tests: ("python-selenium" ,python-selenium) + ("python-sqlparse" ,python-sqlparse) + ("python-tblib" ,python-tblib))) + (home-page "http://www.djangoproject.com/") + (synopsis "High-level Python Web framework") + (description + "Django is a high-level Python Web framework that encourages rapid +development and clean, pragmatic design. + +Developed and used over the past two years by a fast-moving online-news +operation, Django was designed from scratch to handle two challenges: the +intensive deadlines of a newsroom and the stringent requirements of +experienced Web developers. It has convenient niceties for developing +content-management systems, but it's an excellent tool for building any Web +site. + +Django focuses on automating as much as possible and adhering to the +DRY principle.") + (license license:bsd-3) + (properties `((python2-variant . ,(delay python2-django)))))) + +(define-public python2-django + (let ((base (package-with-python2 (strip-python2-variant python-django)))) + (package + (inherit base) + (native-inputs + `(; required for Python 2: enum34 and mock + ("python2-enum34" ,python2-enum34) + ("python2-mock" ,python2-mock) + ; when adding memcached mind: for Python 2 memcached <= 1.53 is required + ,@(package-native-inputs base)))))) diff --git a/gnu/packages/patches/python-django-fix-testcase.patch b/gnu/packages/patches/python-django-fix-testcase.patch new file mode 100644 index 0000000..4c1f980 --- /dev/null +++ b/gnu/packages/patches/python-django-fix-testcase.patch @@ -0,0 +1,42 @@ +From 24123c31362b5f3783d84d133c160e9fe16805fe Mon Sep 17 00:00:00 2001 +From: Tim Graham +Date: Mon, 1 Aug 2016 15:40:46 -0400 +Subject: [PATCH] Fixed admin_utils test failures due to translation updates. + +https://github.com/django/django/commit/24123c31362b5f3783d84d133c160e9fe16805fe + +--- + tests/admin_utils/test_logentry.py | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/tests/admin_utils/test_logentry.py b/tests/admin_utils/test_logentry.py +index 7798373..8259bf0 100644 +--- a/tests/admin_utils/test_logentry.py ++++ b/tests/admin_utils/test_logentry.py +@@ -59,7 +59,7 @@ class LogEntryTests(TestCase): + logentry = LogEntry.objects.filter(content_type__model__iexact='article').latest('id') + self.assertEqual(logentry.get_change_message(), 'Changed title and hist.') + with translation.override('fr'): +- self.assertEqual(logentry.get_change_message(), 'Modification de title et hist.') ++ self.assertEqual(logentry.get_change_message(), 'Title et hist modifié(s).') + + add_url = reverse('admin:admin_utils_article_add') + post_data['title'] = 'New' +@@ -117,11 +117,12 @@ class LogEntryTests(TestCase): + 'Changed domain. Added article "Article object". ' + 'Changed title for article "Article object". Deleted article "Article object".' + ) ++ + with translation.override('fr'): + self.assertEqual( + logentry.get_change_message(), +- 'Modification de domain. Article « Article object » ajouté. ' +- 'Modification de title pour l\'objet article « Article object ». Article « Article object » supprimé.' ++ "Domain modifié(s). Article « Article object » ajouté. " ++ "Title modifié(s) pour l'objet article « Article object ». Article « Article object » supprimé." + ) + + def test_logentry_get_edited_object(self): +-- +2.7.4 + -- 2.7.4