2020-09-17 22:45:31 +00:00
|
|
|
{ pkgs }:
|
2018-12-31 12:59:20 +00:00
|
|
|
|
|
|
|
with pkgs;
|
|
|
|
|
|
|
|
(let
|
|
|
|
|
|
|
|
# Common passthru for all Python interpreters.
|
|
|
|
passthruFun =
|
|
|
|
{ implementation
|
|
|
|
, libPrefix
|
|
|
|
, executable
|
|
|
|
, sourceVersion
|
|
|
|
, pythonVersion
|
|
|
|
, packageOverrides
|
|
|
|
, sitePackages
|
2019-04-18 02:57:20 +00:00
|
|
|
, hasDistutilsCxxPatch
|
2020-11-28 15:56:51 +00:00
|
|
|
, pythonOnBuildForBuild
|
|
|
|
, pythonOnBuildForHost
|
|
|
|
, pythonOnBuildForTarget
|
|
|
|
, pythonOnHostForHost
|
|
|
|
, pythonOnTargetForTarget
|
|
|
|
, self # is pythonOnHostForTarget
|
2018-12-31 12:59:20 +00:00
|
|
|
}: let
|
2020-11-18 17:13:11 +00:00
|
|
|
pythonPackages = callPackage
|
|
|
|
({ pkgs, stdenv, python, overrides }: let
|
|
|
|
pythonPackagesFun = import ../../../top-level/python-packages.nix {
|
2021-01-10 11:03:59 +00:00
|
|
|
inherit stdenv pkgs lib;
|
2020-11-18 17:13:11 +00:00
|
|
|
python = self;
|
|
|
|
};
|
|
|
|
otherSplices = {
|
2020-11-28 16:06:08 +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-18 17:13:11 +00:00
|
|
|
};
|
|
|
|
keep = self: {
|
|
|
|
# TODO maybe only define these here so nothing is needed to be kept in sync.
|
|
|
|
inherit (self)
|
|
|
|
isPy27 isPy35 isPy36 isPy37 isPy38 isPy39 isPy3k isPyPy pythonAtLeast pythonOlder
|
|
|
|
python bootstrapped-pip buildPythonPackage buildPythonApplication
|
|
|
|
fetchPypi
|
|
|
|
hasPythonModule requiredPythonModules makePythonPath disabledIf
|
|
|
|
toPythonModule toPythonApplication
|
|
|
|
buildSetupcfg
|
|
|
|
|
|
|
|
eggUnpackHook
|
|
|
|
eggBuildHook
|
|
|
|
eggInstallHook
|
|
|
|
flitBuildHook
|
|
|
|
pipBuildHook
|
|
|
|
pipInstallHook
|
|
|
|
pytestCheckHook
|
|
|
|
pythonCatchConflictsHook
|
|
|
|
pythonImportsCheckHook
|
|
|
|
pythonNamespacesHook
|
|
|
|
pythonRecompileBytecodeHook
|
|
|
|
pythonRemoveBinBytecodeHook
|
|
|
|
pythonRemoveTestsDirHook
|
|
|
|
setuptoolsBuildHook
|
|
|
|
setuptoolsCheckHook
|
|
|
|
venvShellHook
|
|
|
|
wheelUnpackHook
|
|
|
|
|
|
|
|
wrapPython
|
|
|
|
|
|
|
|
pythonPackages
|
|
|
|
|
|
|
|
recursivePthLoader
|
|
|
|
;
|
|
|
|
};
|
2021-03-24 11:12:48 +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 ]);
|
2020-11-18 17:13:11 +00:00
|
|
|
in lib.makeScopeWithSplicing
|
|
|
|
pkgs.splicePackages
|
|
|
|
pkgs.newScope
|
|
|
|
otherSplices
|
|
|
|
keep
|
2021-03-24 11:12:48 +00:00
|
|
|
(lib.extends extensions pythonPackagesFun))
|
2020-11-18 17:13:11 +00:00
|
|
|
{
|
|
|
|
overrides = packageOverrides;
|
|
|
|
};
|
2018-12-31 12:59:20 +00:00
|
|
|
in rec {
|
|
|
|
isPy27 = pythonVersion == "2.7";
|
|
|
|
isPy35 = pythonVersion == "3.5";
|
|
|
|
isPy36 = pythonVersion == "3.6";
|
|
|
|
isPy37 = pythonVersion == "3.7";
|
2019-10-15 04:49:46 +00:00
|
|
|
isPy38 = pythonVersion == "3.8";
|
2019-11-20 08:42:27 +00:00
|
|
|
isPy39 = pythonVersion == "3.9";
|
2020-10-13 06:28:25 +00:00
|
|
|
isPy310 = pythonVersion == "3.10";
|
2019-01-04 11:31:42 +00:00
|
|
|
isPy2 = lib.strings.substring 0 1 pythonVersion == "2";
|
|
|
|
isPy3 = lib.strings.substring 0 1 pythonVersion == "3";
|
|
|
|
isPy3k = isPy3;
|
2019-02-04 08:09:38 +00:00
|
|
|
isPyPy = lib.hasInfix "pypy" interpreter;
|
2018-12-31 12:59:20 +00:00
|
|
|
|
|
|
|
buildEnv = callPackage ./wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
|
|
|
|
withPackages = import ./with-packages.nix { inherit buildEnv pythonPackages;};
|
|
|
|
pkgs = pythonPackages;
|
|
|
|
interpreter = "${self}/bin/${executable}";
|
2019-01-02 19:09:44 +00:00
|
|
|
inherit executable implementation libPrefix pythonVersion sitePackages;
|
2018-12-31 12:59:20 +00:00
|
|
|
inherit sourceVersion;
|
|
|
|
pythonAtLeast = lib.versionAtLeast pythonVersion;
|
|
|
|
pythonOlder = lib.versionOlder pythonVersion;
|
2020-11-27 15:24:42 +00:00
|
|
|
inherit hasDistutilsCxxPatch;
|
2020-11-28 16:33:28 +00:00
|
|
|
# TODO: rename to pythonOnBuild
|
|
|
|
# Not done immediately because its likely used outside Nixpkgs.
|
2020-11-30 10:12:59 +00:00
|
|
|
pythonForBuild = pythonOnBuildForHost.override { inherit packageOverrides; self = pythonForBuild; };
|
2020-03-14 08:48:06 +00:00
|
|
|
|
|
|
|
tests = callPackage ./tests.nix {
|
|
|
|
python = self;
|
|
|
|
};
|
2018-12-31 12:59:20 +00:00
|
|
|
};
|
2021-03-14 14:43:38 +00:00
|
|
|
|
|
|
|
sources = {
|
|
|
|
"python38" = {
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "8";
|
2021-04-03 07:25:45 +00:00
|
|
|
patch = "9";
|
2021-03-14 14:43:38 +00:00
|
|
|
suffix = "";
|
|
|
|
};
|
2021-04-03 07:25:45 +00:00
|
|
|
sha256 = "XjkfPsRdopVEGcqwvq79i+OIlepc4zV3w+wUlAxLlXI=";
|
2021-03-14 14:43:38 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-12-02 19:10:51 +00:00
|
|
|
in {
|
2018-12-31 12:59:20 +00:00
|
|
|
|
|
|
|
python27 = callPackage ./cpython/2.7 {
|
|
|
|
self = python27;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "2";
|
|
|
|
minor = "7";
|
2020-04-21 06:30:23 +00:00
|
|
|
patch = "18";
|
2018-12-31 12:59:20 +00:00
|
|
|
suffix = "";
|
|
|
|
};
|
2020-04-21 06:30:23 +00:00
|
|
|
sha256 = "0hzgxl94hnflis0d6m4szjx0b52gah7wpmcg5g00q7am6xwhwb5n";
|
2020-01-12 20:29:45 +00:00
|
|
|
inherit (darwin) configd;
|
2018-12-31 12:59:20 +00:00
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
|
|
|
python36 = callPackage ./cpython {
|
|
|
|
self = python36;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "6";
|
2021-02-20 08:28:44 +00:00
|
|
|
patch = "13";
|
2018-12-31 12:59:20 +00:00
|
|
|
suffix = "";
|
|
|
|
};
|
2021-02-20 08:28:44 +00:00
|
|
|
sha256 = "pHpDpTq7QihqLBGWU0P/VnEbnmTo0RvyxnAaT7jOGg8=";
|
2020-01-12 20:29:45 +00:00
|
|
|
inherit (darwin) configd;
|
2018-12-31 12:59:20 +00:00
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
|
|
|
python37 = callPackage ./cpython {
|
|
|
|
self = python37;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "7";
|
2021-02-20 07:42:24 +00:00
|
|
|
patch = "10";
|
2018-12-31 12:59:20 +00:00
|
|
|
suffix = "";
|
|
|
|
};
|
2021-02-20 07:42:24 +00:00
|
|
|
sha256 = "+NgudXLIbsnVXIYnquUEAST9IgOvQAw4PIIbmAMG7ms=";
|
2020-01-12 20:29:45 +00:00
|
|
|
inherit (darwin) configd;
|
2018-12-31 12:59:20 +00:00
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2021-03-14 14:43:38 +00:00
|
|
|
python38 = callPackage ./cpython ({
|
2019-07-09 13:19:19 +00:00
|
|
|
self = python38;
|
2020-01-12 20:29:45 +00:00
|
|
|
inherit (darwin) configd;
|
2019-07-09 13:19:19 +00:00
|
|
|
inherit passthruFun;
|
2021-03-14 14:43:38 +00:00
|
|
|
} // sources.python38);
|
2019-07-09 13:19:19 +00:00
|
|
|
|
2019-11-20 08:42:27 +00:00
|
|
|
python39 = callPackage ./cpython {
|
|
|
|
self = python39;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "9";
|
2021-04-05 08:54:26 +00:00
|
|
|
patch = "4";
|
2020-10-05 22:15:32 +00:00
|
|
|
suffix = "";
|
2019-11-20 08:42:27 +00:00
|
|
|
};
|
2021-04-05 08:54:26 +00:00
|
|
|
sha256 = "Sw5mRKdvjfhkriSsUApRu/aL0Jj2oXPifTthzcqaoTQ=";
|
2020-01-12 20:29:45 +00:00
|
|
|
inherit (darwin) configd;
|
2019-11-20 08:42:27 +00:00
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2020-10-13 06:28:25 +00:00
|
|
|
python310 = callPackage ./cpython {
|
|
|
|
self = python310;
|
|
|
|
sourceVersion = {
|
|
|
|
major = "3";
|
|
|
|
minor = "10";
|
|
|
|
patch = "0";
|
2021-02-20 08:28:59 +00:00
|
|
|
suffix = "a5";
|
2020-10-13 06:28:25 +00:00
|
|
|
};
|
2021-02-20 08:28:59 +00:00
|
|
|
sha256 = "BBjlfnA24hnx5rYwOyHnEfZM/Q/dsIlNjxnzev/8XU0=";
|
2020-10-13 06:28:25 +00:00
|
|
|
inherit (darwin) configd;
|
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2019-08-17 15:33:13 +00:00
|
|
|
# Minimal versions of Python (built without optional dependencies)
|
2021-03-14 14:43:38 +00:00
|
|
|
python3Minimal = (callPackage ./cpython ({
|
2019-08-17 15:33:13 +00:00
|
|
|
self = python3Minimal;
|
2021-03-14 14:43:38 +00:00
|
|
|
inherit passthruFun;
|
2021-02-27 07:55:38 +00:00
|
|
|
pythonAttr = "python3Minimal";
|
2019-08-17 15:33:13 +00:00
|
|
|
# strip down that python version as much as possible
|
|
|
|
openssl = null;
|
|
|
|
readline = null;
|
|
|
|
ncurses = null;
|
|
|
|
gdbm = null;
|
|
|
|
sqlite = null;
|
2020-01-12 20:29:45 +00:00
|
|
|
configd = null;
|
2020-11-16 20:34:33 +00:00
|
|
|
tzdata = null;
|
2019-08-17 15:33:13 +00:00
|
|
|
stripConfig = true;
|
|
|
|
stripIdlelib = true;
|
|
|
|
stripTests = true;
|
|
|
|
stripTkinter = true;
|
|
|
|
rebuildBytecode = false;
|
|
|
|
stripBytecode = true;
|
2020-03-12 13:15:02 +00:00
|
|
|
includeSiteCustomize = false;
|
2020-06-04 16:37:59 +00:00
|
|
|
enableOptimizations = false;
|
2021-03-14 12:00:44 +00:00
|
|
|
mimetypesSupport = false;
|
2021-03-14 14:43:38 +00:00
|
|
|
} // sources.python38)).overrideAttrs(old: {
|
2019-08-17 15:33:13 +00:00
|
|
|
pname = "python3-minimal";
|
|
|
|
meta = old.meta // {
|
|
|
|
maintainers = [];
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2019-01-01 10:34:44 +00:00
|
|
|
pypy27 = callPackage ./pypy {
|
|
|
|
self = pypy27;
|
|
|
|
sourceVersion = {
|
2019-02-12 01:52:26 +00:00
|
|
|
major = "7";
|
2020-08-10 20:34:00 +00:00
|
|
|
minor = "3";
|
2021-02-14 17:49:59 +00:00
|
|
|
patch = "3";
|
2019-01-01 10:34:44 +00:00
|
|
|
};
|
2021-02-14 17:49:59 +00:00
|
|
|
sha256 = "0di3dr5ry4r0hwxh4fbqjhyl5im948wdby0bhijzsxx83c2qhd7n";
|
2019-01-01 10:34:44 +00:00
|
|
|
pythonVersion = "2.7";
|
2019-10-26 09:20:00 +00:00
|
|
|
db = db.override { dbmSupport = !stdenv.isDarwin; };
|
2019-01-01 10:34:44 +00:00
|
|
|
python = python27;
|
|
|
|
inherit passthruFun;
|
2019-10-26 09:20:00 +00:00
|
|
|
inherit (darwin) libunwind;
|
|
|
|
inherit (darwin.apple_sdk.frameworks) Security;
|
2019-01-01 10:34:44 +00:00
|
|
|
};
|
|
|
|
|
2019-08-13 01:52:26 +00:00
|
|
|
pypy36 = callPackage ./pypy {
|
|
|
|
self = pypy36;
|
2019-01-01 10:34:44 +00:00
|
|
|
sourceVersion = {
|
2019-02-12 01:52:26 +00:00
|
|
|
major = "7";
|
2020-08-10 20:34:00 +00:00
|
|
|
minor = "3";
|
2021-02-14 17:49:59 +00:00
|
|
|
patch = "3";
|
2019-01-01 10:34:44 +00:00
|
|
|
};
|
2021-02-14 17:49:59 +00:00
|
|
|
sha256 = "1bq5i2mqgjjfc4rhxgxm6ihwa76vn2qapd7l59ri7xp01p522gd2";
|
2019-08-13 01:52:26 +00:00
|
|
|
pythonVersion = "3.6";
|
2019-10-26 09:20:00 +00:00
|
|
|
db = db.override { dbmSupport = !stdenv.isDarwin; };
|
2019-01-01 10:34:44 +00:00
|
|
|
python = python27;
|
|
|
|
inherit passthruFun;
|
2019-10-26 09:20:00 +00:00
|
|
|
inherit (darwin) libunwind;
|
|
|
|
inherit (darwin.apple_sdk.frameworks) Security;
|
2019-01-01 10:34:44 +00:00
|
|
|
};
|
2018-12-31 12:59:20 +00:00
|
|
|
|
2019-01-03 11:00:44 +00:00
|
|
|
pypy27_prebuilt = callPackage ./pypy/prebuilt.nix {
|
|
|
|
# Not included at top-level
|
|
|
|
self = pythonInterpreters.pypy27_prebuilt;
|
|
|
|
sourceVersion = {
|
2019-08-12 11:52:14 +00:00
|
|
|
major = "7";
|
2020-08-10 08:23:15 +00:00
|
|
|
minor = "3";
|
2021-02-14 17:49:59 +00:00
|
|
|
patch = "3";
|
2019-01-03 11:00:44 +00:00
|
|
|
};
|
2021-02-14 17:49:59 +00:00
|
|
|
sha256 = "1cfpdyvbvzwc0ynjr7248jhwgcpl7073wlp7w3g2v4fnrh1bc4pl"; # linux64
|
2019-01-03 11:00:44 +00:00
|
|
|
pythonVersion = "2.7";
|
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2019-08-12 11:52:14 +00:00
|
|
|
pypy36_prebuilt = callPackage ./pypy/prebuilt.nix {
|
|
|
|
# Not included at top-level
|
|
|
|
self = pythonInterpreters.pypy36_prebuilt;
|
2019-01-03 11:00:44 +00:00
|
|
|
sourceVersion = {
|
2019-08-12 11:52:14 +00:00
|
|
|
major = "7";
|
2020-08-10 08:23:15 +00:00
|
|
|
minor = "3";
|
2021-02-14 17:49:59 +00:00
|
|
|
patch = "3";
|
2019-01-03 11:00:44 +00:00
|
|
|
};
|
2021-02-14 17:49:59 +00:00
|
|
|
sha256 = "02lys9bjky9bqg6ggv8djirbd3zzcsq7755v4yvwm0k4a7fmzf2g"; # linux64
|
2019-08-12 11:52:14 +00:00
|
|
|
pythonVersion = "3.6";
|
2019-01-03 11:00:44 +00:00
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2019-10-18 12:45:17 +00:00
|
|
|
graalpython37 = callPackage ./graalpython/default.nix {
|
|
|
|
self = pythonInterpreters.graalpython37;
|
|
|
|
inherit passthruFun;
|
|
|
|
};
|
|
|
|
|
2019-03-04 07:56:15 +00:00
|
|
|
})
|