anki-bin: 24.06.3 -> 24.11 (#360722)
[NixPkgs.git] / pkgs / development / python-modules / django-phonenumber-field / default.nix
blob39cd78b2f495b4d0e146baba49c23eefc9229e69
2   lib,
3   babel,
4   buildPythonPackage,
5   django,
6   djangorestframework,
7   fetchFromGitHub,
8   phonenumbers,
9   phonenumberslite,
10   python,
11   pythonOlder,
12   setuptools-scm,
15 buildPythonPackage rec {
16   pname = "django-phonenumber-field";
17   version = "8.0.0";
18   pyproject = true;
20   disabled = pythonOlder "3.8";
22   src = fetchFromGitHub {
23     owner = "stefanfoulis";
24     repo = "django-phonenumber-field";
25     rev = "refs/tags/${version}";
26     hash = "sha256-l+BAh7QYGN0AgDHICvlQnBYAcpEn8acu+JBmoo85kF0=";
27   };
29   build-system = [ setuptools-scm ];
31   # Upstream doesn't put phonenumbers in dependencies but the package doesn't
32   # make sense without either of the two optional dependencies. Since, in
33   # Nixpkgs, phonenumberslite depends on phonenumbers, add the latter
34   # unconditionally.
35   dependencies = [ django ] ++ optional-dependencies.phonenumbers;
37   nativeCheckInputs = [
38     babel
39     djangorestframework
40   ];
42   pythonImportsCheck = [ "phonenumber_field" ];
44   checkPhase = ''
45     ${python.interpreter} -m django test --settings tests.settings
46   '';
48   optional-dependencies = {
49     phonenumbers = [ phonenumbers ];
50     phonenumberslite = [ phonenumberslite ];
51   };
53   meta = with lib; {
54     description = "Django model and form field for normalised phone numbers using python-phonenumbers";
55     homepage = "https://github.com/stefanfoulis/django-phonenumber-field/";
56     changelog = "https://github.com/stefanfoulis/django-phonenumber-field/releases/tag/${version}";
57     license = licenses.mit;
58     maintainers = with maintainers; [ sephi ];
59   };