nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonAtLeast,
6 setuptools-scm,
7 setuptools,
8 python,
9 docutils,
10 jaraco-collections,
11 jaraco-functools,
12 jaraco-envs,
13 jaraco-path,
14 jaraco-text,
15 libz,
16 more-itertools,
17 packaging,
18 path,
19 pyfakefs,
20 pytestCheckHook,
21 stdenv,
22}:
23
24buildPythonPackage {
25 pname = "distutils";
26 inherit (setuptools) version;
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "pypa";
31 repo = "distutils";
32 rev = "5ad8291ff2ad3e43583bc72a4c09299ca6134f09"; # correlate commit from setuptools version
33 hash = "sha256-3Mqpe/Goj3lQ6GEbX3DHWjdoh7XsFIg9WkOCK138OAo=";
34 };
35
36 build-system = [ setuptools-scm ];
37
38 dependencies = [
39 jaraco-collections
40 jaraco-functools
41 more-itertools
42 packaging
43 ];
44
45 postInstall = ''
46 rm -r $out/${python.sitePackages}/distutils
47 ln -s ${setuptools}/${python.sitePackages}/setuptools/_distutils $out/${python.sitePackages}/distutils
48 '';
49
50 pythonImportsCheck = [ "distutils" ];
51
52 nativeCheckInputs = [
53 docutils
54 jaraco-envs
55 jaraco-path
56 jaraco-text
57 more-itertools
58 path
59 pyfakefs
60 pytestCheckHook
61 ];
62
63 checkInputs = [
64 # https://github.com/pypa/distutils/blob/5ad8291ff2ad3e43583bc72a4c09299ca6134f09/distutils/tests/test_build_ext.py#L107
65 libz
66 ];
67
68 # jaraco-path depends ob pyobjc
69 doCheck = !stdenv.hostPlatform.isDarwin;
70
71 disabledTests = lib.optionals (pythonAtLeast "3.14") [
72 # AssertionError: assert '(?s:foo[^/]*)\\z' == '(?s:foo[^/]*)\\Z'
73 "test_glob_to_re"
74 ];
75
76 meta = {
77 description = "Distutils as found in cpython";
78 homepage = "https://github.com/pypa/distutils";
79 license = lib.licenses.mit;
80 maintainers = with lib.maintainers; [ dotlambda ];
81 };
82}