python2: move cpython, mkPythonDerivation into resholve

This commit is contained in:
Aliaksandr
2026-05-03 23:24:23 +03:00
parent c510450a30
commit e6871d9800
31 changed files with 32 additions and 28 deletions
@@ -8,36 +8,24 @@ let
pythonDocs = {
html = {
recurseForDerivations = true;
python27 = import ./2.7-html.nix {
inherit stdenv fetchurl lib;
};
python310 = import ./3.10-html.nix {
inherit stdenv fetchurl lib;
};
};
pdf_a4 = {
recurseForDerivations = true;
python27 = import ./2.7-pdf-a4.nix {
inherit stdenv fetchurl lib;
};
python310 = import ./3.10-pdf-a4.nix {
inherit stdenv fetchurl lib;
};
};
pdf_letter = {
recurseForDerivations = true;
python27 = import ./2.7-pdf-letter.nix {
inherit stdenv fetchurl lib;
};
python310 = import ./3.10-pdf-letter.nix {
inherit stdenv fetchurl lib;
};
};
text = {
recurseForDerivations = true;
python27 = import ./2.7-text.nix {
inherit stdenv fetchurl lib;
};
python310 = import ./3.10-text.nix {
inherit stdenv fetchurl lib;
};
@@ -30,18 +30,6 @@
in
{
python27 = callPackage ./cpython/2.7 {
self = __splicedPackages.python27;
sourceVersion = {
major = "2";
minor = "7";
patch = "18";
suffix = ".12"; # ActiveState's Python 2 extended support
};
hash = "sha256-RuEgfpags9wJm9Xe0daotqUx4knABEUc7DvtgnQXEfE=";
inherit passthruFun;
};
python311 = callPackage ./cpython {
self = __splicedPackages.python311;
sourceVersion = {
@@ -102,7 +102,11 @@ let
);
mkPythonDerivation =
if python.isPy3k then ./mk-python-derivation.nix else ./python2/mk-python-derivation.nix;
if python.isPy3k then
./mk-python-derivation.nix
else
# Python 2 build infrastructure lives with its only consumers (resholve, pypy27).
../../misc/resholve/python2/mk-python-derivation.nix;
buildPythonPackage = makeOverridablePythonPackage (
overrideStdenvCompat (
@@ -146,7 +146,7 @@ let
# It does break aarch64-darwin, which we do support. See:
# * https://bugs.python.org/issue35523
# * https://github.com/python/cpython/commit/e6b247c8e524
../3.7/no-win64-workaround.patch
./no-win64-workaround.patch
# fix openssl detection by reverting irrelevant change for us, to enable hashlib which is required by pip
(fetchpatch {
@@ -378,7 +378,7 @@ stdenv.mkDerivation (
postFixup = ''
# Include a sitecustomize.py file. Note it causes an error when it's in postInstall with 2.7.
cp ${../../sitecustomize.py} $out/${sitePackages}/sitecustomize.py
cp ${../../../interpreters/python/sitecustomize.py} $out/${sitePackages}/sitecustomize.py
''
+ lib.optionalString strip2to3 ''
rm -R $out/bin/2to3 $out/lib/python*/lib2to3
+25 -1
View File
@@ -11,9 +11,33 @@ let
knownVulnerabilities = [ ];
};
});
passthruFun = import ../../interpreters/python/passthrufun.nix {
inherit lib;
inherit (pkgsBuildHost)
stdenv
callPackage
pythonPackagesExtensions
config
makeScopeWithSplicing'
;
};
python27Base = pkgsBuildHost.callPackage ./cpython-2.7 {
self = python27;
sourceVersion = {
major = "2";
minor = "7";
patch = "18";
suffix = ".12"; # ActiveState's Python 2 extended support
};
hash = "sha256-RuEgfpags9wJm9Xe0daotqUx4knABEUc7DvtgnQXEfE=";
inherit passthruFun;
};
# We are removing `meta.knownVulnerabilities` from `python27`,
# and setting it in `resholve` itself.
python27 = (removeKnownVulnerabilities pkgsBuildHost.pythonInterpreters.python27).override {
python27 = (removeKnownVulnerabilities python27Base).override {
self = python27;
pkgsBuildHost = pkgsBuildHost // {
inherit python27;