summaryrefslogtreecommitdiff
path: root/pkgs/development/interpreters/python/cpython/3.4/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/python/cpython/3.4/default.nix')
-rw-r--r--pkgs/development/interpreters/python/cpython/3.4/default.nix75
1 files changed, 41 insertions, 34 deletions
diff --git a/pkgs/development/interpreters/python/cpython/3.4/default.nix b/pkgs/development/interpreters/python/cpython/3.4/default.nix
index 2e7d3a03141e..43edce8a44c2 100644
--- a/pkgs/development/interpreters/python/cpython/3.4/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.4/default.nix
@@ -1,58 +1,49 @@
{ stdenv, fetchurl
, bzip2
-, db
, gdbm
-, libX11, xproto
, lzma
, ncurses
, openssl
, readline
, sqlite
-, tcl, tk
+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? false
, zlib
, callPackage
, self
, python34Packages
-
, CF, configd
}:
-assert readline != null -> ncurses != null;
+assert x11Support -> tcl != null
+ && tk != null
+ && xproto != null
+ && libX11 != null;
with stdenv.lib;
let
majorVersion = "3.4";
+ minorVersion = "5";
+ minorVersionSuffix = "";
pythonVersion = majorVersion;
- version = "${majorVersion}.5";
- fullVersion = "${version}";
+ version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
+ libPrefix = "python${majorVersion}";
+ sitePackages = "lib/${libPrefix}/site-packages";
buildInputs = filter (p: p != null) [
- zlib
- bzip2
- lzma
- gdbm
- sqlite
- db
- readline
- ncurses
- openssl
- tcl
- tk
- libX11
- xproto
- ] ++ optionals stdenv.isDarwin [ CF configd ];
+ zlib bzip2 lzma gdbm sqlite readline ncurses openssl ]
+ ++ optionals x11Support [ tcl tk libX11 xproto ]
+ ++ optionals stdenv.isDarwin [ CF configd ];
-in
-stdenv.mkDerivation {
- name = "python3-${fullVersion}";
+in stdenv.mkDerivation {
+ name = "python3-${version}";
pythonVersion = majorVersion;
inherit majorVersion version;
inherit buildInputs;
src = fetchurl {
- url = "http://www.python.org/ftp/python/${version}/Python-${fullVersion}.tar.xz";
+ url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
sha256 = "12l9klp778wklxmckhghniy5hklss8r26995pyd00qbllk4b2r7f";
};
@@ -95,23 +86,39 @@ stdenv.mkDerivation {
ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}"
paxmark E $out/bin/python${majorVersion}
+
+ # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484
+ echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py
+
+ # Use Python3 as default python
+ ln -s "$out/bin/idle3" "$out/bin/idle"
+ ln -s "$out/bin/pip3" "$out/bin/pip"
+ ln -s "$out/bin/pydoc3" "$out/bin/pydoc"
+ ln -s "$out/bin/python3" "$out/bin/python"
+ ln -s "$out/bin/python3-config" "$out/bin/python-config"
+ ln -s "$out/lib/pkgconfig/python3.pc" "$out/lib/pkgconfig/python.pc"
+ '';
+
+ postFixup = ''
+ # Get rid of retained dependencies on -dev packages, and remove
+ # some $TMPDIR references to improve binary reproducibility.
+ for i in $out/lib/python${majorVersion}/_sysconfigdata.py $out/lib/python${majorVersion}/config-${majorVersion}m/Makefile; do
+ sed -i $i -e "s|-I/nix/store/[^ ']*||g" -e "s|-L/nix/store/[^ ']*||g" -e "s|$TMPDIR|/no-such-path|g"
+ done
+
+ # FIXME: should regenerate this.
+ rm $out/lib/python${majorVersion}/__pycache__/_sysconfigdata.cpython*
+
'';
passthru = rec {
- zlibSupport = zlib != null;
- sqliteSupport = sqlite != null;
- dbSupport = db != null;
- readlineSupport = readline != null;
- opensslSupport = openssl != null;
- tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null);
- libPrefix = "python${majorVersion}";
- executable = "python3.4m";
+ inherit libPrefix sitePackages x11Support;
+ executable = "${libPrefix}m";
buildEnv = callPackage ../../wrapper.nix { python = self; };
withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python34Packages; };
isPy3 = true;
isPy34 = true;
is_py3k = true; # deprecated
- sitePackages = "lib/${libPrefix}/site-packages";
interpreter = "${self}/bin/${executable}";
};