python3Packages.mezzanine: fix src, enable tests, refactor

This commit is contained in:
Martin Weinelt
2025-08-20 03:51:20 +02:00
parent 59cbad7c07
commit c9bd75441d
2 changed files with 40 additions and 22 deletions
@@ -6,18 +6,20 @@
chardet,
django,
django-contrib-comments,
fetchPypi,
fetchFromGitHub,
filebrowser-safe,
future,
grappelli-safe,
isPyPy,
pep8,
pillow,
pyflakes,
pytestCheckHook,
pytest-cov-stub,
pytest-django,
pythonOlder,
pytz,
requests,
requests-oauthlib,
requirements-parser,
setuptools,
tzlocal,
}:
@@ -28,25 +30,27 @@ buildPythonPackage rec {
disabled = pythonOlder "3.7" || isPyPy;
src = fetchPypi {
pname = "Mezzanine";
inherit version;
hash = "sha256-RZ/9ltvZUz1eXxeaVqS9ZE69+a9XWt6fxMcss+yTVP4=";
src = fetchFromGitHub {
owner = "stephenmcd";
repo = "mezzanine";
tag = "v${version}";
hash = "sha256-TdGWlquS4hsnxIM0bhbWR7C0X4wyUcqC+YrBDSShRhg=";
};
buildInputs = [
pyflakes
pep8
patches = [
# drop git requirement from tests and fake stable branch
./tests-no-git.patch
];
propagatedBuildInputs = [
build-system = [ setuptools ];
dependencies = [
beautifulsoup4
bleach
chardet
django
django-contrib-comments
filebrowser-safe
future
grappelli-safe
pillow
pytz
@@ -56,15 +60,12 @@ buildPythonPackage rec {
]
++ bleach.optional-dependencies.css;
# Tests Fail Due to Syntax Warning, Fixed for v3.1.11+
doCheck = false;
# sed calls will be unnecessary in v3.1.11+
preConfigure = ''
sed -i 's/==/>=/' setup.py
'';
LC_ALL = "en_US.UTF-8";
nativeCheckInputs = [
pytest-django
pytest-cov-stub
pytestCheckHook
requirements-parser
];
meta = with lib; {
description = "Content management platform built using the Django framework";
@@ -0,0 +1,17 @@
diff --git a/tests/test_core.py b/tests/test_core.py
index 40cd39fe..57abbec0 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -47,11 +47,7 @@ from mezzanine.utils.sites import current_site_id, override_current_site_id
from mezzanine.utils.tests import TestCase
from mezzanine.utils.urls import admin_url
-BRANCH_NAME = (
- subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"])
- .decode()
- .strip()
-)
+BRANCH_NAME = "stable"
VERSION_WARN = (
"Unpinned or pre-release dependencies detected in Mezzanine's requirements: {}"
)