about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJonathan Ringer <jonringer117@gmail.com>2020-02-28 11:41:51 -0800
committerJon <jonringer@users.noreply.github.com>2020-03-01 21:29:28 -0800
commitc3c47544e06cc028f1a9b590e7e16edddce8b2ee (patch)
treeda71233e20703b4d8a8727d6a110529bb10b6423
parent6181bfc353e32e4c8c3db1a1998a85f78a5ae8f1 (diff)
downloadnixlib-c3c47544e06cc028f1a9b590e7e16edddce8b2ee.tar
nixlib-c3c47544e06cc028f1a9b590e7e16edddce8b2ee.tar.gz
nixlib-c3c47544e06cc028f1a9b590e7e16edddce8b2ee.tar.bz2
nixlib-c3c47544e06cc028f1a9b590e7e16edddce8b2ee.tar.lz
nixlib-c3c47544e06cc028f1a9b590e7e16edddce8b2ee.tar.xz
nixlib-c3c47544e06cc028f1a9b590e7e16edddce8b2ee.tar.zst
nixlib-c3c47544e06cc028f1a9b590e7e16edddce8b2ee.zip
python2Packages.setuptools: freeze at 44.0.0
-rw-r--r--pkgs/development/python-modules/setuptools/44.0.nix74
-rw-r--r--pkgs/top-level/python-packages.nix5
2 files changed, 78 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/setuptools/44.0.nix b/pkgs/development/python-modules/setuptools/44.0.nix
new file mode 100644
index 000000000000..194b90cb42ad
--- /dev/null
+++ b/pkgs/development/python-modules/setuptools/44.0.nix
@@ -0,0 +1,74 @@
+{ stdenv
+, buildPythonPackage
+, fetchFromGitHub
+, python
+, wrapPython
+, unzip
+, callPackage
+, bootstrapped-pip
+, lib
+, pipInstallHook
+, setuptoolsBuildHook
+}:
+
+let
+  pname = "setuptools";
+  version = "44.0.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 = "0z3q0qinyp1rmnxkw3y5f6nbsxhqlfq5k7skfrqa6ymb3zr009y1";
+      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;
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 53b7eba5f30c..1ce9b7627a93 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -121,7 +121,10 @@ in {
 
   recursivePthLoader = callPackage ../development/python-modules/recursive-pth-loader { };
 
-  setuptools = callPackage ../development/python-modules/setuptools { };
+  setuptools = if isPy27 then
+    callPackage ../development/python-modules/setuptools/44.0.nix { }
+  else
+    callPackage ../development/python-modules/setuptools { };
 
   vowpalwabbit = callPackage ../development/python-modules/vowpalwabbit { };