summaryrefslogtreecommitdiff
path: root/gnu/packages/django.scm
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2016-08-22 13:31:36 +0200
committerLudovic Courtès <ludo@gnu.org>2016-09-12 15:27:46 +0200
commitd18197af7844151e38322605b11e0c75b18b55bf (patch)
tree9edca7ea6ff9e8cb26811ba46ec05b78d1389f20 /gnu/packages/django.scm
parent57dbf577f07085f7da23be71e2e53f258afd8bd5 (diff)
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>
Diffstat (limited to 'gnu/packages/django.scm')
-rw-r--r--gnu/packages/django.scm98
1 files changed, 98 insertions, 0 deletions
diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
new file mode 100644
index 0000000000..6acaae2485
--- /dev/null
+++ b/gnu/packages/django.scm
@@ -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))))))