summaryrefslogtreecommitdiffstats
path: root/pkgs/development/misc/resholve/python27.nix
blob: 677cf13dc0d844484e9338260e33442283aa8b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
  lib,
  pkgsBuildHost,
}:

let
  removeKnownVulnerabilities =
    pkg:
    pkg.overrideAttrs (old: {
      meta = (old.meta or { }) // {
        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 python27Base).override {
    self = python27;
    pkgsBuildHost = pkgsBuildHost // {
      inherit python27;
    };
    # python2-only overrides for bootstrapped-pip/pip/setuptools/wheel
    # (no longer applied globally — kept local to resholve)
    packageOverrides = lib.composeExtensions (import ./python2-packages.nix) (
      _self: super: {
        pip = removeKnownVulnerabilities super.pip;
        setuptools = removeKnownVulnerabilities super.setuptools;
      }
    );
    # strip down that python version as much as possible
    openssl = null;
    bzip2 = null;
    readline = null;
    ncurses = null;
    gdbm = null;
    sqlite = null;
    rebuildBytecode = false;
    stripBytecode = true;
    strip2to3 = true;
    stripConfig = true;
    stripIdlelib = true;
    stripTests = true;
    enableOptimizations = false;
  };
in
python27