2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, python
|
|
|
|
, bootstrapped-pip
|
|
|
|
, lib
|
|
|
|
, pipInstallHook
|
|
|
|
, setuptoolsBuildHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "setuptools";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "65.6.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Create an sdist of setuptools
|
|
|
|
sdist = stdenv.mkDerivation rec {
|
|
|
|
name = "${pname}-${version}-sdist.tar.gz";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pypa";
|
|
|
|
repo = pname;
|
2022-09-30 11:47:45 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-01-20 10:41:00 +00:00
|
|
|
hash = "sha256-B/1MhH0RDW7/pUam2FHnIcUPN6NpvQYBjRyHIm+E9rI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "${pname}-${version}-source";
|
|
|
|
};
|
|
|
|
|
2020-11-21 19:51:51 +00:00
|
|
|
patches = [
|
|
|
|
./tag-date.patch
|
2022-04-15 01:41:22 +00:00
|
|
|
./setuptools-distutils-C++.patch
|
2020-11-21 19:51:51 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPhase = ''
|
2021-08-05 21:33:18 +00:00
|
|
|
${python.pythonForBuild.interpreter} setup.py egg_info
|
2020-04-24 23:36:52 +00:00
|
|
|
${python.pythonForBuild.interpreter} setup.py sdist --formats=gztar
|
2020-11-21 19:51:51 +00:00
|
|
|
|
|
|
|
# Here we untar the sdist and retar it in order to control the timestamps
|
|
|
|
# of all the files included
|
|
|
|
tar -xzf dist/${pname}-${version}.post0.tar.gz -C dist/
|
2020-12-25 13:55:36 +00:00
|
|
|
tar -czf dist/${name} -C dist/ --mtime="@$SOURCE_DATE_EPOCH" --sort=name ${pname}-${version}.post0
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
echo "Moving sdist..."
|
2020-11-21 19:51:51 +00:00
|
|
|
mv dist/${name} $out
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
in buildPythonPackage rec {
|
|
|
|
inherit pname version;
|
|
|
|
# Because of bootstrapping we don't use the setuptoolsBuildHook that comes with format="setuptools" directly.
|
|
|
|
# Instead, we override it to remove setuptools to avoid a circular dependency.
|
|
|
|
# The same is done for pip and the pipInstallHook.
|
|
|
|
format = "other";
|
|
|
|
|
|
|
|
src = sdist;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
bootstrapped-pip
|
|
|
|
(pipInstallHook.override{pip=null;})
|
|
|
|
(setuptoolsBuildHook.override{setuptools=null; wheel=null;})
|
|
|
|
];
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
preBuild = lib.optionalString (!stdenv.hostPlatform.isWindows) ''
|
2020-04-24 23:36:52 +00:00
|
|
|
export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
|
|
|
|
'';
|
|
|
|
|
|
|
|
pipInstallFlags = [ "--ignore-installed" ];
|
|
|
|
|
|
|
|
# Adds setuptools to nativeBuildInputs causing infinite recursion.
|
|
|
|
catchConflicts = false;
|
|
|
|
|
|
|
|
# Requires pytest, causing infinite recursion.
|
|
|
|
doCheck = false;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Utilities to facilitate the installation of Python packages";
|
|
|
|
homepage = "https://pypi.python.org/pypi/setuptools";
|
|
|
|
license = with licenses; [ psfl zpl20 ];
|
|
|
|
platforms = python.meta.platforms;
|
|
|
|
priority = 10;
|
2022-09-30 11:47:45 +00:00
|
|
|
maintainers = teams.python.members;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|