CPython: merge expressions of interpreters

Each time a new major/minor version of CPython was released, a new
expression would be written, typically copied from the previous release.
Often fixes are only made in the current/latest release. By merging the
expressions it's more likely that modifications end up in all versions,
as is likely intended.

This commit introduces one expression for Python 3, and another for 2.7.
These two may also be merged, but it will result in a lot of extra
conditionals making the expression harder to follow.

A common passthru is introduced for CPython and PyPy.

python 2.7: use common passthru
This commit is contained in:
Frederik Rietdijk
2018-12-31 13:59:20 +01:00
parent f11591afd9
commit efbe87f3ef
7 changed files with 213 additions and 561 deletions

View File

@@ -18,16 +18,7 @@ let
packages = ( self:
let
pythonAtLeast = versionAtLeast python.pythonVersion;
pythonOlder = versionOlder python.pythonVersion;
isPy27 = python.pythonVersion == "2.7";
isPy33 = python.pythonVersion == "3.3";
isPy34 = python.pythonVersion == "3.4";
isPy35 = python.pythonVersion == "3.5";
isPy36 = python.pythonVersion == "3.6";
isPy37 = python.pythonVersion == "3.7";
isPyPy = strings.substring 0 4 python.executable == "pypy";
isPy3k = strings.substring 0 1 python.pythonVersion == "3";
inherit (python.passthru) isPy27 isPy33 isPy34 isPy35 isPy36 isPy37 isPy3k isPyPy pythonAtLeast pythonOlder;
callPackage = pkgs.newScope self;
@@ -130,7 +121,8 @@ let
in {
inherit python bootstrapped-pip pythonAtLeast pythonOlder isPy27 isPy33 isPy34 isPy35 isPy36 isPy37 isPyPy isPy3k buildPythonPackage buildPythonApplication;
inherit (python.passthru) isPy27 isPy33 isPy34 isPy35 isPy36 isPy37 isPy3k isPyPy pythonAtLeast pythonOlder;
inherit python bootstrapped-pip buildPythonPackage buildPythonApplication;
inherit fetchPypi callPackage;
inherit hasPythonModule requiredPythonModules makePythonPath disabledIf;
inherit toPythonModule toPythonApplication;