summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/installer/default.nix
blob: b7273769abbb5d4f168941717ee74108f78d76ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{
  lib,
  buildPythonPackage,
  pythonAtLeast,
  fetchFromGitHub,
  pytestCheckHook,
  flit-core,
  installer,
  mock,
}:

buildPythonPackage rec {
  pname = "installer";
  version = "0.7.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pypa";
    repo = "installer";
    rev = version;
    hash = "sha256-thHghU+1Alpay5r9Dc3v7ATRFfYKV8l9qR0nbGOOX/A=";
  };

  patches =
    lib.optionals (pythonAtLeast "3.13") [
      # Fix compatibility with Python 3.13
      # https://github.com/pypa/installer/pull/201
      ./python313-compat.patch
    ]
    ++ [
      # Add -m flag to installer to correctly support cross
      # https://github.com/pypa/installer/pull/258
      ./cross.patch
    ];

  nativeBuildInputs = [ flit-core ];

  # We need to disable tests because this package is part of the bootstrap chain
  # and its test dependencies cannot be built yet when this is being built.
  doCheck = false;

  passthru.tests = {
    pytest = buildPythonPackage {
      pname = "${pname}-pytest";
      inherit version;
      pyproject = false;

      dontBuild = true;
      dontInstall = true;

      nativeCheckInputs = [
        installer
        mock
        pytestCheckHook
      ];
    };
  };

  meta = {
    description = "Low-level library for installing a Python package from a wheel distribution";
    homepage = "https://github.com/pypa/installer";
    changelog = "https://github.com/pypa/installer/blob/${src.rev}/docs/changelog.md";
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.cpcloud ];
    teams = [ lib.teams.python ];
  };
}