gnu: Add python-django.

* gnu/packages/django.scm: New file.
* gnu/packages/patches/python-django-fix-testcase.patch: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add django.scm.
(dist_patch_DATA): Add python-django-fix-testcase.patch.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Hartmut Goebel 2016-08-22 13:31:36 +02:00 committed by Ludovic Courtès
parent 57dbf577f0
commit d18197af78
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 101 additions and 1 deletions

View file

@ -97,6 +97,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/dillo.scm \ %D%/packages/dillo.scm \
%D%/packages/disk.scm \ %D%/packages/disk.scm \
%D%/packages/display-managers.scm \ %D%/packages/display-managers.scm \
%D%/packages/django.scm \
%D%/packages/djvu.scm \ %D%/packages/djvu.scm \
%D%/packages/dns.scm \ %D%/packages/dns.scm \
%D%/packages/docbook.scm \ %D%/packages/docbook.scm \
@ -481,8 +482,8 @@ dist_patch_DATA = \
%D%/packages/patches/dbus-helper-search-path.patch \ %D%/packages/patches/dbus-helper-search-path.patch \
%D%/packages/patches/devil-CVE-2009-3994.patch \ %D%/packages/patches/devil-CVE-2009-3994.patch \
%D%/packages/patches/devil-fix-libpng.patch \ %D%/packages/patches/devil-fix-libpng.patch \
%D%/packages/patches/diffutils-gets-undeclared.patch \
%D%/packages/patches/dfu-programmer-fix-libusb.patch \ %D%/packages/patches/dfu-programmer-fix-libusb.patch \
%D%/packages/patches/diffutils-gets-undeclared.patch \
%D%/packages/patches/doc++-include-directives.patch \ %D%/packages/patches/doc++-include-directives.patch \
%D%/packages/patches/doc++-segfault-fix.patch \ %D%/packages/patches/doc++-segfault-fix.patch \
%D%/packages/patches/doxygen-test.patch \ %D%/packages/patches/doxygen-test.patch \
@ -764,6 +765,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-3-search-paths.patch \ %D%/packages/patches/python-3-search-paths.patch \
%D%/packages/patches/python-dendropy-exclude-failing-tests.patch \ %D%/packages/patches/python-dendropy-exclude-failing-tests.patch \
%D%/packages/patches/python-disable-ssl-test.patch \ %D%/packages/patches/python-disable-ssl-test.patch \
%D%/packages/patches/python-django-fix-testcase.patch \
%D%/packages/patches/python-fix-tests.patch \ %D%/packages/patches/python-fix-tests.patch \
%D%/packages/patches/python-ipython-inputhook-ctype.patch \ %D%/packages/patches/python-ipython-inputhook-ctype.patch \
%D%/packages/patches/python-rarfile-fix-tests.patch \ %D%/packages/patches/python-rarfile-fix-tests.patch \

98
gnu/packages/django.scm Normal file
View file

@ -0,0 +1,98 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; 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 <http://www.gnu.org/licenses/>.
(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)
#: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"))
(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)
;; The test-suite tests timezone-dependent functions, thus tzdata
;; needs to be available.
(setenv "TZDIR"
(string-append (assoc-ref inputs "tzdata")
"/share/zoneinfo"))
#t))
(replace 'check
(lambda _
(setenv "PYTHONPATH"
(string-append ".:" (getenv "PYTHONPATH")))
(zero? (system* "python" "tests/runtests.py")))))))
;; TODO: Install extras/django_bash_completion.
(native-inputs
;; Django uses 'pkg_resources' (part of setuptools) to locate templates
;; at run-time.
`(("python-setuptools" ,python-setuptools)
("tzdata", tzdata)))
(propagated-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!
;; 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. It provides many tools for building
any Web site. Django focuses on automating as much as possible and adhering
to the @dfn{don't repeat yourself} (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)
(propagated-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-inputs base))))))