Skip to content

Commit

Permalink
python310Packages.setuptools: init at 50.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonringer committed Oct 13, 2020
1 parent 1472a71 commit 2564a07
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
74 changes: 74 additions & 0 deletions pkgs/development/python-modules/setuptools/50.3.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{ stdenv
, buildPythonPackage
, fetchFromGitHub
, python
, wrapPython
, unzip
, callPackage
, bootstrapped-pip
, lib
, pipInstallHook
, setuptoolsBuildHook
}:

let
pname = "setuptools";
version = "50.3.0";

# 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 = "0vsj6l8s7wrk7ily08fbqkixrig6sd6j86jwhq31hlkmllmmar60";
name = "${pname}-${version}-source";
};

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";

src = sdist;

nativeBuildInputs = [
bootstrapped-pip
(pipInstallHook.override{pip=null;})
(setuptoolsBuildHook.override{setuptools=null; wheel=null;})
];

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;

# Requires pytest, causing infinite recursion.
doCheck = false;

meta = with stdenv.lib; {
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;
};
}
4 changes: 3 additions & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let
packages = ( self:

let
inherit (python.passthru) isPy27 isPy35 isPy36 isPy37 isPy38 isPy39 isPy3k isPyPy pythonAtLeast pythonOlder;
inherit (python.passthru) isPy27 isPy35 isPy36 isPy37 isPy38 isPy39 isPy310 isPy3k isPyPy pythonAtLeast pythonOlder;

callPackage = pkgs.newScope self;

Expand Down Expand Up @@ -139,6 +139,8 @@ in {

setuptools = if isPy27 then
callPackage ../development/python-modules/setuptools/44.0.nix { }
else if isPy310 then
callPackage ../development/python-modules/setuptools/50.3.nix { }
else
callPackage ../development/python-modules/setuptools { };

Expand Down

0 comments on commit 2564a07

Please sign in to comment.