1{
2 lib,
3 buildPythonPackage,
4 pythonAtLeast,
5 fetchFromGitHub,
6 pytestCheckHook,
7 flit-core,
8 installer,
9 mock,
10}:
11
12buildPythonPackage rec {
13 pname = "installer";
14 version = "0.7.0";
15 format = "pyproject";
16
17 src = fetchFromGitHub {
18 owner = "pypa";
19 repo = "installer";
20 rev = version;
21 hash = "sha256-thHghU+1Alpay5r9Dc3v7ATRFfYKV8l9qR0nbGOOX/A=";
22 };
23
24 patches = lib.optionals (pythonAtLeast "3.13") [
25 # Fix compatibility with Python 3.13
26 # https://github.com/pypa/installer/pull/201
27 ./python313-compat.patch
28 ];
29
30 nativeBuildInputs = [ flit-core ];
31
32 # We need to disable tests because this package is part of the bootstrap chain
33 # and its test dependencies cannot be built yet when this is being built.
34 doCheck = false;
35
36 passthru.tests = {
37 pytest = buildPythonPackage {
38 pname = "${pname}-pytest";
39 inherit version;
40 format = "other";
41
42 dontBuild = true;
43 dontInstall = true;
44
45 nativeCheckInputs = [
46 installer
47 mock
48 pytestCheckHook
49 ];
50 };
51 };
52
53 meta = with lib; {
54 description = "Low-level library for installing a Python package from a wheel distribution";
55 homepage = "https://github.com/pypa/installer";
56 changelog = "https://github.com/pypa/installer/blob/${src.rev}/docs/changelog.md";
57 license = licenses.mit;
58 maintainers = [ maintainers.cpcloud ];
59 teams = [ teams.python ];
60 };
61}