2020-09-25 04:45:31 +00:00
|
|
|
{ pkgs }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
with pkgs;
|
|
|
|
|
|
|
|
(let
|
|
|
|
|
|
|
|
# Common passthru for all Python interpreters.
|
|
|
|
passthruFun =
|
|
|
|
{ implementation
|
|
|
|
, libPrefix
|
|
|
|
, executable
|
|
|
|
, sourceVersion
|
|
|
|
, pythonVersion
|
|
|
|
, packageOverrides
|
|
|
|
, sitePackages
|
|
|
|
, hasDistutilsCxxPatch
|
2020-11-30 08:33:03 +00:00
|
|
|
, pythonOnBuildForBuild
|
|
|
|
, pythonOnBuildForHost
|
|
|
|
, pythonOnBuildForTarget
|
|
|
|
, pythonOnHostForHost
|
|
|
|
, pythonOnTargetForTarget
|
|
|
|
, self # is pythonOnHostForTarget
|
2020-04-24 23:36:52 +00:00
|
|
|
}: let
|
2020-11-21 19:51:51 +00:00
|
|
|
pythonPackages = callPackage
|
|
|
|
({ pkgs, stdenv, python, overrides }: let
|
|
|
|
pythonPackagesFun = import ../../../top-level/python-packages.nix {
|
2021-01-15 22:18:51 +00:00
|
|
|
inherit stdenv pkgs lib;
|
2020-11-21 19:51:51 +00:00
|
|
|
python = self;
|
|
|
|
};
|
|
|
|
otherSplices = {
|
2020-11-30 08:33:03 +00:00
|
|
|
selfBuildBuild = pythonOnBuildForBuild.pkgs;
|
|
|
|
selfBuildHost = pythonOnBuildForHost.pkgs;
|
|
|
|
selfBuildTarget = pythonOnBuildForTarget.pkgs;
|
|
|
|
selfHostHost = pythonOnHostForHost.pkgs;
|
|
|
|
selfTargetTarget = pythonOnTargetForTarget.pkgs or {}; # There is no Python TargetTarget.
|
2020-11-21 19:51:51 +00:00
|
|
|
};
|
|
|
|
keep = self: {
|
|
|
|
# TODO maybe only define these here so nothing is needed to be kept in sync.
|
|
|
|
inherit (self)
|
2021-12-06 16:07:01 +00:00
|
|
|
isPy27 isPy35 isPy36 isPy37 isPy38 isPy39 isPy310 isPy3k isPyPy pythonAtLeast pythonOlder
|
2020-11-21 19:51:51 +00:00
|
|
|
python bootstrapped-pip buildPythonPackage buildPythonApplication
|
|
|
|
fetchPypi
|
|
|
|
hasPythonModule requiredPythonModules makePythonPath disabledIf
|
|
|
|
toPythonModule toPythonApplication
|
|
|
|
buildSetupcfg
|
|
|
|
|
2021-05-29 03:34:57 +00:00
|
|
|
condaInstallHook
|
|
|
|
condaUnpackHook
|
2020-11-21 19:51:51 +00:00
|
|
|
eggUnpackHook
|
|
|
|
eggBuildHook
|
|
|
|
eggInstallHook
|
|
|
|
flitBuildHook
|
|
|
|
pipBuildHook
|
|
|
|
pipInstallHook
|
|
|
|
pytestCheckHook
|
|
|
|
pythonCatchConflictsHook
|
|
|
|
pythonImportsCheckHook
|
|
|
|
pythonNamespacesHook
|
|
|
|
pythonRecompileBytecodeHook
|
|
|
|
pythonRemoveBinBytecodeHook
|
|
|
|
pythonRemoveTestsDirHook
|
|
|
|
setuptoolsBuildHook
|
|
|
|
setuptoolsCheckHook
|
|
|
|
venvShellHook
|
|
|
|
wheelUnpackHook
|
|
|
|
|
|
|
|
wrapPython
|
|
|
|
|
|
|
|
pythonPackages
|
|
|
|
|
|
|
|
recursivePthLoader
|
|
|
|
;
|
|
|
|
};
|
2021-05-20 23:08:51 +00:00
|
|
|
extra = _: {};
|
2021-04-26 19:14:03 +00:00
|
|
|
optionalExtensions = cond: as: if cond then as else [];
|
|
|
|
python2Extension = import ../../../top-level/python2-packages.nix;
|
|
|
|
extensions = lib.composeManyExtensions ((optionalExtensions (!self.isPy3k) [python2Extension]) ++ [ overrides ]);
|
2022-04-15 01:41:22 +00:00
|
|
|
aliases = self: super: lib.optionalAttrs config.allowAliases (import ../../../top-level/python-aliases.nix lib self super);
|
2020-11-21 19:51:51 +00:00
|
|
|
in lib.makeScopeWithSplicing
|
|
|
|
pkgs.splicePackages
|
|
|
|
pkgs.newScope
|
|
|
|
otherSplices
|
|
|
|
keep
|
2021-05-20 23:08:51 +00:00
|
|
|
extra
|
2021-05-28 09:39:13 +00:00
|
|
|
(lib.extends (lib.composeExtensions aliases extensions) pythonPackagesFun))
|
2020-11-21 19:51:51 +00:00
|
|
|
{
|
|
|
|
overrides = packageOverrides;
|
2021-08-05 21:33:18 +00:00
|
|
|
python = self;
|
2020-11-21 19:51:51 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
in rec {
|
|
|
|
isPy27 = pythonVersion == "2.7";
|
|
|
|
isPy35 = pythonVersion == "3.5";
|
|
|
|
isPy36 = pythonVersion == "3.6";
|
|
|
|
isPy37 = pythonVersion == "3.7";
|
|
|
|
isPy38 = pythonVersion == "3.8";
|
|
|
|
isPy39 = pythonVersion == "3.9";
|
2020-10-19 23:25:03 +00:00
|
|
|
isPy310 = pythonVersion == "3.10";
|
2021-12-26 17:43:05 +00:00
|
|
|
isPy311 = pythonVersion == "3.11";
|
2020-04-24 23:36:52 +00:00
|
|
|
isPy2 = lib.strings.substring 0 1 pythonVersion == "2";
|
|
|
|
isPy3 = lib.strings.substring 0 1 pythonVersion == "3";
|
|
|
|
isPy3k = isPy3;
|
|
|
|
isPyPy = lib.hasInfix "pypy" interpreter;
|
|
|
|
|
|
|
|
buildEnv = callPackage ./wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
|
|
|
|
withPackages = import ./with-packages.nix { inherit buildEnv pythonPackages;};
|
|
|
|
pkgs = pythonPackages;
|
|
|
|
interpreter = "${self}/bin/${executable}";
|
|
|
|
inherit executable implementation libPrefix pythonVersion sitePackages;
|
|
|
|
inherit sourceVersion;
|
|
|
|
pythonAtLeast = lib.versionAtLeast pythonVersion;
|
|
|
|
pythonOlder = lib.versionOlder pythonVersion;
|
2020-11-30 08:33:03 +00:00
|
|
|
inherit hasDistutilsCxxPatch;
|
|
|
|
# TODO: rename to pythonOnBuild
|
|
|
|
# Not done immediately because its likely used outside Nixpkgs.
|
2020-12-03 08:41:04 +00:00
|
|
|
pythonForBuild = pythonOnBuildForHost.override { inherit packageOverrides; self = pythonForBuild; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
tests = callPackage ./tests.nix {
|
|
|
|
python = self;
|
|
|
|
};
|
|
|
|
};
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
sources = {
|
2021-07-21 07:28:18 +00:00
|
|
|
python39 = {
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "9";
|
2022-06-16 17:23:12 +00:00
|
|
|
patch = "13";
|
2021-07-21 07:28:18 +00:00
|
|
|
suffix = "";
|
|
|
|
};
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-ElsMWY8eFdKqZUBug/eS330XHN84wWgDsUmZQxajCA8=";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
python310 = {
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "10";
|
2022-04-27 09:35:20 +00:00
|
|
|
patch = "4";
|
2022-02-10 20:34:41 +00:00
|
|
|
suffix = "";
|
|
|
|
};
|
2022-04-27 09:35:20 +00:00
|
|
|
sha256 = "sha256-gL+SX1cdpDazUhCIbPefbrX6XWxXExa3NWg0NFH3ehk=";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
in {
|
|
|
|
|
|
|
|
python27 = callPackage ./cpython/2.7 {
|
|
|
|
self = python27;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "2";
|
|
|
|
minor = "7";
|
|
|
|
patch = "18";
|
|
|
|
suffix = "";
|
|
|
|
};
|
|
|
|
sha256 = "0hzgxl94hnflis0d6m4szjx0b52gah7wpmcg5g00q7am6xwhwb5n";
|
|
|
|
inherit (darwin) configd;
|
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
|
|
|
python37 = callPackage ./cpython {
|
|
|
|
self = python37;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "7";
|
2022-03-30 09:31:56 +00:00
|
|
|
patch = "13";
|
2020-04-24 23:36:52 +00:00
|
|
|
suffix = "";
|
|
|
|
};
|
2022-03-30 09:31:56 +00:00
|
|
|
sha256 = "sha256-mfEGJ134iZw+jLnXwBzmhsIC7ydZUzAUJxlGk95b74Q=";
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit (darwin) configd;
|
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
python38 = callPackage ./cpython {
|
2020-04-24 23:36:52 +00:00
|
|
|
self = python38;
|
2022-03-30 09:31:56 +00:00
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "8";
|
|
|
|
patch = "13";
|
|
|
|
suffix = "";
|
|
|
|
};
|
|
|
|
sha256 = "sha256-bzCQdwEgQKo5/o8MYduMD6HEUTZ2MpnTdcnldW8Jz1c=";
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit (darwin) configd;
|
|
|
|
inherit passthruFun;
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
python39 = callPackage ./cpython ({
|
2020-04-24 23:36:52 +00:00
|
|
|
self = python39;
|
|
|
|
inherit (darwin) configd;
|
|
|
|
inherit passthruFun;
|
2021-07-21 07:28:18 +00:00
|
|
|
} // sources.python39);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
python310 = callPackage ./cpython ({
|
2020-10-19 23:25:03 +00:00
|
|
|
self = python310;
|
|
|
|
inherit (darwin) configd;
|
|
|
|
inherit passthruFun;
|
2022-02-10 20:34:41 +00:00
|
|
|
} // sources.python310);
|
2020-10-19 23:25:03 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
python311 = callPackage ./cpython {
|
|
|
|
self = python311;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "11";
|
|
|
|
patch = "0";
|
2022-06-16 17:23:12 +00:00
|
|
|
suffix = "b3";
|
2021-12-26 17:43:05 +00:00
|
|
|
};
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-ybmfUxXqMPjp/LzmgHo3Oeh1SA0pEk5tmUD2+ry3yQI=";
|
2021-12-26 17:43:05 +00:00
|
|
|
inherit (darwin) configd;
|
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Minimal versions of Python (built without optional dependencies)
|
2021-04-05 15:23:46 +00:00
|
|
|
python3Minimal = (callPackage ./cpython ({
|
2020-04-24 23:36:52 +00:00
|
|
|
self = python3Minimal;
|
2021-04-05 15:23:46 +00:00
|
|
|
inherit passthruFun;
|
2021-03-09 03:18:52 +00:00
|
|
|
pythonAttr = "python3Minimal";
|
2020-04-24 23:36:52 +00:00
|
|
|
# strip down that python version as much as possible
|
|
|
|
openssl = null;
|
|
|
|
readline = null;
|
|
|
|
ncurses = null;
|
|
|
|
gdbm = null;
|
|
|
|
sqlite = null;
|
|
|
|
configd = null;
|
2021-04-05 15:23:46 +00:00
|
|
|
tzdata = null;
|
2022-01-26 04:04:25 +00:00
|
|
|
libffi = pkgs.libffiBoot; # without test suite
|
2020-04-24 23:36:52 +00:00
|
|
|
stripConfig = true;
|
|
|
|
stripIdlelib = true;
|
|
|
|
stripTests = true;
|
|
|
|
stripTkinter = true;
|
|
|
|
rebuildBytecode = false;
|
|
|
|
stripBytecode = true;
|
|
|
|
includeSiteCustomize = false;
|
2020-06-18 07:06:33 +00:00
|
|
|
enableOptimizations = false;
|
2021-07-21 07:28:18 +00:00
|
|
|
enableLTO = false;
|
2021-04-05 15:23:46 +00:00
|
|
|
mimetypesSupport = false;
|
2022-06-26 10:26:21 +00:00
|
|
|
} // sources.python310)).overrideAttrs(old: {
|
2022-06-16 17:23:12 +00:00
|
|
|
# TODO(@Artturin): Add this to the main cpython expr
|
|
|
|
strictDeps = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "python3-minimal";
|
|
|
|
});
|
|
|
|
|
|
|
|
pypy27 = callPackage ./pypy {
|
|
|
|
self = pypy27;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "7";
|
2020-08-20 17:08:02 +00:00
|
|
|
minor = "3";
|
2021-07-17 21:14:59 +00:00
|
|
|
patch = "5";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-07-17 21:14:59 +00:00
|
|
|
sha256 = "sha256-wERP2YcwWMHA2Z4TqTTpIoXLBZksmWi/Ujwyv5vsCp0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
pythonVersion = "2.7";
|
|
|
|
db = db.override { dbmSupport = !stdenv.isDarwin; };
|
|
|
|
python = python27;
|
|
|
|
inherit passthruFun;
|
|
|
|
inherit (darwin) libunwind;
|
|
|
|
inherit (darwin.apple_sdk.frameworks) Security;
|
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
pypy38 = callPackage ./pypy {
|
|
|
|
self = pypy38;
|
2020-04-24 23:36:52 +00:00
|
|
|
sourceVersion = {
|
|
|
|
major = "7";
|
2020-08-20 17:08:02 +00:00
|
|
|
minor = "3";
|
2021-12-06 16:07:01 +00:00
|
|
|
patch = "7";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-Ia4zn09QFtbKcwAwXz47VUNzg1yzw5qQQf4w5oEcgMY=";
|
|
|
|
pythonVersion = "3.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
db = db.override { dbmSupport = !stdenv.isDarwin; };
|
|
|
|
python = python27;
|
|
|
|
inherit passthruFun;
|
|
|
|
inherit (darwin) libunwind;
|
|
|
|
inherit (darwin.apple_sdk.frameworks) Security;
|
|
|
|
};
|
2021-12-24 04:21:11 +00:00
|
|
|
pypy37 = pypy38.override {
|
|
|
|
self = pythonInterpreters.pypy37;
|
|
|
|
pythonVersion = "3.7";
|
|
|
|
sha256 = "sha256-LtAqyecQhZxBvILer7CGGXkruaJ+6qFnbHQe3t0hTdc=";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
pypy27_prebuilt = callPackage ./pypy/prebuilt_2_7.nix {
|
2020-04-24 23:36:52 +00:00
|
|
|
# Not included at top-level
|
|
|
|
self = pythonInterpreters.pypy27_prebuilt;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "7";
|
2020-08-20 17:08:02 +00:00
|
|
|
minor = "3";
|
2022-03-30 09:31:56 +00:00
|
|
|
patch = "8";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-03-30 09:31:56 +00:00
|
|
|
sha256 = "0h493q0lhpz035afi4g09f4mz5a72vqx4sa7qcry5z4zagxq8bhz"; # linux64
|
2020-04-24 23:36:52 +00:00
|
|
|
pythonVersion = "2.7";
|
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
pypy38_prebuilt = callPackage ./pypy/prebuilt.nix {
|
2020-04-24 23:36:52 +00:00
|
|
|
# Not included at top-level
|
2022-01-19 23:45:15 +00:00
|
|
|
self = pythonInterpreters.pypy38_prebuilt;
|
2020-04-24 23:36:52 +00:00
|
|
|
sourceVersion = {
|
|
|
|
major = "7";
|
2020-08-20 17:08:02 +00:00
|
|
|
minor = "3";
|
2022-01-19 23:45:15 +00:00
|
|
|
patch = "7";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-01-19 23:45:15 +00:00
|
|
|
sha256 = "sha256-Xe43x8PLixYAKPveOlkBxoBD36VFoWeUUCuJfUvEDX4="; # linux64
|
|
|
|
pythonVersion = "3.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
rustpython = callPackage ./rustpython/default.nix {
|
|
|
|
inherit (darwin.apple_sdk.frameworks) SystemConfiguration;
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|