This commit is contained in:
Some One 2025-08-13 21:09:49 +02:00
parent df07954f74
commit eee740aff9
5 changed files with 84 additions and 35 deletions

View File

@ -13,18 +13,14 @@ pipInstallPhase() {
local -a flagsArray=(
--no-index
--no-warn-script-location
--prefix="$out"
--no-cache
)
concatTo flagsArray pipInstallFlags
echo "Lolol"
pushd dist || return 1
echoCmd 'pip install flags' "${flagsArray[@]}"
# @pythonInterpreter@ -m pip install ./*.whl "${flagsArray[@]}"
@pip@ install ./*.whl "${flagsArray[@]}"
pip install ./*.whl "${flagsArray[@]}"
popd || return 1
runHook postInstall

View File

@ -5,6 +5,10 @@ let
in
with self;
with super;
let
pythonInterpreter = python.pythonOnBuildForHost.interpreter;
pythonSitePackages = python.sitePackages;
in
rec {
bootstrapped-pip = toPythonModule (callPackage ./python26/bootstrapped-pip.nix {});

View File

@ -10,7 +10,7 @@
buildPythonPackage rec {
pname = "wheel";
version = "0.29.0";
format = "setuptools";
format = "other";
#src = fetchPypi {
# inherit pname version;
@ -25,16 +25,16 @@ buildPythonPackage rec {
};
#buildInputs = [ pytest pytestcov coverage ];
#nativeBuildInputs = [ bootstrapped-pip setuptools ];
nativeBuildInputs = [ bootstrapped-pip setuptools ];
#catchConflicts = false;
#doCheck = false;
doCheck = false;
#pythonImportsCheck = [ "wheel" ];
# We add this flag to ignore the copy installed by bootstrapped-pip
installFlags = [ "--ignore-installed" ];
pipInstallFlags = [ "--ignore-installed" ];
meta = {
description = "A built-package format for Python";

2
result
View File

@ -1 +1 @@
/nix/store/b5d52gx1g9lwihsqgkdgm606nb1hni57-python2.6-wheel-0.29.0
/nix/store/qr2d62ybl4vm30hdn5bzxm0387hq95ik-python2.6-wheel-0.29.0

View File

@ -1,40 +1,89 @@
{ lib,
stdenv
, fetchPypi
, python
, wrapPython
, unzip
{
pkgs,
stdenv,
buildPythonPackage,
fetchFromGitHub,
python,
bootstrapped-pip,
lib,
pipInstallHookMine,
setuptoolsBuildHook,
}:
# Should use buildPythonPackage here somehow
stdenv.mkDerivation rec {
let
pname = "setuptools";
version = "36.8.0";
name = "${python.libPrefix}-${pname}-${version}";
src = fetchPypi {
inherit pname version;
extension = "zip";
hash = "sha256-sqpaAOnk/SDzw91BLUkJIXRu/hS9o01TlzxKWasFs10=";
# Create an sdist of setuptools
sdist = stdenv.mkDerivation rec {
name = "${pname}-${version}-sdist.tar.gz";
src = fetchFromGitHub {
owner = "pypa";
repo = pname;
rev = "v${version}";
hash = "sha256-S9drUN5W1fA9zEC2tGUi15Mnn9ZkKOxEUAlJrlJjcR8=";
name = "${pname}-${version}-source";
};
patches = [
(pkgs.path + "/pkgs/development/python2-modules/setuptools//tag-date.patch")
];
buildPhase = ''
${python.pythonOnBuildForHost.interpreter} bootstrap.py
${python.pythonOnBuildForHost.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" ${pname}-${version}.post0
'';
installPhase = ''
echo "Moving sdist..."
mv dist/${name} $out
'';
};
in
buildPythonPackage {
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";
buildInputs = [ python wrapPython unzip ];
doCheck = false; # requires pytest
installPhase = ''
dst=$out/${python.sitePackages}
mkdir -p $dst
export PYTHONPATH="$dst:$PYTHONPATH"
${python.interpreter} setup.py install --prefix=$out
wrapPythonPrograms
src = sdist;
nativeBuildInputs = [
bootstrapped-pip
(pipInstallHookMine.override { pip = null; })
(setuptoolsBuildHook.override {
setuptools = null;
wheel = null;
})
];
preBuild = lib.optionalString (!stdenv.hostPlatform.isWindows) ''
export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
'';
pythonPath = [];
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 = http://pypi.python.org/pypi/setuptools;
license = with licenses; [ psfl zpl20 ];
platforms = platforms.all;
homepage = "https://pypi.python.org/pypi/setuptools";
license = with licenses; [
psfl
zpl20
];
platforms = python.meta.platforms;
priority = 10;
};
}