forked from mirrors/nixpkgs
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
84 lines
2.2 KiB
Nix
84 lines
2.2 KiB
Nix
{ stdenv
|
|
, buildPythonPackage
|
|
, fetchFromGitHub
|
|
, python
|
|
, wrapPython
|
|
, unzip
|
|
, callPackage
|
|
, bootstrapped-pip
|
|
, lib
|
|
, pipInstallHook
|
|
, setuptoolsBuildHook
|
|
}:
|
|
|
|
let
|
|
pname = "setuptools";
|
|
version = "50.3.1";
|
|
|
|
# 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 = "Z4KHB3Pv4wZPou/Vbp1DFDgDp47OTDfVChGP55GtIJE=";
|
|
name = "${pname}-${version}-source";
|
|
};
|
|
|
|
patches = [
|
|
./tag-date.patch
|
|
];
|
|
|
|
buildPhase = ''
|
|
${python.pythonForBuild.interpreter} bootstrap.py
|
|
${python.pythonForBuild.interpreter} setup.py sdist --formats=gztar
|
|
|
|
# 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/
|
|
tar -czf dist/${name} -C dist/ --mtime="@$SOURCE_DATE_EPOCH" --sort=name ${pname}-${version}.post0
|
|
'';
|
|
|
|
installPhase = ''
|
|
echo "Moving sdist..."
|
|
mv dist/${name} $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 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;
|
|
};
|
|
}
|