1{ lib
2, fetchFromGitHub
3, fetchNpmDeps
4, buildPythonPackage
5
6# build-system
7, gettext
8, nodejs
9, npmHooks
10, setuptools-scm
11
12# dependencies
13, django
14, django_compat
15
16# tests
17, pytest-django
18, pytestCheckHook
19}:
20
21buildPythonPackage rec {
22 pname = "django-hijack";
23 version = "3.3.0";
24 format = "setuptools";
25
26 src = fetchFromGitHub {
27 owner = "django-hijack";
28 repo = "django-hijack";
29 rev = "refs/tags/${version}";
30 hash = "sha256-ytQ4xxkBAC3amQbenD8RO5asrbfNAjOspWUY3c2hkig=";
31 };
32
33 postPatch = ''
34 substituteInPlace setup.py \
35 --replace 'cmd = ["npm", "ci"]' 'cmd = ["true"]' \
36 --replace 'f"{self.build_lib}/{name}.mo"' 'f"{name}.mo"'
37
38 sed -i "/addopts/d" setup.cfg
39 '';
40
41 npmDeps = fetchNpmDeps {
42 inherit src;
43 hash = "sha256-FLfMCn2jsLlTTsC+LRMX0dmVCCbNAr2pQUsSQRKgo6E=";
44 };
45
46 SETUPTOOLS_SCM_PRETEND_VERSION = version;
47
48 nativeBuildInputs = [
49 gettext
50 nodejs
51 npmHooks.npmConfigHook
52 setuptools-scm
53 ];
54
55 propagatedBuildInputs = [
56 django
57 django_compat
58 ];
59
60 nativeCheckInputs = [
61 pytestCheckHook
62 pytest-django
63 ];
64
65 env.DJANGO_SETTINGS_MODULE = "hijack.tests.test_app.settings";
66
67 pytestFlagsArray = [
68 "--pyargs" "hijack"
69 "-W" "ignore::DeprecationWarning"
70 ];
71
72 meta = with lib; {
73 description = "Allows superusers to hijack (=login as) and work on behalf of another user";
74 homepage = "https://github.com/arteria/django-hijack";
75 changelog = "https://github.com/django-hijack/django-hijack/releases/tag/${version}";
76 license = licenses.mit;
77 maintainers = with maintainers; [ ris ];
78 };
79}