Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, buildPythonPackage 3, fetchFromGitHub 4, python 5, wrapPython 6, unzip 7, callPackage 8, bootstrapped-pip 9, lib 10, pipInstallHook 11, setuptoolsBuildHook 12}: 13 14let 15 pname = "setuptools"; 16 version = "44.0.0"; 17 18 # Create an sdist of setuptools 19 sdist = stdenv.mkDerivation rec { 20 name = "${pname}-${version}-sdist.tar.gz"; 21 22 src = fetchFromGitHub { 23 owner = "pypa"; 24 repo = pname; 25 rev = "v${version}"; 26 sha256 = "0z3q0qinyp1rmnxkw3y5f6nbsxhqlfq5k7skfrqa6ymb3zr009y1"; 27 name = "${pname}-${version}-source"; 28 }; 29 30 buildPhase = '' 31 ${python.pythonForBuild.interpreter} bootstrap.py 32 ${python.pythonForBuild.interpreter} setup.py sdist --formats=gztar 33 ''; 34 35 installPhase = '' 36 echo "Moving sdist..." 37 mv dist/*.tar.gz $out 38 ''; 39 }; 40in buildPythonPackage rec { 41 inherit pname version; 42 # Because of bootstrapping we don't use the setuptoolsBuildHook that comes with format="setuptools" directly. 43 # Instead, we override it to remove setuptools to avoid a circular dependency. 44 # The same is done for pip and the pipInstallHook. 45 format = "other"; 46 47 src = sdist; 48 49 nativeBuildInputs = [ 50 bootstrapped-pip 51 (pipInstallHook.override{pip=null;}) 52 (setuptoolsBuildHook.override{setuptools=null; wheel=null;}) 53 ]; 54 55 preBuild = lib.strings.optionalString (!stdenv.hostPlatform.isWindows) '' 56 export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0 57 ''; 58 59 pipInstallFlags = [ "--ignore-installed" ]; 60 61 # Adds setuptools to nativeBuildInputs causing infinite recursion. 62 catchConflicts = false; 63 64 # Requires pytest, causing infinite recursion. 65 doCheck = false; 66 67 meta = with stdenv.lib; { 68 description = "Utilities to facilitate the installation of Python packages"; 69 homepage = "https://pypi.python.org/pypi/setuptools"; 70 license = with licenses; [ psfl zpl20 ]; 71 platforms = python.meta.platforms; 72 priority = 10; 73 }; 74}