guix-devel/gnu/packages/django.scm

125 lines
5.1 KiB
Scheme
Raw Normal View History

;;; 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))))))
(define-public python-django-simple-math-captcha
(package
(name "python-django-simple-math-captcha")
(version "1.0.7")
(source (origin
(method url-fetch)
(uri (pypi-uri "django-simple-math-captcha" version))
(sha256
(base32
"0906hms6y6znjhpd0g4wmzv9vcla4brkdpsm4zha9zdj8g5vq2hd"))))
(build-system python-build-system)
(propagated-inputs
`(("python-django" ,python-django)))
(native-inputs
`(("python-setuptools" ,python-setuptools)))
(home-page "https://github.com/alsoicode/django-simple-math-captcha")
(synopsis "Easy-to-use math field/widget captcha for Django forms")
(description
"A multi-value-field that presents a human answerable question,
with no settings.py configuration necessary, but instead can be configured
with arguments to the field constructor.")
(license license:asl2.0)))
(define-public python2-django-simple-math-captcha
(package-with-python2 python-django-simple-math-captcha))