diff --git a/pkgs/development/python-modules/distutils/80.nix b/pkgs/development/python-modules/distutils/80.nix new file mode 100644 index 000000000000..8d9c304afded --- /dev/null +++ b/pkgs/development/python-modules/distutils/80.nix @@ -0,0 +1,91 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pythonAtLeast, + setuptools-scm, + setuptools_80, + python, + docutils, + jaraco-collections, + jaraco-functools, + jaraco-envs, + jaraco-path, + jaraco-text, + libz, + more-itertools, + packaging, + path, + pyfakefs, + pytestCheckHook, + stdenv, +}: + +buildPythonPackage { + pname = "distutils"; + inherit (setuptools_80) version; + pyproject = true; + + src = fetchFromGitHub { + owner = "pypa"; + repo = "distutils"; + rev = "5ad8291ff2ad3e43583bc72a4c09299ca6134f09"; # correlate commit from setuptools version + hash = "sha256-3Mqpe/Goj3lQ6GEbX3DHWjdoh7XsFIg9WkOCK138OAo="; + }; + + postPatch = '' + sed -i '/coherent\.licensed/d' pyproject.toml + ''; + + build-system = [ setuptools-scm ]; + + dependencies = [ + jaraco-collections + jaraco-functools + more-itertools + packaging + ]; + + postInstall = '' + rm -r $out/${python.sitePackages}/distutils + ln -s ${setuptools_80}/${python.sitePackages}/setuptools/_distutils $out/${python.sitePackages}/distutils + ''; + + pythonImportsCheck = [ "distutils" ]; + + nativeCheckInputs = [ + docutils + jaraco-envs + jaraco-path + jaraco-text + more-itertools + path + pyfakefs + pytestCheckHook + ]; + + checkInputs = [ + # https://github.com/pypa/distutils/blob/5ad8291ff2ad3e43583bc72a4c09299ca6134f09/distutils/tests/test_build_ext.py#L107 + libz + ]; + + # jaraco-path depends ob pyobjc + doCheck = !stdenv.hostPlatform.isDarwin; + + disabledTests = [ + # TypeError: byte_compile() got an unexpected keyword argument 'dry_run' + "test_byte_compile" + "test_byte_compile_optimized" + ] + ++ lib.optionals (pythonAtLeast "3.14") [ + # AssertionError: assert '(?s:foo[^/]*)\\z' == '(?s:foo[^/]*)\\Z' + "test_glob_to_re" + ]; + + meta = { + description = "Distutils as found in cpython"; + homepage = "https://github.com/pypa/distutils"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0927c751981e..bf307ade35ac 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4091,6 +4091,9 @@ self: super: with self; { distutils-extra = callPackage ../development/python-modules/distutils-extra { }; + distutils_80 = + if pythonOlder "3.12" then null else callPackage ../development/python-modules/distutils/80.nix { }; + dj-database-url = callPackage ../development/python-modules/dj-database-url { }; dj-email-url = callPackage ../development/python-modules/dj-email-url { };