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