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=( local -a flagsArray=(
--no-index --no-index
--no-warn-script-location
--prefix="$out" --prefix="$out"
--no-cache --no-cache
) )
concatTo flagsArray pipInstallFlags concatTo flagsArray pipInstallFlags
echo "Lolol"
pushd dist || return 1 pushd dist || return 1
echoCmd 'pip install flags' "${flagsArray[@]}" echoCmd 'pip install flags' "${flagsArray[@]}"
# @pythonInterpreter@ -m pip install ./*.whl "${flagsArray[@]}" pip install ./*.whl "${flagsArray[@]}"
@pip@ install ./*.whl "${flagsArray[@]}"
popd || return 1 popd || return 1
runHook postInstall runHook postInstall

View File

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

View File

@ -10,7 +10,7 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "wheel"; pname = "wheel";
version = "0.29.0"; version = "0.29.0";
format = "setuptools"; format = "other";
#src = fetchPypi { #src = fetchPypi {
# inherit pname version; # inherit pname version;
@ -25,16 +25,16 @@ buildPythonPackage rec {
}; };
#buildInputs = [ pytest pytestcov coverage ]; #buildInputs = [ pytest pytestcov coverage ];
#nativeBuildInputs = [ bootstrapped-pip setuptools ]; nativeBuildInputs = [ bootstrapped-pip setuptools ];
#catchConflicts = false; #catchConflicts = false;
#doCheck = false; doCheck = false;
#pythonImportsCheck = [ "wheel" ]; #pythonImportsCheck = [ "wheel" ];
# We add this flag to ignore the copy installed by bootstrapped-pip # We add this flag to ignore the copy installed by bootstrapped-pip
installFlags = [ "--ignore-installed" ]; pipInstallFlags = [ "--ignore-installed" ];
meta = { meta = {
description = "A built-package format for Python"; 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 pkgs,
, fetchPypi stdenv,
, python buildPythonPackage,
, wrapPython fetchFromGitHub,
, unzip python,
bootstrapped-pip,
lib,
pipInstallHookMine,
setuptoolsBuildHook,
}: }:
# Should use buildPythonPackage here somehow let
stdenv.mkDerivation rec {
pname = "setuptools"; pname = "setuptools";
version = "36.8.0"; version = "36.8.0";
name = "${python.libPrefix}-${pname}-${version}";
src = fetchPypi { # Create an sdist of setuptools
inherit pname version; sdist = stdenv.mkDerivation rec {
extension = "zip"; name = "${pname}-${version}-sdist.tar.gz";
hash = "sha256-sqpaAOnk/SDzw91BLUkJIXRu/hS9o01TlzxKWasFs10=";
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 ]; src = sdist;
doCheck = false; # requires pytest
installPhase = '' nativeBuildInputs = [
dst=$out/${python.sitePackages} bootstrapped-pip
mkdir -p $dst (pipInstallHookMine.override { pip = null; })
export PYTHONPATH="$dst:$PYTHONPATH" (setuptoolsBuildHook.override {
${python.interpreter} setup.py install --prefix=$out setuptools = null;
wrapPythonPrograms 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; { meta = with lib; {
description = "Utilities to facilitate the installation of Python packages"; description = "Utilities to facilitate the installation of Python packages";
homepage = http://pypi.python.org/pypi/setuptools; homepage = "https://pypi.python.org/pypi/setuptools";
license = with licenses; [ psfl zpl20 ]; license = with licenses; [
platforms = platforms.all; psfl
zpl20
];
platforms = python.meta.platforms;
priority = 10; priority = 10;
}; };
} }