From 31aa936b15dfb39f536e87b63bf161c2c7fd0ff5 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 16 May 2023 17:44:33 +0200 Subject: [PATCH] python310Packages.django-hijack: 3.2.6 -> 3.3.0 https://github.com/django-hijack/django-hijack/releases/tag/3.2.7 https://github.com/django-hijack/django-hijack/releases/tag/3.3.0 --- .../python-modules/django-hijack/default.nix | 61 +++++++++++++------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/pkgs/development/python-modules/django-hijack/default.nix b/pkgs/development/python-modules/django-hijack/default.nix index cefcf75f6b5..47719995c69 100644 --- a/pkgs/development/python-modules/django-hijack/default.nix +++ b/pkgs/development/python-modules/django-hijack/default.nix @@ -1,28 +1,57 @@ { lib -, fetchPypi +, fetchFromGitHub +, fetchNpmDeps , buildPythonPackage + +# build-system +, gettext +, nodejs +, npmHooks +, setuptools-scm + +# dependencies , django , django_compat + +# tests , pytest-django , pytestCheckHook }: buildPythonPackage rec { pname = "django-hijack"; - version = "3.2.6"; + version = "3.3.0"; + format = "setuptools"; - # the wheel comes with pre-built assets, allowing us to avoid fighting - # with npm/webpack/gettext to build them ourselves. - format = "wheel"; - - src = fetchPypi { - inherit version format; - pname = "django_hijack"; - dist = "py3"; - python = "py3"; - hash = "sha256-xFPZ03II1814+bZ5gx7GD/AxYMiLuH6awfSeXEraOHQ="; + src = fetchFromGitHub { + owner = "django-hijack"; + repo = "django-hijack"; + rev = "refs/tags/${version}"; + hash = "sha256-ytQ4xxkBAC3amQbenD8RO5asrbfNAjOspWUY3c2hkig="; }; + postPatch = '' + substituteInPlace setup.py \ + --replace 'cmd = ["npm", "ci"]' 'cmd = ["true"]' \ + --replace 'f"{self.build_lib}/{name}.mo"' 'f"{name}.mo"' + + sed -i "/addopts/d" setup.cfg + ''; + + npmDeps = fetchNpmDeps { + inherit src; + hash = "sha256-FLfMCn2jsLlTTsC+LRMX0dmVCCbNAr2pQUsSQRKgo6E="; + }; + + SETUPTOOLS_SCM_PRETEND_VERSION = version; + + nativeBuildInputs = [ + gettext + nodejs + npmHooks.npmConfigHook + setuptools-scm + ]; + propagatedBuildInputs = [ django django_compat @@ -33,13 +62,11 @@ buildPythonPackage rec { pytest-django ]; - preCheck = '' - export DJANGO_SETTINGS_MODULE='hijack.tests.test_app.settings' - ''; + env.DJANGO_SETTINGS_MODULE = "hijack.tests.test_app.settings"; pytestFlagsArray = [ - "--pyargs" - "hijack" + "--pyargs" "hijack" + "-W" "ignore::DeprecationWarning" ]; meta = with lib; {