diff --git a/pkgs/development/python-modules/django-q/default.nix b/pkgs/development/python-modules/django-q/default.nix index f81fc01bdd6f..a6ebb5714d9d 100644 --- a/pkgs/development/python-modules/django-q/default.nix +++ b/pkgs/development/python-modules/django-q/default.nix @@ -1,24 +1,82 @@ -{ lib, buildPythonPackage, fetchPypi, django-picklefield, arrow -, blessed, django, future }: +{ arrow +, blessed +, buildPythonPackage +, croniter +, django +, django-redis +, django-picklefield +, fetchFromGitHub +, future +, lib +, poetry-core +, pytest-django +, pytest-mock +, pytestCheckHook +, pkgs +, stdenv +}: buildPythonPackage rec { pname = "django-q"; version = "1.3.9"; + format = "pyproject"; - src = fetchPypi { - inherit pname version; - sha256 = "5c6b4d530aa3aabf9c6aa57376da1ca2abf89a1562b77038b7a04e52a4a0a91b"; + src = fetchFromGitHub { + owner = "Koed00"; + repo = "django-q"; + sha256 = "sha256-gFSrAl3QGoJEJfvTTvLQgViPPjeJ6BfvgEwgLLo+uAA="; + rev = "v${version}"; }; + nativeBuildInputs = [ poetry-core ]; + propagatedBuildInputs = [ - django-picklefield arrow blessed django future + django-picklefield + arrow + blessed + django + future ]; - doCheck = false; + # fixes empty version string + # analog to https://github.com/NixOS/nixpkgs/pull/171200 + patches = [ + ./pep-621.patch + ]; + + pythonImportsCheck = [ + "django_q" + ]; + + preCheck = '' + ${pkgs.redis}/bin/redis-server & + REDIS_PID=$! + ''; + + postCheck = '' + kill $REDIS_PID + ''; + + checkInputs = [ + croniter + django-redis + pytest-django + pytest-mock + pytestCheckHook + ]; + + # don't bother with two more servers to test + disabledTests = [ + "test_disque" + "test_mongo" + ]; + + doCheck = !stdenv.isDarwin; meta = with lib; { description = "A multiprocessing distributed task queue for Django"; homepage = "https://django-q.readthedocs.org"; license = licenses.mit; + maintainers = with maintainers; [ gador ]; }; } diff --git a/pkgs/development/python-modules/django-q/pep-621.patch b/pkgs/development/python-modules/django-q/pep-621.patch new file mode 100644 index 000000000000..e0a1568f4825 --- /dev/null +++ b/pkgs/development/python-modules/django-q/pep-621.patch @@ -0,0 +1,32 @@ +diff --git a/pyproject.toml b/pyproject.toml +index 9a83e90..0cdffaf 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -1,16 +1,12 @@ +-[tool.poetry] ++[project] + name = "django-q" + version = "1.3.9" + description = "A multiprocessing distributed task queue for Django" +-authors = ["Ilan Steemers "] +-maintainers = ["Ilan Steemers "] +-license = "MIT" ++authors = [ { name = "Ilan Steemers", email = "koed00@gmail.com"} ] ++maintainers = [ { name = "Ilan Steemers", email = "koed00@gmail.com"} ] ++license.text = "MIT" + readme = 'README.rst' + +-repository = "https://github.com/koed00/django-q" +-homepage = "https://django-q.readthedocs.org" +-documentation = "https://django-q.readthedocs.org" +- + keywords = ["django", "distributed", "multiprocessing", "queue", "scheduler"] + + classifiers = [ +@@ -31,7 +27,6 @@ classifiers = [ + 'Topic :: System :: Distributed Computing', + 'Topic :: Software Development :: Libraries :: Python Modules', + ] +-include = ['CHANGELOG.md'] + + [tool.poetry.plugins] # Optional super table