Merge remote-tracking branch 'upstream/master' into hardened-stdenv

This commit is contained in:
Robin Gloster
2016-07-19 10:37:02 +00:00
282 changed files with 4189 additions and 7149 deletions

View File

@@ -1,6 +1,6 @@
{ stdenv, fetchurl, gfortran, readline, ncurses, perl, flex, texinfo, qhull
, libsndfile, libX11, graphicsmagick, pcre, pkgconfig, mesa, fltk
, fftw, fftwSinglePrec, zlib, curl, qrupdate, openblas
, fftw, fftwSinglePrec, zlib, curl, qrupdate, openblas, arpack, libwebp
, qt ? null, qscintilla ? null, ghostscript ? null, llvm ? null, hdf5 ? null,glpk ? null
, suitesparse ? null, gnuplot ? null, jdk ? null, python ? null
}:
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
buildInputs = [ gfortran readline ncurses perl flex texinfo qhull libX11
graphicsmagick pcre pkgconfig mesa fltk zlib curl openblas libsndfile
fftw fftwSinglePrec qrupdate ]
fftw fftwSinglePrec qrupdate arpack libwebp ]
++ (stdenv.lib.optional (qt != null) qt)
++ (stdenv.lib.optional (qscintilla != null) qscintilla)
++ (stdenv.lib.optional (ghostscript != null) ghostscript)
@@ -38,9 +38,10 @@ stdenv.mkDerivation rec {
++ (stdenv.lib.optional (jdk != null) jdk)
++ (stdenv.lib.optional (gnuplot != null) gnuplot)
++ (stdenv.lib.optional (python != null) python)
++ (stdenv.lib.optionals (!stdenv.isDarwin) [mesa libX11])
;
doCheck = true;
doCheck = !stdenv.isDarwin;
enableParallelBuilding = true;
@@ -50,7 +51,9 @@ stdenv.mkDerivation rec {
"--with-blas=openblas"
"--with-lapack=openblas"
]
++ stdenv.lib.optional openblas.blas64 "--enable-64";
++ stdenv.lib.optional openblas.blas64 "--enable-64"
++ stdenv.lib.optionals stdenv.isDarwin ["--with-x=no"]
;
# Keep a copy of the octave tests detailed results in the output
# derivation, because someone may care
@@ -67,6 +70,6 @@ stdenv.mkDerivation rec {
homepage = http://octave.org/;
license = stdenv.lib.licenses.gpl3Plus;
maintainers = with stdenv.lib.maintainers; [viric raskin];
platforms = with stdenv.lib.platforms; linux;
platforms = with stdenv.lib.platforms; linux ++ darwin;
};
}

View File

@@ -1,4 +1,4 @@
{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false
{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, less, includeModules ? false
, sqlite, tcl, tk, xlibsWrapper, openssl, readline, db, ncurses, gdbm, self, callPackage
, python26Packages }:
@@ -53,6 +53,8 @@ let
[ bzip2 openssl ]++ optionals includeModules [ db openssl ncurses gdbm readline xlibsWrapper tcl tk sqlite ]
++ optional zlibSupport zlib;
propagatedBuildInputs = [ less ];
mkPaths = paths: {
C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths;
LIBRARY_PATH = makeLibraryPath paths;
@@ -64,8 +66,8 @@ let
name = "python${if includeModules then "" else "-minimal"}-${version}";
pythonVersion = majorVersion;
inherit majorVersion version src patches buildInputs preConfigure
configureFlags;
inherit majorVersion version src patches buildInputs propagatedBuildInputs
preConfigure configureFlags;
inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;

View File

@@ -1,5 +1,6 @@
{ stdenv, fetchurl, self, callPackage, python27Packages
, bzip2, openssl, gettext
, less
, includeModules ? false
@@ -22,11 +23,11 @@ with stdenv.lib;
let
majorVersion = "2.7";
version = "${majorVersion}.11";
version = "${majorVersion}.12";
src = fetchurl {
url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
sha256 = "0iiz844riiznsyhhyy962710pz228gmhv8qi3yk4w4jhmx2lqawn";
sha256 = "0y7rl603vmwlxm6ilkhc51rx2mfj14ckcz40xxgs0ljnvlhp30yp";
};
patches =
@@ -108,7 +109,7 @@ let
++ optional zlibSupport zlib
++ optional stdenv.isDarwin CF;
propagatedBuildInputs = optional stdenv.isDarwin configd;
propagatedBuildInputs = [ less ] ++ optional stdenv.isDarwin configd;
mkPaths = paths: {
C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths;

View File

@@ -1,7 +1,8 @@
diff -ru -x '*~' Python-2.7.11-orig/Lib/ctypes/util.py Python-2.7.11/Lib/ctypes/util.py
--- Python-2.7.11-orig/Lib/ctypes/util.py 2015-12-05 20:46:56.000000000 +0100
+++ Python-2.7.11/Lib/ctypes/util.py 2016-07-01 14:24:50.714223450 +0200
@@ -212,31 +212,7 @@
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index b2c514d..a6eca81 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -207,31 +207,7 @@ elif os.name == "posix":
else:
def _findSoname_ldconfig(name):
@@ -21,7 +22,7 @@ diff -ru -x '*~' Python-2.7.11-orig/Lib/ctypes/util.py Python-2.7.11/Lib/ctypes/
-
- # XXX assuming GLIBC's ldconfig (with option -p)
- expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type)
- f = os.popen('/sbin/ldconfig -p 2>/dev/null')
- f = os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')
- try:
- data = f.read()
- finally:
@@ -34,10 +35,11 @@ diff -ru -x '*~' Python-2.7.11-orig/Lib/ctypes/util.py Python-2.7.11/Lib/ctypes/
def find_library(name):
return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))
diff -ru -x '*~' Python-2.7.11-orig/Lib/uuid.py Python-2.7.11/Lib/uuid.py
--- Python-2.7.11-orig/Lib/uuid.py 2015-12-05 20:47:09.000000000 +0100
+++ Python-2.7.11/Lib/uuid.py 2016-07-01 14:33:14.360446897 +0200
@@ -437,57 +437,7 @@
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 7432032..9829d18 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -437,57 +437,7 @@ def _netbios_getnode():
return ((bytes[0]<<40L) + (bytes[1]<<32L) + (bytes[2]<<24L) +
(bytes[3]<<16L) + (bytes[4]<<8L) + bytes[5])

View File

@@ -2,6 +2,7 @@
, bzip2
, db
, gdbm
, less
, libX11, xproto
, lzma
, ncurses
@@ -27,6 +28,11 @@ let
buildInputs = filter (p: p != null) [
zlib bzip2 lzma gdbm sqlite db readline ncurses openssl tcl tk libX11 xproto
];
propagatedBuildInputs = [
less
];
in
stdenv.mkDerivation {
name = "python3-${version}";
@@ -34,6 +40,7 @@ stdenv.mkDerivation {
inherit majorVersion version;
inherit buildInputs;
inherit propagatedBuildInputs;
src = fetchurl {
url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";

View File

@@ -2,6 +2,7 @@
, bzip2
, db
, gdbm
, less
, libX11, xproto
, lzma
, ncurses
@@ -42,6 +43,11 @@ let
libX11
xproto
] ++ optionals stdenv.isDarwin [ CF configd ];
propagatedBuildInputs = [
less
];
in
stdenv.mkDerivation {
name = "python3-${fullVersion}";
@@ -49,6 +55,7 @@ stdenv.mkDerivation {
inherit majorVersion version;
inherit buildInputs;
inherit propagatedBuildInputs;
src = fetchurl {
url = "http://www.python.org/ftp/python/${version}/Python-${fullVersion}.tar.xz";

View File

@@ -2,6 +2,7 @@
, bzip2
, db
, gdbm
, less
, libX11, xproto
, lzma
, ncurses
@@ -42,6 +43,11 @@ let
libX11
xproto
] ++ optionals stdenv.isDarwin [ CF configd ];
propagatedBuildInputs = [
less
];
in
stdenv.mkDerivation {
name = "python3-${fullVersion}";
@@ -49,6 +55,7 @@ stdenv.mkDerivation {
inherit majorVersion version;
inherit buildInputs;
inherit propagatedBuildInputs;
src = fetchurl {
url = "http://www.python.org/ftp/python/${version}/Python-${fullVersion}.tar.xz";

View File

@@ -0,0 +1,145 @@
{ stdenv, fetchurl
, glibc
, bzip2
, db
, gdbm
, less
, libX11, xproto
, lzma
, ncurses
, openssl
, readline
, sqlite
, tcl, tk
, zlib
, callPackage
, self
, python36Packages
, CF, configd
}:
assert readline != null -> ncurses != null;
with stdenv.lib;
let
majorVersion = "3.6";
pythonVersion = majorVersion;
version = "${majorVersion}.0a3";
fullVersion = "${version}";
buildInputs = filter (p: p != null) [
glibc
zlib
bzip2
lzma
gdbm
sqlite
db
readline
ncurses
openssl
tcl
tk
libX11
xproto
] ++ optionals stdenv.isDarwin [ CF configd ];
propagatedBuildInputs = [
less
];
in
stdenv.mkDerivation {
name = "python3-${fullVersion}";
pythonVersion = majorVersion;
inherit majorVersion version;
inherit buildInputs;
inherit propagatedBuildInputs;
src = fetchurl {
url = "https://www.python.org/ftp/python/${majorVersion}.0/Python-${fullVersion}.tar.xz";
sha256 = "08c3598bwihibwca9lwxq923sjq9shvgv3wxv4vkga2n6hf63l1c";
};
NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s";
prePatch = optionalString stdenv.isDarwin ''
substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
'';
preConfigure = ''
for i in /usr /sw /opt /pkg; do # improve purity
substituteInPlace ./setup.py --replace $i /no-such-path
done
${optionalString stdenv.isDarwin ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"
export MACOSX_DEPLOYMENT_TARGET=10.6
''}
substituteInPlace ./Lib/plat-generic/regen --replace "/usr/include" ${glibc}/include
configureFlagsArray=( --enable-shared --with-threads
CPPFLAGS="${concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs)}"
LDFLAGS="${concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs)}"
LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}"
)
'';
setupHook = ./setup-hook.sh;
postInstall = ''
# needed for some packages, especially packages that backport functionality
# to 2.x from 3.x
for item in $out/lib/python${majorVersion}/test/*; do
if [[ "$item" != */test_support.py* ]]; then
rm -rf "$item"
else
echo $item
fi
done
touch $out/lib/python${majorVersion}/test/__init__.py
ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}"
paxmark E $out/bin/python${majorVersion}
'';
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 = "python${majorVersion}m";
buildEnv = callPackage ../wrapper.nix { python = self; };
withPackages = import ../with-packages.nix { inherit buildEnv; pythonPackages = python36Packages; };
isPy3 = true;
isPy35 = true;
is_py3k = true; # deprecated
sitePackages = "lib/${libPrefix}/site-packages";
interpreter = "${self}/bin/${executable}";
};
enableParallelBuilding = true;
meta = {
homepage = http://python.org;
description = "A high-level dynamically-typed programming language";
longDescription = ''
Python is a remarkably powerful dynamic programming language that
is used in a wide variety of application domains. Some of its key
distinguishing features include: clear, readable syntax; strong
introspection capabilities; intuitive object orientation; natural
expression of procedural code; full modularity, supporting
hierarchical packages; exception-based error handling; and very
high level dynamic data types.
'';
license = licenses.psfl;
platforms = with platforms; linux ++ darwin;
maintainers = with maintainers; [ chaoflow domenkozar cstrahan kragniz ];
};
}

View File

@@ -0,0 +1,15 @@
addPythonPath() {
addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python3.6/site-packages
}
toPythonPath() {
local paths="$1"
local result=
for i in $paths; do
p="$i/lib/python3.6/site-packages"
result="${result}${result:+:}$p"
done
echo $result
}
envHooks+=(addPythonPath)