Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / django-hijack / default.nix
blob5832d9a069338d11e96cb0bdae447e40ad574880
1 { lib
2 , fetchFromGitHub
3 , fetchNpmDeps
4 , buildPythonPackage
5 , nix-update-script
7 # build-system
8 , gettext
9 , nodejs
10 , npmHooks
11 , setuptools-scm
13 # dependencies
14 , django
16 # tests
17 , pytest-django
18 , pytestCheckHook
21 buildPythonPackage rec {
22   pname = "django-hijack";
23   version = "3.4.2";
24   format = "setuptools";
26   src = fetchFromGitHub {
27     owner = "django-hijack";
28     repo = "django-hijack";
29     rev = "refs/tags/${version}";
30     hash = "sha256-E5gM/5MIB65gdyv/I+Kuw8rbjPvtUnbCPXpasaIDzyo=";
31   };
33   postPatch = ''
34     substituteInPlace setup.py \
35       --replace 'cmd = ["npm", "ci"]' 'cmd = ["true"]' \
36       --replace 'f"{self.build_lib}/{name}.mo"' 'f"{name}.mo"'
38     sed -i "/addopts/d" setup.cfg
39   '';
41   npmDeps = fetchNpmDeps {
42     inherit src;
43     hash = "sha256-4ZVb+V/oYfflIZdme6hbpoSBFVV7lk5wLfEzzBqZv/Y=";
44   };
46   SETUPTOOLS_SCM_PRETEND_VERSION = version;
48   nativeBuildInputs = [
49     gettext
50     nodejs
51     npmHooks.npmConfigHook
52     setuptools-scm
53   ];
55   propagatedBuildInputs = [
56     django
57   ];
59   nativeCheckInputs = [
60     pytestCheckHook
61     pytest-django
62   ];
64   env.DJANGO_SETTINGS_MODULE = "hijack.tests.test_app.settings";
66   pytestFlagsArray = [
67     "--pyargs" "hijack"
68     "-W" "ignore::DeprecationWarning"
69   ];
71   # needed for npmDeps update
72   passthru.updateScript = nix-update-script { };
74   meta = with lib; {
75     description = "Allows superusers to hijack (=login as) and work on behalf of another user";
76     homepage = "https://github.com/arteria/django-hijack";
77     changelog = "https://github.com/django-hijack/django-hijack/releases/tag/${version}";
78     license = licenses.mit;
79     maintainers = with maintainers; [ ris ];
80   };