dev-python/django: add 3.2.25

Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr>
This commit is contained in:
Alarig Le Lay 2024-08-21 12:21:41 +02:00
parent 25baec6963
commit 15b4796c36
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC
4 changed files with 406 additions and 0 deletions

View file

@ -1,2 +1,4 @@
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-3.2.9.checksum.txt 2547 BLAKE2B 7a1c38abe3215ee4533984c7d78c37b369545695fb11d84d6600d64eec290addb9257c4d2850af4e311df2245799572e0866917e09713643376da7859754a2ce SHA512 9aae8da65079e20dcf9071fd72fa5f5c61640264b52c842d96cc2f697ba1d5003cf7b7c6d1f95549eb8ec4449679a00ddd267c022b3d0483ab030cc96c9405b7
DIST Django-3.2.9.tar.gz 9809157 BLAKE2B 27fc04e874055f69466f06b009c015b46c2d2fa9ddd0005f7b2b7b32a45bd1b8a9f34e693027e040b8d05fa581dfeb9a00aaa1d876477cff5292167f20768b60 SHA512 62fb297694a7f5e48465e102dc97e3d1d04b94499bc6d98d37a00d96b438b8c919b6d08055868a1836d62b89ff65ce4fa7dbc9390789dab2eeca0187269b125f

View file

@ -0,0 +1,110 @@
# 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..12} )
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
}

View file

@ -0,0 +1,183 @@
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

View file

@ -0,0 +1,111 @@
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