diff options
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/setuptools/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/setuptools/default.nix | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/setuptools/default.nix b/nixpkgs/pkgs/development/python-modules/setuptools/default.nix index 569ff017ea9b..f52a49313772 100644 --- a/nixpkgs/pkgs/development/python-modules/setuptools/default.nix +++ b/nixpkgs/pkgs/development/python-modules/setuptools/default.nix @@ -1,37 +1,63 @@ { stdenv , buildPythonPackage -, fetchPypi +, fetchFromGitHub , python , wrapPython , unzip , callPackage , bootstrapped-pip +, lib +, pipInstallHook +, setuptoolsBuildHook }: -buildPythonPackage rec { +let pname = "setuptools"; - version = "41.2.0"; - format = "other"; + version = "42.0.2"; + + # Create an sdist of setuptools + sdist = stdenv.mkDerivation rec { + name = "${pname}-${version}-sdist.tar.gz"; + + src = fetchFromGitHub { + owner = "pypa"; + repo = pname; + rev = "v${version}"; + sha256 = "1xqx3sha5ir40g1h15r7q063bcbl9bvh967vig574k3jgwxrz2ik"; + name = "${pname}-${version}-source"; + }; - src = fetchPypi { - inherit pname version; - extension = "zip"; - sha256 = "66b86bbae7cc7ac2e867f52dc08a6bd064d938bac59dfec71b9b565dd36d6012"; + buildPhase = '' + ${python.pythonForBuild.interpreter} bootstrap.py + ${python.pythonForBuild.interpreter} setup.py sdist --formats=gztar + ''; + + installPhase = '' + echo "Moving sdist..." + mv dist/*.tar.gz $out + ''; }; +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"; - # There is nothing to build - dontBuild = true; + src = sdist; - nativeBuildInputs = [ bootstrapped-pip ]; + nativeBuildInputs = [ + bootstrapped-pip + (pipInstallHook.override{pip=null;}) + (setuptoolsBuildHook.override{setuptools=null; wheel=null;}) + ]; - installPhase = '' - dst=$out/${python.sitePackages} - mkdir -p $dst - export PYTHONPATH="$dst:$PYTHONPATH" - ${python.pythonForBuild.interpreter} setup.py install --prefix=$out - wrapPythonPrograms + preBuild = lib.strings.optionalString (!stdenv.hostPlatform.isWindows) '' + export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0 ''; + pipInstallFlags = [ "--ignore-installed" ]; + # Adds setuptools to nativeBuildInputs causing infinite recursion. catchConflicts = false; |