Skip to content

Commit

Permalink
django-cms
Browse files Browse the repository at this point in the history
  • Loading branch information
onny committed Nov 4, 2024
1 parent a0d72c6 commit 39a6c01
Showing 1 changed file with 40 additions and 30 deletions.
70 changes: 40 additions & 30 deletions pkgs/development/python-modules/django-cms/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,13 @@
python,
dj-database-url,
djangocms-text-ckeditor,
fetchpatch,
django-cms,
gettext,
iptools,
ruff,
}:

let
# Test requires legacy module
# https://github.com/django-cms/django-cms/issues/6449
django-app-manage = buildPythonPackage rec {
pname = "django-app-manage";
version = "0-unstable";
pyproject = true;

src = fetchFromGitHub {
owner = "ojii";
repo = "django-app-manage";
rev = "083d98934a9354ab455c26aa8760009bea30de9f";
hash = "sha256-3LKMqO3uHV3S1wgl7vf+GLvxkrIY7Ccnyxqb0w3FgD4=";
};

build-system = [ setuptools ];

dependencies = [
django
dj-database-url
];
};
in
buildPythonPackage rec {
pname = "django-cms";
version = "4.1.3";
Expand All @@ -53,6 +35,21 @@ buildPythonPackage rec {
hash = "sha256-ucGxc6f2UYdmSLuyxVV2nIcl35qoeQMlk1paN6XeBFY=";
};

patches = [
# Removed django-app-manage dependency by updating ./manage.py
# https://github.com/django-cms/django-cms/pull/8061
(fetchpatch {
url = "https://github.com/django-cms/django-cms/commit/3270edb72f6a736b5cb448864ce2eaf68f061740.patch";
hash = "sha256-DkgAfE/QGAXwKMNvgcYxtO0yAc7oAaAAui2My8ml1Vk=";
name = "remove_django_app_manage_dependency.patch";
})
(fetchpatch {
url = "https://github.com/django-cms/django-cms/pull/8061/commits/04005ff693e775db645c62fefbb62367822e66f9.patch";
hash = "sha256-4M/VKEv7pnqCk6fDyA6FurSCCu/k9tNnz16wT4Tr0Rw=";
name = "manage_py_update_dj_database_url.patch";
})
];

build-system = [ setuptools ];

dependencies = [
Expand All @@ -64,21 +61,34 @@ buildPythonPackage rec {
djangocms-admin-style
];

preCheck = ''
export DJANGO_SETTINGS_MODULE="tests.settings"
'';

nativeCheckInputs = [ pytestCheckHook ];
nativeCheckInputs = [
gettext
pytestCheckHook
];

checkInputs = [
#djangocms-text-ckeditor
django-app-manage
dj-database-url
djangocms-text-ckeditor
iptools
ruff
];

checkPhase = ''
runHook preCheck
${python.interpreter} manage.py test
runHook postCheck
'';

# Tests depend on dnagocms-text-ckeditor, which depends on this package.
# To avoid infinite recursion, we only enable tests when building passthru.tests.
doCheck = false;

passthru.tests = {
runTests = django-cms.overridePythonAttrs (_: {
doCheck = true;
});
};

pythonImportCheck = [ "django-cms" ];

meta = {
Expand Down

0 comments on commit 39a6c01

Please sign in to comment.