diff --git a/gnu/local.mk b/gnu/local.mk index 515ca352a8..c504b067fe 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -97,6 +97,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/dillo.scm \ %D%/packages/disk.scm \ %D%/packages/display-managers.scm \ + %D%/packages/django.scm \ %D%/packages/djvu.scm \ %D%/packages/dns.scm \ %D%/packages/docbook.scm \ @@ -481,8 +482,8 @@ dist_patch_DATA = \ %D%/packages/patches/dbus-helper-search-path.patch \ %D%/packages/patches/devil-CVE-2009-3994.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/diffutils-gets-undeclared.patch \ %D%/packages/patches/doc++-include-directives.patch \ %D%/packages/patches/doc++-segfault-fix.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-dendropy-exclude-failing-tests.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-ipython-inputhook-ctype.patch \ %D%/packages/patches/python-rarfile-fix-tests.patch \ 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 +;;; +;;; 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) + #: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))))))