BefatorNix/python-interpreters.nix
2025-08-18 13:48:00 +02:00

83 lines
2.4 KiB
Nix

{
nixpkgsPath,
bopenssl,
__splicedPackages,
callPackage,
fetchzip,
config,
db,
lib,
makeScopeWithSplicing',
pythonPackagesExtensions,
stdenv,
}@args:
(
let
pythonBase = nixpkgsPath + "/pkgs/development/interpreters/python";
# Common passthru for all Python interpreters.
passthruFun = import ./python26/passthrufun.nix (args // { inherit pythonBase; });
fixupString = s: lib.replaceString "2.7" "2.6" (lib.replaceString "2.7.1" "2.6.9" s);
pythonRaw = ((callPackage "${pythonBase}/cpython/2.7" {
# TODO: splicedPackages again
self = __splicedPackages.python26;
sourceVersion = {
major = "2";
minor = "6";
patch = "9";
suffix = ""; # ActiveState's Python 2 extended support
};
hash = "sha256-uxXpGJ5rGPb5x0bIg5yqyQmyLKrjIl0LZjgApzsfd3Q=";
inherit passthruFun;
}).override {
rebuildBytecode = false;
pythonAttr = "python26";
openssl = bopenssl;
packageOverrides = import ./python-overrides.nix;
#packageOverridesss = _: super: {
# setupTools = "lol";
#};
});
in {
python26 = pythonRaw.overrideAttrs (prev: {
patches = [
# Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff.
./python26/search-path.patch
# Python recompiles a Python if the mtime stored *in* the
# pyc/pyo file differs from the mtime of the source file. This
# doesn't work in Nix because Nix changes the mtime of files in
# the Nix store to 1. So treat that as a special case.
./python26/nix-store-mtime.patch
# http://bugs.python.org/issue10013
./python26/python2.6-fix-parallel-make.patch
];
postInstall = fixupString prev.postInstall;
preConfigure = lib.replaceString "${stdenv.cc.libc}/include/" "${stdenv.cc.libc.dev or stdenv.libc}/include/" prev.preConfigure;
});
pypy27 = callPackage ./pypy {
self = __splicedPackages.pypy27;
sourceVersion = {
major = "7";
minor = "3";
patch = "19";
};
hash = "sha256-hwPNywH5+Clm3UO2pgGPFAOZ21HrtDwSXB+aIV57sAM=";
pythonVersion = "2.7";
db = db.override { dbmSupport = !stdenv.hostPlatform.isDarwin; };
python = __splicedPackages.pythonInterpreters.pypy27_prebuilt;
inherit passthruFun;
};
}
// lib.optionalAttrs config.allowAliases {
pypy39_prebuilt = throw "pypy 3.9 has been removed, use pypy 3.10 instead"; # Added 2025-01-03
}
)