mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
dev-python/django: Remove old
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
DIST Django-3.2.25.checksum.txt 2560 BLAKE2B e082c588f4e124c9d71c1914e475fd70ed9b68583d65ea59ba0822b96de36c2edc98b4d9192f3d7c75467306fe03404303f6c2a98a026bdb5308bbd1dee89f99 SHA512 49a1610dcd61cbd322f0a5d7fe3cf249c0c4288b194fc8c2bdf7ec6fb8f92b69ca68dcdb71b79998cd80b978b70f48069669d996b6503261ba726c77c8b87672
|
||||
DIST Django-3.2.25.tar.gz 9836336 BLAKE2B 586520e0689b2594dd8ce4abb173418aedfde80cc84012d2a4207cbfc67120cbf405a8dfc8d069bb946f027f0eef22b233bd3b3ce569b01ea8fdc7836a6e530f SHA512 ccba83abd1777123186d685e21b96f41abf216a692d18ffe764d2e519eb9d1f6011d08c86b3affdd891591ca4ed7fee27ffa4750d19b486ca775ee680fdb0cb1
|
||||
DIST Django-4.2.13.checksum.txt 2578 BLAKE2B c4dee2c255a77da0655f685852bfac937e6afbfa32c6f5048916675d806c1d9218ff40117c99d7e63ee06b05dd88af4db9460672c3628c948cb17e5ca2f56817 SHA512 0994eef854b991c2db290712aff892e900ef3bab84607e385b4f78e3213b816739e42d5010afaaf30f6c68d5bc52b509b7c6e797e8e87db499a49f75b4cfd232
|
||||
DIST Django-4.2.13.tar.gz 10430886 BLAKE2B 09e8743de500f11c32c540d23d9aae1377c83177089732c78c03501dc560fd7b4316d6032534c923c354539421e519ed8439fc09d61500cea479c9eaf115f160 SHA512 2d141e2d710dbd55999db9c7005ca4a8d291dad57f0ef246eb41d4ffed76e62035b36969c5f338c3158ccd2d1677eb23de0b8f783606b4c62a3ee45e8988b712
|
||||
DIST Django-4.2.14.checksum.txt 2579 BLAKE2B 9cf59d23c8fa0ad9b86f30a492d981a3084c31fd0c7e8ea212c62377385bcb45369ee3f29573c8e129f8d248ca4e94d4c1a4172048b9a9b2f66cc3291e972367 SHA512 c36efc19f8cc90db89dfe3ffaedff724f4b5a049f6def7acb194f8114a2ae519c5c07dea5452c09618629c9d585867de4b028bcef382f43d24f753f4a100c1c6
|
||||
DIST Django-4.2.14.tar.gz 10432993 BLAKE2B 0139669111f834bcb79fea5fa2bc43386d62a65790fda9d762f8ac4e2a32f2a3740629e31c863b2643fa13b893938c33b066c21f27857f391715b7cec88dfad7 SHA512 2663454c48f57a441d1620faad30ac25750d1e71bf34eddbdef3e6d8dd208913752ab657447ffea5e9d3a0676a4a4d501fa88a40a0ca0fd361df0782a6b3306b
|
||||
DIST Django-5.0.6.checksum.txt 2568 BLAKE2B c4c94e1a245248ed59707fb8aeb97a8379e679c50829d0470eefd2f870de32d5b57cb4841ac44809483993bc515514c3e2b0cdf0f1768681a4ba1930e2d278a3 SHA512 231954ae528beff69fbfa385aba192f19d56e862f1a2e5e40ccbba60ce31b59a075af31d75ab9e5767c9405a37f14fd3c5c41e74f60f6b7d6821391a43992301
|
||||
DIST Django-5.0.6.tar.gz 10639679 BLAKE2B 2198f273f28f89eb12db481e3531a963e2f5215677f0227d2ce8940cf1c2076acafe9bf1064595b481c6d65fadd7c6d6c7cda5fbbded81a87895e697338c78fd SHA512 6dab32357c423762a4fdd7372aec0ae4855861431fb9a90d4a818144e675cf891c0673a11351ddf8344f31624ce0ea8c9d9c6bc3c4514f38380aecb48a684894
|
||||
DIST Django-5.0.7.checksum.txt 2569 BLAKE2B 0d4cecf064da9313058606569fcb014c5f3d5ec3c60a5a056cd8242ed9a8349b6d273c38010ba3d41fac85e5551a21748a7739772ad310f8c64224243745eac5 SHA512 9ec2e5e3ac0cb99be9349373c2cf47c6055e0bb729e5bb7e476350cd39595c4c82e7eab9a7eb286a9199834bed65d7f3d31ba59509d6e2e827b0f9c743aa9fcd
|
||||
DIST Django-5.0.7.tar.gz 10642686 BLAKE2B 559c3e3dd3971081e8572a707f59054ec84d9922493caddec9e008c5e850e8beb7bfbca291e4e7157e94d4fcd655983e3444f1c8f078342c8b66b3e8ce122ab7 SHA512 29aa4cd7bfdc5c00479c9d60d988653bab76dcfd8cd553ab446f6c274f99677ccaef0571b0afdf1579215918f500d87a0b098a98452c7526e89b1ab64f00b037
|
||||
DIST django-4.2.8-pypy3.patch.xz 5900 BLAKE2B b7dc5c5fc162817a218ee6d025ed8a65559b80e4506e49ac393428c26e2621f9e7c5010b36f2412dea8194a9f1086ab21f97286eabd696c6a786285eb07393cf SHA512 f953b5adbd1364f1d84dde55087ccb493256b1327701275fd2fe99f3cd41751d18e002b6e21afc96892e1671428a6b8f3c2e4b88252c3c278f1a79e286bb73e3
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYTHON_COMPAT=( python3_{10..11} )
|
||||
PYTHON_REQ_USE='sqlite?,threads(+)'
|
||||
|
||||
inherit bash-completion-r1 distutils-r1 optfeature verify-sig
|
||||
|
||||
DESCRIPTION="High-level Python web framework"
|
||||
HOMEPAGE="
|
||||
https://www.djangoproject.com/
|
||||
https://github.com/django/django/
|
||||
https://pypi.org/project/Django/
|
||||
"
|
||||
SRC_URI="
|
||||
https://media.djangoproject.com/releases/$(ver_cut 1-2)/${P^}.tar.gz
|
||||
verify-sig? ( https://media.djangoproject.com/pgp/${P^}.checksum.txt )
|
||||
"
|
||||
S="${WORKDIR}/${P^}"
|
||||
|
||||
LICENSE="BSD"
|
||||
# admin fonts: Roboto (media-fonts/roboto)
|
||||
LICENSE+=" Apache-2.0"
|
||||
# admin icons, jquery, xregexp.js
|
||||
LICENSE+=" MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm arm64 ~ppc ~ppc64 ~riscv ~sparc x86 ~x64-macos"
|
||||
IUSE="doc sqlite test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="
|
||||
>=dev-python/asgiref-3.3.4[${PYTHON_USEDEP}]
|
||||
dev-python/pytz[${PYTHON_USEDEP}]
|
||||
>=dev-python/sqlparse-0.2.2[${PYTHON_USEDEP}]
|
||||
sys-libs/timezone-data
|
||||
"
|
||||
BDEPEND="
|
||||
test? (
|
||||
$(python_gen_impl_dep sqlite)
|
||||
${RDEPEND}
|
||||
dev-python/docutils[${PYTHON_USEDEP}]
|
||||
dev-python/jinja[${PYTHON_USEDEP}]
|
||||
dev-python/numpy[${PYTHON_USEDEP}]
|
||||
dev-python/pillow[webp,${PYTHON_USEDEP}]
|
||||
dev-python/pyyaml[${PYTHON_USEDEP}]
|
||||
dev-python/selenium[${PYTHON_USEDEP}]
|
||||
dev-python/tblib[${PYTHON_USEDEP}]
|
||||
sys-devel/gettext
|
||||
)
|
||||
verify-sig? ( >=sec-keys/openpgp-keys-django-20201201 )
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-3.1-bashcomp.patch
|
||||
"${FILESDIR}"/django-3.2.19-py311.patch
|
||||
# needed for Python 3.11
|
||||
"${FILESDIR}"/django-3.2.20-urlsplit.patch
|
||||
)
|
||||
|
||||
distutils_enable_sphinx docs --no-autodoc
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/django.asc
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
cd "${DISTDIR}" || die
|
||||
verify-sig_verify_signed_checksums \
|
||||
"${P^}.checksum.txt" sha256 "${P^}.tar.gz"
|
||||
cd "${WORKDIR}" || die
|
||||
fi
|
||||
|
||||
default
|
||||
}
|
||||
|
||||
python_prepare_all() {
|
||||
# Fails because of warnings
|
||||
sed -i 's/test_dumpdata_proxy_with_concrete/_&/' tests/fixtures/tests.py || die
|
||||
# TODO: this suddenly started failing
|
||||
sed -i -e 's:test_custom_fields:_&:' tests/inspectdb/tests.py || die
|
||||
|
||||
distutils-r1_python_prepare_all
|
||||
}
|
||||
|
||||
python_test() {
|
||||
# Tests have non-standard assumptions about PYTHONPATH,
|
||||
# and don't work with ${BUILD_DIR}/lib.
|
||||
PYTHONPATH=. "${EPYTHON}" tests/runtests.py --settings=test_sqlite -v2 ||
|
||||
die "Tests fail with ${EPYTHON}"
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
newbashcomp extras/django_bash_completion ${PN}-admin
|
||||
bashcomp_alias ${PN}-admin django-admin.py
|
||||
|
||||
distutils-r1_python_install_all
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
optfeature_header "Additional Backend support can be enabled via:"
|
||||
optfeature "MySQL backend support" dev-python/mysqlclient
|
||||
optfeature "PostgreSQL backend support" dev-python/psycopg:2
|
||||
optfeature_header
|
||||
optfeature "GEO Django" "sci-libs/gdal[geos]"
|
||||
optfeature "Memcached support" dev-python/pylibmc dev-python/python-memcached
|
||||
optfeature "ImageField Support" dev-python/pillow
|
||||
optfeature "Password encryption" dev-python/bcrypt
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYTHON_COMPAT=( pypy3 python3_{10..12} )
|
||||
PYTHON_REQ_USE='sqlite?,threads(+)'
|
||||
|
||||
inherit bash-completion-r1 distutils-r1 multiprocessing optfeature verify-sig
|
||||
|
||||
DESCRIPTION="High-level Python web framework"
|
||||
HOMEPAGE="
|
||||
https://www.djangoproject.com/
|
||||
https://github.com/django/django/
|
||||
https://pypi.org/project/Django/
|
||||
"
|
||||
SRC_URI="
|
||||
https://media.djangoproject.com/releases/$(ver_cut 1-2)/${P^}.tar.gz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/django-4.2.8-pypy3.patch.xz
|
||||
verify-sig? ( https://media.djangoproject.com/pgp/${P^}.checksum.txt )
|
||||
"
|
||||
S="${WORKDIR}/${P^}"
|
||||
|
||||
LICENSE="BSD"
|
||||
# admin fonts: Roboto (media-fonts/roboto)
|
||||
LICENSE+=" Apache-2.0"
|
||||
# admin icons, jquery, xregexp.js
|
||||
LICENSE+=" MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc x86 ~x64-macos"
|
||||
IUSE="doc sqlite test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="
|
||||
<dev-python/asgiref-4[${PYTHON_USEDEP}]
|
||||
>=dev-python/asgiref-3.6.0[${PYTHON_USEDEP}]
|
||||
>=dev-python/sqlparse-0.3.1[${PYTHON_USEDEP}]
|
||||
sys-libs/timezone-data
|
||||
"
|
||||
BDEPEND="
|
||||
test? (
|
||||
$(python_gen_impl_dep sqlite)
|
||||
${RDEPEND}
|
||||
dev-python/docutils[${PYTHON_USEDEP}]
|
||||
dev-python/jinja[${PYTHON_USEDEP}]
|
||||
dev-python/numpy[${PYTHON_USEDEP}]
|
||||
dev-python/pillow[webp,${PYTHON_USEDEP}]
|
||||
dev-python/pyyaml[${PYTHON_USEDEP}]
|
||||
dev-python/selenium[${PYTHON_USEDEP}]
|
||||
dev-python/tblib[${PYTHON_USEDEP}]
|
||||
sys-devel/gettext
|
||||
)
|
||||
verify-sig? ( >=sec-keys/openpgp-keys-django-20230606 )
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/django-4.0-bashcomp.patch
|
||||
"${WORKDIR}"/django-4.2.8-pypy3.patch
|
||||
)
|
||||
|
||||
distutils_enable_sphinx docs --no-autodoc
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/django.asc
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
cd "${DISTDIR}" || die
|
||||
verify-sig_verify_signed_checksums \
|
||||
"${P^}.checksum.txt" sha256 "${P^}.tar.gz"
|
||||
cd "${WORKDIR}" || die
|
||||
fi
|
||||
|
||||
default
|
||||
}
|
||||
|
||||
python_test() {
|
||||
# Tests have non-standard assumptions about PYTHONPATH,
|
||||
# and don't work with ${BUILD_DIR}/lib.
|
||||
PYTHONPATH=. "${EPYTHON}" tests/runtests.py --settings=test_sqlite \
|
||||
-v2 --parallel="${EPYTEST_JOBS:-$(makeopts_jobs)}" ||
|
||||
die "Tests fail with ${EPYTHON}"
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
newbashcomp extras/django_bash_completion ${PN}-admin
|
||||
bashcomp_alias ${PN}-admin django-admin.py
|
||||
|
||||
distutils-r1_python_install_all
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
optfeature_header "Additional Backend support can be enabled via:"
|
||||
optfeature "MySQL backend support" dev-python/mysqlclient
|
||||
optfeature "PostgreSQL backend support" dev-python/psycopg:0
|
||||
optfeature_header
|
||||
optfeature "GEO Django" "sci-libs/gdal[geos]"
|
||||
optfeature "Memcached support" dev-python/pylibmc dev-python/python-memcached
|
||||
optfeature "ImageField Support" dev-python/pillow
|
||||
optfeature "Password encryption" dev-python/bcrypt
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYTHON_COMPAT=( pypy3 python3_{10..13} )
|
||||
PYTHON_REQ_USE='sqlite?,threads(+)'
|
||||
|
||||
inherit bash-completion-r1 distutils-r1 multiprocessing optfeature verify-sig
|
||||
|
||||
DESCRIPTION="High-level Python web framework"
|
||||
HOMEPAGE="
|
||||
https://www.djangoproject.com/
|
||||
https://github.com/django/django/
|
||||
https://pypi.org/project/Django/
|
||||
"
|
||||
SRC_URI="
|
||||
https://media.djangoproject.com/releases/$(ver_cut 1-2)/${P^}.tar.gz
|
||||
https://dev.gentoo.org/~mgorny/dist/python/django-5.0-pypy3.patch.xz
|
||||
verify-sig? ( https://media.djangoproject.com/pgp/${P^}.checksum.txt )
|
||||
"
|
||||
S="${WORKDIR}/${P^}"
|
||||
|
||||
LICENSE="BSD"
|
||||
# admin fonts: Roboto (media-fonts/roboto)
|
||||
LICENSE+=" Apache-2.0"
|
||||
# admin icons, jquery, xregexp.js
|
||||
LICENSE+=" MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha amd64 arm arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc x86 ~x64-macos"
|
||||
IUSE="doc sqlite test"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="
|
||||
<dev-python/asgiref-4[${PYTHON_USEDEP}]
|
||||
>=dev-python/asgiref-3.7.0[${PYTHON_USEDEP}]
|
||||
>=dev-python/sqlparse-0.3.1[${PYTHON_USEDEP}]
|
||||
sys-libs/timezone-data
|
||||
"
|
||||
BDEPEND="
|
||||
test? (
|
||||
$(python_gen_impl_dep sqlite)
|
||||
${RDEPEND}
|
||||
>=dev-python/docutils-0.19[${PYTHON_USEDEP}]
|
||||
>=dev-python/jinja-2.11.0[${PYTHON_USEDEP}]
|
||||
dev-python/numpy[${PYTHON_USEDEP}]
|
||||
dev-python/pillow[webp,${PYTHON_USEDEP}]
|
||||
dev-python/pyyaml[${PYTHON_USEDEP}]
|
||||
>=dev-python/selenium-4.8.0[${PYTHON_USEDEP}]
|
||||
>=dev-python/tblib-1.5.0[${PYTHON_USEDEP}]
|
||||
sys-devel/gettext
|
||||
)
|
||||
verify-sig? ( >=sec-keys/openpgp-keys-django-20230606 )
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/django-4.0-bashcomp.patch
|
||||
"${WORKDIR}"/django-5.0-pypy3.patch
|
||||
# https://github.com/django/django/commit/3426a5c33c36266af42128ee9eca4921e68ea876
|
||||
"${FILESDIR}"/django-5.0.6-py313.patch
|
||||
)
|
||||
|
||||
distutils_enable_sphinx docs --no-autodoc
|
||||
|
||||
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/django.asc
|
||||
|
||||
src_unpack() {
|
||||
if use verify-sig; then
|
||||
cd "${DISTDIR}" || die
|
||||
verify-sig_verify_signed_checksums \
|
||||
"${P^}.checksum.txt" sha256 "${P^}.tar.gz"
|
||||
cd "${WORKDIR}" || die
|
||||
fi
|
||||
|
||||
default
|
||||
}
|
||||
|
||||
python_test() {
|
||||
# Tests have non-standard assumptions about PYTHONPATH,
|
||||
# and don't work with ${BUILD_DIR}/lib.
|
||||
PYTHONPATH=. "${EPYTHON}" tests/runtests.py --settings=test_sqlite \
|
||||
-v2 --parallel="${EPYTEST_JOBS:-$(makeopts_jobs)}" ||
|
||||
die "Tests fail with ${EPYTHON}"
|
||||
}
|
||||
|
||||
python_install_all() {
|
||||
newbashcomp extras/django_bash_completion ${PN}-admin
|
||||
bashcomp_alias ${PN}-admin django-admin.py
|
||||
|
||||
distutils-r1_python_install_all
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
optfeature_header "Additional Backend support can be enabled via:"
|
||||
optfeature "MySQL backend support" dev-python/mysqlclient
|
||||
optfeature "PostgreSQL backend support" dev-python/psycopg:0
|
||||
optfeature_header
|
||||
optfeature "GEO Django" "sci-libs/gdal[geos]"
|
||||
optfeature "Memcached support" dev-python/pylibmc dev-python/python-memcached
|
||||
optfeature "ImageField Support" dev-python/pillow
|
||||
optfeature "Password encryption" dev-python/bcrypt
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
From e0a8c0663debeb222bf78b97678f60929313b60a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
||||
Date: Wed, 6 May 2020 07:24:05 +0200
|
||||
Subject: [PATCH] Remove completions unsuitable for autoloading
|
||||
|
||||
The override of 'python*' completions, as well as the attempt
|
||||
to './manage.py' completion are not going to work with autoloader.
|
||||
Strip them.
|
||||
---
|
||||
extras/django_bash_completion | 33 +--------------------------------
|
||||
1 file changed, 1 insertion(+), 32 deletions(-)
|
||||
|
||||
diff --git a/extras/django_bash_completion b/extras/django_bash_completion
|
||||
index fa77d59aff..dfeb439a2e 100755
|
||||
--- a/extras/django_bash_completion
|
||||
+++ b/extras/django_bash_completion
|
||||
@@ -37,35 +37,4 @@ _django_completion()
|
||||
DJANGO_AUTO_COMPLETE=1 $1 ) )
|
||||
}
|
||||
# When the django-admin.py deprecation ends, remove django-admin.py.
|
||||
-complete -F _django_completion -o default django-admin.py manage.py django-admin
|
||||
-
|
||||
-_python_django_completion()
|
||||
-{
|
||||
- if [[ ${COMP_CWORD} -ge 2 ]]; then
|
||||
- local PYTHON_EXE=${COMP_WORDS[0]##*/}
|
||||
- if echo "$PYTHON_EXE" | grep -qE "python([3-9]\.[0-9])?"; then
|
||||
- local PYTHON_SCRIPT=${COMP_WORDS[1]##*/}
|
||||
- if echo "$PYTHON_SCRIPT" | grep -qE "manage\.py|django-admin(\.py)?"; then
|
||||
- COMPREPLY=( $( COMP_WORDS=( "${COMP_WORDS[*]:1}" )
|
||||
- COMP_CWORD=$(( COMP_CWORD-1 ))
|
||||
- DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} ) )
|
||||
- fi
|
||||
- fi
|
||||
- fi
|
||||
-}
|
||||
-
|
||||
-# Support for multiple interpreters.
|
||||
-unset pythons
|
||||
-if command -v whereis &>/dev/null; then
|
||||
- python_interpreters=$(whereis python | cut -d " " -f 2-)
|
||||
- for python in $python_interpreters; do
|
||||
- [[ $python != *-config ]] && pythons="${pythons} ${python##*/}"
|
||||
- done
|
||||
- unset python_interpreters
|
||||
- pythons=$(echo "$pythons" | tr " " "\n" | sort -u | tr "\n" " ")
|
||||
-else
|
||||
- pythons=python
|
||||
-fi
|
||||
-
|
||||
-complete -F _python_django_completion -o default $pythons
|
||||
-unset pythons
|
||||
+complete -F _django_completion -o default django-admin.py django-admin
|
||||
--
|
||||
2.28.0
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
From 2882cf6f184c7578219e2b5266623e82c0e9b8a2 Mon Sep 17 00:00:00 2001
|
||||
From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
||||
Date: Thu, 7 Apr 2022 07:02:21 +0200
|
||||
Subject: [PATCH] Refs #33173 -- Fixed test_runner/test_utils tests on Python
|
||||
3.11+.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Python 3.11 uses fully qualified test name in unittest output. See
|
||||
https://github.com/python/cpython/commit/755be9b1505af591b9f2ee424a6525b6c2b65ce9
|
||||
|
||||
(rebased by Michał Górny)
|
||||
---
|
||||
django/utils/version.py | 1 +
|
||||
tests/test_runner/test_debug_sql.py | 30 ++++++++++++++++++-----------
|
||||
tests/test_runner/test_parallel.py | 11 ++++++++---
|
||||
tests/test_utils/tests.py | 9 +++++++--
|
||||
4 files changed, 35 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/django/utils/version.py b/django/utils/version.py
|
||||
index 74c327525e..0c2bfc626e 100644
|
||||
--- a/django/utils/version.py
|
||||
+++ b/django/utils/version.py
|
||||
@@ -15,6 +15,7 @@ PY37 = sys.version_info >= (3, 7)
|
||||
PY38 = sys.version_info >= (3, 8)
|
||||
PY39 = sys.version_info >= (3, 9)
|
||||
PY310 = sys.version_info >= (3, 10)
|
||||
+PY311 = sys.version_info >= (3, 11)
|
||||
|
||||
|
||||
def get_version(version=None):
|
||||
diff --git a/tests/test_runner/test_debug_sql.py b/tests/test_runner/test_debug_sql.py
|
||||
index 0e8e4207d6..2b5fed7a76 100644
|
||||
--- a/tests/test_runner/test_debug_sql.py
|
||||
+++ b/tests/test_runner/test_debug_sql.py
|
||||
@@ -4,6 +4,7 @@ from io import StringIO
|
||||
from django.db import connection
|
||||
from django.test import TestCase
|
||||
from django.test.runner import DiscoverRunner
|
||||
+from django.utils.version import PY311
|
||||
|
||||
from .models import Person
|
||||
|
||||
@@ -100,20 +101,27 @@ class TestDebugSQL(unittest.TestCase):
|
||||
'''"test_runner_person"."first_name" = 'subtest-fail';'''),
|
||||
]
|
||||
|
||||
+ # Python 3.11 uses fully qualified test name in the output.
|
||||
+ method_name = ".runTest" if PY311 else ""
|
||||
+ test_class_path = "test_runner.test_debug_sql.TestDebugSQL"
|
||||
verbose_expected_outputs = [
|
||||
- 'runTest (test_runner.test_debug_sql.TestDebugSQL.FailingTest) ... FAIL',
|
||||
- 'runTest (test_runner.test_debug_sql.TestDebugSQL.ErrorTest) ... ERROR',
|
||||
- 'runTest (test_runner.test_debug_sql.TestDebugSQL.PassingTest) ... ok',
|
||||
+ f"runTest ({test_class_path}.FailingTest{method_name}) ... FAIL",
|
||||
+ f"runTest ({test_class_path}.ErrorTest{method_name}) ... ERROR",
|
||||
+ f"runTest ({test_class_path}.PassingTest{method_name}) ... ok",
|
||||
# If there are errors/failures in subtests but not in test itself,
|
||||
# the status is not written. That behavior comes from Python.
|
||||
- 'runTest (test_runner.test_debug_sql.TestDebugSQL.FailingSubTest) ...',
|
||||
- 'runTest (test_runner.test_debug_sql.TestDebugSQL.ErrorSubTest) ...',
|
||||
- ('''SELECT COUNT(*) AS "__count" '''
|
||||
- '''FROM "test_runner_person" WHERE '''
|
||||
- '''"test_runner_person"."first_name" = 'pass';'''),
|
||||
- ('''SELECT COUNT(*) AS "__count" '''
|
||||
- '''FROM "test_runner_person" WHERE '''
|
||||
- '''"test_runner_person"."first_name" = 'subtest-pass';'''),
|
||||
+ f"runTest ({test_class_path}.FailingSubTest{method_name}) ...",
|
||||
+ f"runTest ({test_class_path}.ErrorSubTest{method_name}) ...",
|
||||
+ (
|
||||
+ """SELECT COUNT(*) AS "__count" """
|
||||
+ """FROM "test_runner_person" WHERE """
|
||||
+ """"test_runner_person"."first_name" = 'pass';"""
|
||||
+ ),
|
||||
+ (
|
||||
+ """SELECT COUNT(*) AS "__count" """
|
||||
+ """FROM "test_runner_person" WHERE """
|
||||
+ """"test_runner_person"."first_name" = 'subtest-pass';"""
|
||||
+ ),
|
||||
]
|
||||
|
||||
def test_setupclass_exception(self):
|
||||
diff --git a/tests/test_runner/test_parallel.py b/tests/test_runner/test_parallel.py
|
||||
index c1a89bd0f0..0f1adcf208 100644
|
||||
--- a/tests/test_runner/test_parallel.py
|
||||
+++ b/tests/test_runner/test_parallel.py
|
||||
@@ -2,7 +2,7 @@ import unittest
|
||||
|
||||
from django.test import SimpleTestCase
|
||||
from django.test.runner import RemoteTestResult
|
||||
-from django.utils.version import PY37
|
||||
+from django.utils.version import PY37, PY311
|
||||
|
||||
try:
|
||||
import tblib
|
||||
@@ -78,8 +78,13 @@ class RemoteTestResultTest(SimpleTestCase):
|
||||
self.assertEqual(len(events), 4)
|
||||
|
||||
event = events[1]
|
||||
- self.assertEqual(event[0], 'addSubTest')
|
||||
- self.assertEqual(str(event[2]), 'dummy_test (test_runner.test_parallel.SampleFailingSubtest) (index=0)')
|
||||
+ self.assertEqual(event[0], "addSubTest")
|
||||
+ self.assertEqual(
|
||||
+ str(event[2]),
|
||||
+ "dummy_test (test_runner.test_parallel.SampleFailingSubtest%s) (index=0)"
|
||||
+ # Python 3.11 uses fully qualified test name in the output.
|
||||
+ % (".dummy_test" if PY311 else ""),
|
||||
+ )
|
||||
trailing_comma = '' if PY37 else ','
|
||||
self.assertEqual(repr(event[3][1]), "AssertionError('0 != 1'%s)" % trailing_comma)
|
||||
|
||||
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
|
||||
index 9255315e98..8f72057afe 100644
|
||||
--- a/tests/test_utils/tests.py
|
||||
+++ b/tests/test_utils/tests.py
|
||||
@@ -26,6 +26,7 @@ from django.test.utils import (
|
||||
)
|
||||
from django.urls import NoReverseMatch, path, reverse, reverse_lazy
|
||||
from django.utils.deprecation import RemovedInDjango41Warning
|
||||
+from django.utils.version import PY311
|
||||
|
||||
from .models import Car, Person, PossessedCar
|
||||
from .views import empty_response
|
||||
@@ -78,9 +79,11 @@ class SkippingTestCase(SimpleTestCase):
|
||||
SkipTestCase('test_foo').test_foo,
|
||||
ValueError,
|
||||
"skipUnlessDBFeature cannot be used on test_foo (test_utils.tests."
|
||||
- "SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase) "
|
||||
+ "SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase%s) "
|
||||
"as SkippingTestCase.test_skip_unless_db_feature.<locals>.SkipTestCase "
|
||||
"doesn't allow queries against the 'default' database."
|
||||
+ # Python 3.11 uses fully qualified test name in the output.
|
||||
+ % (".test_foo" if PY311 else ""),
|
||||
)
|
||||
|
||||
def test_skip_if_db_feature(self):
|
||||
@@ -122,9 +125,11 @@ class SkippingTestCase(SimpleTestCase):
|
||||
SkipTestCase('test_foo').test_foo,
|
||||
ValueError,
|
||||
"skipIfDBFeature cannot be used on test_foo (test_utils.tests."
|
||||
- "SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase) "
|
||||
+ "SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase%s) "
|
||||
"as SkippingTestCase.test_skip_if_db_feature.<locals>.SkipTestCase "
|
||||
"doesn't allow queries against the 'default' database."
|
||||
+ # Python 3.11 uses fully qualified test name in the output.
|
||||
+ % (".test_foo" if PY311 else ""),
|
||||
)
|
||||
|
||||
|
||||
--
|
||||
2.40.0
|
||||
|
||||
From 0981a4bc273e2a87ad10c602d9547e006e06d8dd Mon Sep 17 00:00:00 2001
|
||||
From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
||||
Date: Fri, 7 Apr 2023 11:07:54 +0200
|
||||
Subject: [PATCH] Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported
|
||||
on Python 3.11.4+.
|
||||
|
||||
https://github.com/python/cpython/commit/5342f5e713e0cc45b6f226d2d053a8cde1b4d68e
|
||||
|
||||
Follow up to 38e63c9e61152682f3ff982c85a73793ab6d3267.
|
||||
---
|
||||
tests/model_enums/tests.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/model_enums/tests.py b/tests/model_enums/tests.py
|
||||
index ffc199ce42..c4ca6c91d7 100644
|
||||
--- a/tests/model_enums/tests.py
|
||||
+++ b/tests/model_enums/tests.py
|
||||
@@ -259,7 +259,7 @@ class CustomChoicesTests(SimpleTestCase):
|
||||
pass
|
||||
|
||||
def test_uuid_unsupported(self):
|
||||
- msg = 'UUID objects are immutable'
|
||||
- with self.assertRaisesMessage(TypeError, msg):
|
||||
+ with self.assertRaises(TypeError):
|
||||
+
|
||||
class Identifier(uuid.UUID, models.Choices):
|
||||
A = '972ce4eb-a95f-4a56-9339-68c208a76f18'
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
From 74fee3f5cab1481dcb299b6eeaf82f862470bafa Mon Sep 17 00:00:00 2001
|
||||
From: mendespedro <windowsxpedro@gmail.com>
|
||||
Date: Wed, 15 Dec 2021 11:55:19 -0300
|
||||
Subject: [PATCH] Fixed #33367 -- Fixed URLValidator crash in some edge cases.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
[backported to 3.2.x by Michał Górny]
|
||||
---
|
||||
django/core/validators.py | 13 +++---
|
||||
.../forms_tests/field_tests/test_urlfield.py | 40 +++++++++++++++----
|
||||
2 files changed, 40 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/django/core/validators.py b/django/core/validators.py
|
||||
index b9b58dfa61..aad21f95ea 100644
|
||||
--- a/django/core/validators.py
|
||||
+++ b/django/core/validators.py
|
||||
@@ -111,15 +111,16 @@ class URLValidator(RegexValidator):
|
||||
raise ValidationError(self.message, code=self.code, params={'value': value})
|
||||
|
||||
# Then check full URL
|
||||
+ try:
|
||||
+ splitted_url = urlsplit(value)
|
||||
+ except ValueError:
|
||||
+ raise ValidationError(self.message, code=self.code, params={'value': value})
|
||||
try:
|
||||
super().__call__(value)
|
||||
except ValidationError as e:
|
||||
# Trivial case failed. Try for possible IDN domain
|
||||
if value:
|
||||
- try:
|
||||
- scheme, netloc, path, query, fragment = urlsplit(value)
|
||||
- except ValueError: # for example, "Invalid IPv6 URL"
|
||||
- raise ValidationError(self.message, code=self.code, params={'value': value})
|
||||
+ scheme, netloc, path, query, fragment = splitted_url
|
||||
try:
|
||||
netloc = punycode(netloc) # IDN -> ACE
|
||||
except UnicodeError: # invalid domain part
|
||||
@@ -130,7 +131,7 @@ class URLValidator(RegexValidator):
|
||||
raise
|
||||
else:
|
||||
# Now verify IPv6 in the netloc part
|
||||
- host_match = re.search(r'^\[(.+)\](?::\d{2,5})?$', urlsplit(value).netloc)
|
||||
+ host_match = re.search(r'^\[(.+)\](?::\d{1,5})?$', splitted_url.netloc)
|
||||
if host_match:
|
||||
potential_ip = host_match[1]
|
||||
try:
|
||||
@@ -142,7 +143,7 @@ class URLValidator(RegexValidator):
|
||||
# section 3.1. It's defined to be 255 bytes or less, but this includes
|
||||
# one byte for the length of the name and one byte for the trailing dot
|
||||
# that's used to indicate absolute names in DNS.
|
||||
- if len(urlsplit(value).hostname) > 253:
|
||||
+ if splitted_url.hostname is None or len(splitted_url.hostname) > 253:
|
||||
raise ValidationError(self.message, code=self.code, params={'value': value})
|
||||
|
||||
|
||||
diff --git a/tests/forms_tests/field_tests/test_urlfield.py b/tests/forms_tests/field_tests/test_urlfield.py
|
||||
index 19e4351c6a..68b148e7b7 100644
|
||||
--- a/tests/forms_tests/field_tests/test_urlfield.py
|
||||
+++ b/tests/forms_tests/field_tests/test_urlfield.py
|
||||
@@ -135,13 +135,39 @@ class URLFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
|
||||
def test_urlfield_10(self):
|
||||
"""URLField correctly validates IPv6 (#18779)."""
|
||||
f = URLField()
|
||||
- urls = (
|
||||
- 'http://[12:34::3a53]/',
|
||||
- 'http://[a34:9238::]:8080/',
|
||||
- )
|
||||
- for url in urls:
|
||||
- with self.subTest(url=url):
|
||||
- self.assertEqual(url, f.clean(url))
|
||||
+ tests = [
|
||||
+ 'foo',
|
||||
+ 'com.',
|
||||
+ '.',
|
||||
+ 'http://',
|
||||
+ 'http://example',
|
||||
+ 'http://example.',
|
||||
+ 'http://.com',
|
||||
+ 'http://invalid-.com',
|
||||
+ 'http://-invalid.com',
|
||||
+ 'http://inv-.alid-.com',
|
||||
+ 'http://inv-.-alid.com',
|
||||
+ '[a',
|
||||
+ 'http://[a',
|
||||
+ # Non-string.
|
||||
+ 23,
|
||||
+ # Hangs "forever" before fixing a catastrophic backtracking,
|
||||
+ # see #11198.
|
||||
+ 'http://%s' % ('X' * 60,),
|
||||
+ # A second example, to make sure the problem is really addressed,
|
||||
+ # even on domains that don't fail the domain label length check in
|
||||
+ # the regex.
|
||||
+ 'http://%s' % ("X" * 200,),
|
||||
+ # urlsplit() raises ValueError.
|
||||
+ '////]@N.AN',
|
||||
+ # Empty hostname.
|
||||
+ '#@A.bO',
|
||||
+ ]
|
||||
+ msg = "'Enter a valid URL.'"
|
||||
+ for value in tests:
|
||||
+ with self.subTest(value=value):
|
||||
+ with self.assertRaisesMessage(ValidationError, msg):
|
||||
+ f.clean(value)
|
||||
|
||||
def test_urlfield_not_string(self):
|
||||
f = URLField(required=False)
|
||||
--
|
||||
2.41.0
|
||||
|
||||
Reference in New Issue
Block a user