summaryrefslogtreecommitdiff
path: root/pkgs/development/interpreters/python
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/python')
-rw-r--r--pkgs/development/interpreters/python/cpython/2.6/default.nix13
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/default.nix188
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch260
-rw-r--r--pkgs/development/interpreters/python/cpython/3.3/default.nix60
-rw-r--r--pkgs/development/interpreters/python/cpython/3.4/default.nix75
-rw-r--r--pkgs/development/interpreters/python/cpython/3.5/default.nix65
-rw-r--r--pkgs/development/interpreters/python/cpython/3.6/default.nix70
-rw-r--r--pkgs/development/interpreters/python/mk-python-derivation.nix4
-rw-r--r--pkgs/development/interpreters/python/pypy/2.7/default.nix17
9 files changed, 485 insertions, 267 deletions
diff --git a/pkgs/development/interpreters/python/cpython/2.6/default.nix b/pkgs/development/interpreters/python/cpython/2.6/default.nix
index 5311be697afe..64f2b80d09fa 100644
--- a/pkgs/development/interpreters/python/cpython/2.6/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.6/default.nix
@@ -8,10 +8,14 @@ with stdenv.lib;
let
majorVersion = "2.6";
- version = "${majorVersion}.9";
+ minorVersion = "9";
+ minorVersionSuffix = "";
+ pythonVersion = majorVersion;
+ version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
+ libPrefix = "python${majorVersion}";
src = fetchurl {
- url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
+ url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz";
sha256 = "0hbfs2691b60c7arbysbzr0w9528d5pl8a4x7mq5psh6a2cvprya";
};
@@ -90,16 +94,19 @@ let
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
+
${ optionalString includeModules "$out/bin/python ./setup.py build_ext"}
'';
passthru = rec {
+ inherit libPrefix;
inherit zlibSupport;
isPy2 = true;
isPy26 = true;
buildEnv = callPackage ../../wrapper.nix { python = self; };
withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python26Packages; };
- libPrefix = "python${majorVersion}";
executable = libPrefix;
sitePackages = "lib/${libPrefix}/site-packages";
interpreter = "${self}/bin/${executable}";
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix
index 5f15db26ebc3..a6eeee25be96 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -1,18 +1,23 @@
-{ stdenv, fetchurl, self, callPackage, python27Packages
-, bzip2, openssl, gettext
-
-, includeModules ? false
-
-, db, gdbm, ncurses, sqlite, readline
-
-, tcl ? null, tk ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? !stdenv.isCygwin
-, zlib ? null, zlibSupport ? true
-, expat, libffi
-
-, CF, configd
+{ stdenv, fetchurl
+, bzip2
+, gdbm
+, fetchpatch
+, ncurses
+, openssl
+, readline
+, sqlite
+, tcl ? null, tk ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? false
+, zlib
+, callPackage
+, self
+, python27Packages
+, gettext
+, db
+, expat
+, libffi
+, CF, configd, coreutils
}:
-assert zlibSupport -> zlib != null;
assert x11Support -> tcl != null
&& tk != null
&& xlibsWrapper != null
@@ -22,13 +27,19 @@ with stdenv.lib;
let
majorVersion = "2.7";
- version = "${majorVersion}.12";
+ minorVersion = "12";
+ minorVersionSuffix = "";
+ pythonVersion = majorVersion;
+ version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
+ libPrefix = "python${majorVersion}";
+ sitePackages = "lib/${libPrefix}/site-packages";
src = fetchurl {
- url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
+ url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz";
sha256 = "0y7rl603vmwlxm6ilkhc51rx2mfj14ckcz40xxgs0ljnvlhp30yp";
};
+ hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
patches =
[ # Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff.
./search-path.patch
@@ -44,6 +55,14 @@ let
./deterministic-build.patch
./properly-detect-curses.patch
+
+ # FIXME: get rid of this after the next release, when the commit referenced here makes
+ # it in. We need it until then because it breaks compilation of programs that use
+ # locale with clang 3.8 and higher.
+ (fetchpatch {
+ url = "https://hg.python.org/cpython/raw-rev/e0ec3471cb09";
+ sha256 = "1jdgb70jw942r4kmr01qll7mk1di8jx0qiabmp20jhnmha246ivq";
+ })
] ++ optionals stdenv.isLinux [
# Disable the use of ldconfig in ctypes.util.find_library (since
@@ -64,6 +83,15 @@ let
./2.7.3-dylib.patch
./2.7.3-getpath-exe-extension.patch
./2.7.3-no-libm.patch
+ ] ++ optionals hasDistutilsCxxPatch [
+
+ # Patch from http://bugs.python.org/issue1222585 adapted to work with
+ # `patch -p1' and with a last hunk removed
+ # Upstream distutils is calling C compiler to compile C++ code, which
+ # only works for GCC and Apple Clang. This makes distutils to call C++
+ # compiler when needed.
+ ./python-2.7-distutils-C++.patch
+
];
preConfigure = ''
@@ -78,7 +106,7 @@ let
'' + optionalString stdenv.isDarwin ''
substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
substituteInPlace Lib/multiprocessing/__init__.py \
- --replace 'os.popen(comm)' 'os.popen("nproc")'
+ --replace 'os.popen(comm)' 'os.popen("${coreutils}/bin/nproc")'
'';
configureFlags = [
@@ -99,16 +127,11 @@ let
buildInputs =
optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
- [ bzip2 openssl ]
+ [ bzip2 openssl zlib ]
++ optionals stdenv.isCygwin [ expat libffi ]
- ++ optionals includeModules (
- [ db gdbm ncurses sqlite readline
- ] ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
- )
- ++ optional zlibSupport zlib
- ++ optional stdenv.isDarwin CF;
-
- propagatedBuildInputs = optional stdenv.isDarwin configd;
+ ++ [ db gdbm ncurses sqlite readline ]
+ ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
+ ++ optionals stdenv.isDarwin [ CF configd ];
mkPaths = paths: {
C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths;
@@ -117,11 +140,12 @@ let
# Build the basic Python interpreter without modules that have
# external dependencies.
- python = stdenv.mkDerivation {
+
+in stdenv.mkDerivation {
name = "python-${version}";
pythonVersion = majorVersion;
- inherit majorVersion version src patches buildInputs propagatedBuildInputs
+ inherit majorVersion version src patches buildInputs
preConfigure configureFlags;
LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
@@ -150,20 +174,19 @@ let
paxmark E $out/bin/python${majorVersion}
- ${optionalString includeModules "$out/bin/python ./setup.py build_ext"}
+ # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484
+ echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py
rm "$out"/lib/python*/plat-*/regen # refers to glibc.dev
'';
passthru = rec {
- inherit zlibSupport;
- isPy2 = true;
- isPy27 = true;
+ inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch;
+ executable = libPrefix;
buildEnv = callPackage ../../wrapper.nix { python = self; };
withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python27Packages; };
- libPrefix = "python${majorVersion}";
- executable = libPrefix;
- sitePackages = "lib/${libPrefix}/site-packages";
+ isPy2 = true;
+ isPy27 = true;
interpreter = "${self}/bin/${executable}";
};
@@ -185,99 +208,4 @@ let
platforms = stdenv.lib.platforms.all;
maintainers = with stdenv.lib.maintainers; [ chaoflow domenkozar ];
};
- };
-
-
- # This function builds a Python module included in the main Python
- # distribution in a separate derivation.
- buildInternalPythonModule =
- { moduleName
- , internalName ? "_" + moduleName
- , deps
- }:
- if includeModules then null else stdenv.mkDerivation rec {
- name = "python-${moduleName}-${python.version}";
-
- inherit src patches preConfigure postConfigure configureFlags;
-
- buildInputs = [ python ] ++ deps;
-
- # We need to set this for python.buildEnv
- pythonPath = [];
-
- inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
-
- # non-python gdbm has a libintl dependency on i686-cygwin, not on x86_64-cygwin
- buildPhase = (if (stdenv.system == "i686-cygwin" && moduleName == "gdbm") then ''
- sed -i setup.py -e "s:libraries = \['gdbm'\]:libraries = ['gdbm', 'intl']:"
- '' else '''') + ''
- substituteInPlace setup.py --replace 'self.extensions = extensions' \
- 'self.extensions = [ext for ext in self.extensions if ext.name in ["${internalName}"]]'
-
- python ./setup.py build_ext
- [ -z "$(find build -name '*_failed.so' -print)" ]
- '';
-
- installPhase =
- ''
- dest=$out/lib/${python.libPrefix}/site-packages
- mkdir -p $dest
- cp -p $(find . -name "*.${if stdenv.isCygwin then "dll" else "so"}") $dest/
- '';
- };
-
-
- # The Python modules included in the main Python distribution, built
- # as separate derivations.
- modules = {
-
- bsddb = buildInternalPythonModule {
- moduleName = "bsddb";
- deps = [ db ];
- };
-
- curses = buildInternalPythonModule {
- moduleName = "curses";
- deps = [ ncurses ];
- };
-
- curses_panel = buildInternalPythonModule {
- moduleName = "curses_panel";
- deps = [ ncurses modules.curses ];
- };
-
- crypt = buildInternalPythonModule {
- moduleName = "crypt";
- internalName = "crypt";
- deps = optional (stdenv ? glibc) stdenv.glibc;
- };
-
- gdbm = buildInternalPythonModule {
- moduleName = "gdbm";
- internalName = "gdbm";
- deps = [ gdbm ] ++ stdenv.lib.optional stdenv.isCygwin gettext;
- };
-
- sqlite3 = buildInternalPythonModule {
- moduleName = "sqlite3";
- deps = [ sqlite ];
- };
-
- } // optionalAttrs x11Support {
-
- tkinter = if stdenv.isCygwin then null else (buildInternalPythonModule {
- moduleName = "tkinter";
- deps = [ tcl tk xlibsWrapper libX11 ];
- });
-
- } // {
-
- readline = buildInternalPythonModule {
- moduleName = "readline";
- internalName = "readline";
- deps = [ readline ];
- };
-
- };
-
-in python // { inherit modules; }
+ }
diff --git a/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch b/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch
new file mode 100644
index 000000000000..90c21d5e60ca
--- /dev/null
+++ b/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch
@@ -0,0 +1,260 @@
+--- a/Lib/distutils/cygwinccompiler.py
++++ b/Lib/distutils/cygwinccompiler.py
+@@ -117,8 +117,10 @@
+ # dllwrap 2.10.90 is buggy
+ if self.ld_version >= "2.10.90":
+ self.linker_dll = "gcc"
++ self.linker_dll_cxx = "g++"
+ else:
+ self.linker_dll = "dllwrap"
++ self.linker_dll_cxx = "dllwrap"
+
+ # ld_version >= "2.13" support -shared so use it instead of
+ # -mdll -static
+@@ -132,9 +134,13 @@
+ self.set_executables(compiler='gcc -mcygwin -O -Wall',
+ compiler_so='gcc -mcygwin -mdll -O -Wall',
+ compiler_cxx='g++ -mcygwin -O -Wall',
++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
+ linker_exe='gcc -mcygwin',
+ linker_so=('%s -mcygwin %s' %
+- (self.linker_dll, shared_option)))
++ (self.linker_dll, shared_option)),
++ linker_exe_cxx='g++ -mcygwin',
++ linker_so_cxx=('%s -mcygwin %s' %
++ (self.linker_dll_cxx, shared_option)))
+
+ # cygwin and mingw32 need different sets of libraries
+ if self.gcc_version == "2.91.57":
+@@ -160,8 +166,12 @@
+ raise CompileError, msg
+ else: # for other files use the C-compiler
+ try:
+- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+- extra_postargs)
++ if self.detect_language(src) == 'c++':
++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++ extra_postargs)
++ else:
++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++ extra_postargs)
+ except DistutilsExecError, msg:
+ raise CompileError, msg
+
+@@ -327,9 +337,14 @@
+ self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin,
+ compiler_so='gcc%s -mdll -O -Wall' % no_cygwin,
+ compiler_cxx='g++%s -O -Wall' % no_cygwin,
++ compiler_so_cxx='g++%s -mdll -O -Wall' % no_cygwin,
+ linker_exe='gcc%s' % no_cygwin,
+ linker_so='%s%s %s %s'
+ % (self.linker_dll, no_cygwin,
++ shared_option, entry_point),
++ linker_exe_cxx='g++%s' % no_cygwin,
++ linker_so_cxx='%s%s %s %s'
++ % (self.linker_dll_cxx, no_cygwin,
+ shared_option, entry_point))
+ # Maybe we should also append -mthreads, but then the finished
+ # dlls need another dll (mingwm10.dll see Mingw32 docs)
+--- a/Lib/distutils/emxccompiler.py
++++ b/Lib/distutils/emxccompiler.py
+@@ -65,8 +65,12 @@
+ # XXX optimization, warnings etc. should be customizable.
+ self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
+ compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
++ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
++ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
+ linker_exe='gcc -Zomf -Zmt -Zcrtdll',
+- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
++ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
++ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
++ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
+
+ # want the gcc library statically linked (so that we don't have
+ # to distribute a version dependent on the compiler we have)
+@@ -83,8 +87,12 @@
+ raise CompileError, msg
+ else: # for other files use the C-compiler
+ try:
+- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+- extra_postargs)
++ if self.detect_language(src) == 'c++':
++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++ extra_postargs)
++ else:
++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++ extra_postargs)
+ except DistutilsExecError, msg:
+ raise CompileError, msg
+
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -170,10 +170,12 @@
+ _osx_support.customize_compiler(_config_vars)
+ _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
+
+- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
+- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+- 'CCSHARED', 'LDSHARED', 'SO', 'AR',
+- 'ARFLAGS')
++ (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'SO', 'AR', 'ARFLAGS')
++
++ cflags = ''
++ cxxflags = ''
+
+ if 'CC' in os.environ:
+ newcc = os.environ['CC']
+@@ -188,19 +190,27 @@
+ cxx = os.environ['CXX']
+ if 'LDSHARED' in os.environ:
+ ldshared = os.environ['LDSHARED']
++ if 'LDCXXSHARED' in os.environ:
++ ldcxxshared = os.environ['LDCXXSHARED']
+ if 'CPP' in os.environ:
+ cpp = os.environ['CPP']
+ else:
+ cpp = cc + " -E" # not always
+ if 'LDFLAGS' in os.environ:
+ ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
+ if 'CFLAGS' in os.environ:
+- cflags = opt + ' ' + os.environ['CFLAGS']
++ cflags = os.environ['CFLAGS']
+ ldshared = ldshared + ' ' + os.environ['CFLAGS']
++ if 'CXXFLAGS' in os.environ:
++ cxxflags = os.environ['CXXFLAGS']
++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
+ if 'CPPFLAGS' in os.environ:
+ cpp = cpp + ' ' + os.environ['CPPFLAGS']
+ cflags = cflags + ' ' + os.environ['CPPFLAGS']
++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
+ ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
+ if 'AR' in os.environ:
+ ar = os.environ['AR']
+ if 'ARFLAGS' in os.environ:
+@@ -209,13 +219,17 @@
+ archiver = ar + ' ' + ar_flags
+
+ cc_cmd = cc + ' ' + cflags
++ cxx_cmd = cxx + ' ' + cxxflags
+ compiler.set_executables(
+ preprocessor=cpp,
+ compiler=cc_cmd,
+ compiler_so=cc_cmd + ' ' + ccshared,
+- compiler_cxx=cxx,
++ compiler_cxx=cxx_cmd,
++ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
+ linker_so=ldshared,
+ linker_exe=cc,
++ linker_so_cxx=ldcxxshared,
++ linker_exe_cxx=cxx,
+ archiver=archiver)
+
+ compiler.shared_lib_extension = so_ext
+--- a/Lib/distutils/unixccompiler.py
++++ b/Lib/distutils/unixccompiler.py
+@@ -55,14 +55,17 @@
+ # are pretty generic; they will probably have to be set by an outsider
+ # (eg. using information discovered by the sysconfig about building
+ # Python extensions).
+- executables = {'preprocessor' : None,
+- 'compiler' : ["cc"],
+- 'compiler_so' : ["cc"],
+- 'compiler_cxx' : ["cc"],
+- 'linker_so' : ["cc", "-shared"],
+- 'linker_exe' : ["cc"],
+- 'archiver' : ["ar", "-cr"],
+- 'ranlib' : None,
++ executables = {'preprocessor' : None,
++ 'compiler' : ["cc"],
++ 'compiler_so' : ["cc"],
++ 'compiler_cxx' : ["c++"],
++ 'compiler_so_cxx' : ["c++"],
++ 'linker_so' : ["cc", "-shared"],
++ 'linker_exe' : ["cc"],
++ 'linker_so_cxx' : ["c++", "-shared"],
++ 'linker_exe_cxx' : ["c++"],
++ 'archiver' : ["ar", "-cr"],
++ 'ranlib' : None,
+ }
+
+ if sys.platform[:6] == "darwin":
+@@ -112,12 +115,19 @@
+
+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+ compiler_so = self.compiler_so
++ compiler_so_cxx = self.compiler_so_cxx
+ if sys.platform == 'darwin':
+ compiler_so = _osx_support.compiler_fixup(compiler_so,
+ cc_args + extra_postargs)
++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx,
++ cc_args + extra_postargs)
+ try:
+- self.spawn(compiler_so + cc_args + [src, '-o', obj] +
+- extra_postargs)
++ if self.detect_language(src) == 'c++':
++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
++ extra_postargs)
++ else:
++ self.spawn(compiler_so + cc_args + [src, '-o', obj] +
++ extra_postargs)
+ except DistutilsExecError, msg:
+ raise CompileError, msg
+
+@@ -174,23 +184,16 @@
+ ld_args.extend(extra_postargs)
+ self.mkpath(os.path.dirname(output_filename))
+ try:
+- if target_desc == CCompiler.EXECUTABLE:
+- linker = self.linker_exe[:]
++ if target_lang == "c++":
++ if target_desc == CCompiler.EXECUTABLE:
++ linker = self.linker_exe_cxx[:]
++ else:
++ linker = self.linker_so_cxx[:]
+ else:
+- linker = self.linker_so[:]
+- if target_lang == "c++" and self.compiler_cxx:
+- # skip over environment variable settings if /usr/bin/env
+- # is used to set up the linker's environment.
+- # This is needed on OSX. Note: this assumes that the
+- # normal and C++ compiler have the same environment
+- # settings.
+- i = 0
+- if os.path.basename(linker[0]) == "env":
+- i = 1
+- while '=' in linker[i]:
+- i = i + 1
+-
+- linker[i] = self.compiler_cxx[i]
++ if target_desc == CCompiler.EXECUTABLE:
++ linker = self.linker_exe[:]
++ else:
++ linker = self.linker_so[:]
+
+ if sys.platform == 'darwin':
+ linker = _osx_support.compiler_fixup(linker, ld_args)
+--- a/Lib/_osx_support.py
++++ b/Lib/_osx_support.py
+@@ -14,13 +14,13 @@
+ # configuration variables that may contain universal build flags,
+ # like "-arch" or "-isdkroot", that may need customization for
+ # the user environment
+-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
+- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
+- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
+- 'PY_CORE_CFLAGS')
++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS',
++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS',
++ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS')
+
+ # configuration variables that may contain compiler calls
+-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
+
+ # prefix added to original configuration variable names
+ _INITPRE = '_OSX_SUPPORT_INITIAL_' \ No newline at end of file
diff --git a/pkgs/development/interpreters/python/cpython/3.3/default.nix b/pkgs/development/interpreters/python/cpython/3.3/default.nix
index cb48186a69e7..b25e2ffd0cb1 100644
--- a/pkgs/development/interpreters/python/cpython/3.3/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.3/default.nix
@@ -1,35 +1,41 @@
{ 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
, python33Packages
+, CF, configd
}:
-assert readline != null -> ncurses != null;
+assert x11Support -> tcl != null
+ && tk != null
+ && xproto != null
+ && libX11 != null;
with stdenv.lib;
let
majorVersion = "3.3";
+ minorVersion = "6";
+ minorVersionSuffix = "";
pythonVersion = majorVersion;
- version = "${majorVersion}.6";
+ 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
- ];
+ zlib bzip2 lzma gdbm sqlite readline ncurses openssl ]
+ ++ optionals x11Support [ tcl tk libX11 xproto ]
+ ++ optionals stdenv.isDarwin [ CF configd ];
-in
-stdenv.mkDerivation {
+in stdenv.mkDerivation {
name = "python3-${version}";
pythonVersion = majorVersion;
inherit majorVersion version;
@@ -37,7 +43,7 @@ stdenv.mkDerivation {
inherit buildInputs;
src = fetchurl {
- url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
+ url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz";
sha256 = "0gsxpgd5p4mwd01gw501vsyahncyw3h9836ypkr3y32kgazy89jj";
};
@@ -71,23 +77,39 @@ stdenv.mkDerivation {
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}
+
+ # 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.3m";
+ inherit libPrefix sitePackages x11Support;
+ executable = "${libPrefix}m";
buildEnv = callPackage ../../wrapper.nix { python = self; };
withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python33Packages; };
isPy3 = true;
isPy33 = true;
is_py3k = true; # deprecated
- sitePackages = "lib/${libPrefix}/site-packages";
interpreter = "${self}/bin/${executable}";
};
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}";
};
diff --git a/pkgs/development/interpreters/python/cpython/3.5/default.nix b/pkgs/development/interpreters/python/cpython/3.5/default.nix
index 69d3df32a326..dd2cce707efe 100644
--- a/pkgs/development/interpreters/python/cpython/3.5/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.5/default.nix
@@ -1,55 +1,49 @@
{ stdenv, fetchurl
, bzip2
, gdbm
-, libX11, xproto
, lzma
, ncurses
, openssl
, readline
, sqlite
-, tcl, tk
+, tcl ? null, tk ? null, libX11 ? null, xproto ? null, x11Support ? false
, zlib
, callPackage
, self
, python35Packages
-
, CF, configd
}:
-assert readline != null -> ncurses != null;
+assert x11Support -> tcl != null
+ && tk != null
+ && xproto != null
+ && libX11 != null;
with stdenv.lib;
let
majorVersion = "3.5";
+ minorVersion = "2";
+ minorVersionSuffix = "";
pythonVersion = majorVersion;
- version = "${majorVersion}.2";
- fullVersion = "${version}";
+ version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
+ libPrefix = "python${majorVersion}";
+ sitePackages = "lib/${libPrefix}/site-packages";
buildInputs = filter (p: p != null) [
- zlib
- bzip2
- lzma
- gdbm
- sqlite
- readline
- ncurses
- openssl
- tcl
- tk
- libX11
- xproto
- ] ++ optionals stdenv.isDarwin [ CF configd ];
-in
-stdenv.mkDerivation {
- name = "python3-${fullVersion}";
+ zlib bzip2 lzma gdbm sqlite readline ncurses openssl ]
+ ++ optionals x11Support [ tcl tk libX11 xproto ]
+ ++ optionals stdenv.isDarwin [ CF configd ];
+
+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 = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz";
sha256 = "0h6a5fr7ram2s483lh0pnmc4ncijb8llnpfdxdcl5dxr01hza400";
};
@@ -92,12 +86,23 @@ 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
+ 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
@@ -106,20 +111,12 @@ stdenv.mkDerivation {
'';
passthru = rec {
- zlibSupport = zlib != null;
- sqliteSupport = sqlite != null;
- dbSupport = false;
- readlineSupport = readline != null;
- opensslSupport = openssl != null;
- tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null);
- libPrefix = "python${majorVersion}";
- executable = "python${majorVersion}m";
+ inherit libPrefix sitePackages x11Support;
+ executable = "${libPrefix}m";
buildEnv = callPackage ../../wrapper.nix { python = self; };
withPackages = import ../../with-packages.nix { inherit buildEnv; pythonPackages = python35Packages; };
isPy3 = true;
isPy35 = true;
- is_py3k = true; # deprecated
- sitePackages = "lib/${libPrefix}/site-packages";
interpreter = "${self}/bin/${executable}";
};
diff --git a/pkgs/development/interpreters/python/cpython/3.6/default.nix b/pkgs/development/interpreters/python/cpython/3.6/default.nix
index 3a6635cd8b62..d5960ccde99f 100644
--- a/pkgs/development/interpreters/python/cpython/3.6/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.6/default.nix
@@ -1,60 +1,50 @@
{ stdenv, fetchurl
, glibc
, 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
, python36Packages
-
, CF, configd
}:
-assert readline != null -> ncurses != null;
-
+assert x11Support -> tcl != null
+ && tk != null
+ && xproto != null
+ && libX11 != null;
with stdenv.lib;
let
majorVersion = "3.6";
+ minorVersion = "0";
+ minorVersionSuffix = "b2";
pythonVersion = majorVersion;
- version = "${majorVersion}.0a3";
- fullVersion = "${version}";
+ version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
+ libPrefix = "python${majorVersion}";
+ sitePackages = "lib/${libPrefix}/site-packages";
buildInputs = filter (p: p != null) [
- glibc
- zlib
- bzip2
- lzma
- gdbm
- sqlite
- db
- readline
- ncurses
- openssl
- tcl
- tk
- libX11
- xproto
- ] ++ optionals stdenv.isDarwin [ CF configd ];
-in
-stdenv.mkDerivation {
- name = "python3-${fullVersion}";
+ zlib bzip2 lzma gdbm sqlite readline ncurses openssl ]
+ ++ optionals x11Support [ tcl tk libX11 xproto ]
+ ++ optionals stdenv.isDarwin [ CF configd ];
+
+in stdenv.mkDerivation {
+ name = "python3-${version}";
pythonVersion = majorVersion;
inherit majorVersion version;
inherit buildInputs;
src = fetchurl {
- url = "https://www.python.org/ftp/python/${majorVersion}.0/Python-${fullVersion}.tar.xz";
- sha256 = "08c3598bwihibwca9lwxq923sjq9shvgv3wxv4vkga2n6hf63l1c";
+ url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz";
+ sha256 = "1sk990n2xm5vhn3ys2cp427dx0z14cx3sz1za5f2fcwrp524bz9s";
};
NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s";
@@ -73,8 +63,6 @@ stdenv.mkDerivation {
export MACOSX_DEPLOYMENT_TARGET=10.6
''}
- substituteInPlace ./Lib/plat-generic/regen --replace "/usr/include" ${glibc.dev}/include
-
configureFlagsArray=( --enable-shared --with-threads
CPPFLAGS="${concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs)}"
LDFLAGS="${concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs)}"
@@ -98,23 +86,27 @@ 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"
'';
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";
+ inherit libPrefix sitePackages x11Support;
+ executable = "${libPrefix}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}";
};
diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix
index 99af42cd7add..0f798c63e8fa 100644
--- a/pkgs/development/interpreters/python/mk-python-derivation.nix
+++ b/pkgs/development/interpreters/python/mk-python-derivation.nix
@@ -69,13 +69,13 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // {
doCheck = false;
doInstallCheck = doCheck;
- postFixup = attrs.postFixup or ''
+ postFixup = ''
wrapPythonPrograms
'' + lib.optionalString catchConflicts ''
# check if we have two packages with the same name in closure and fail
# this shouldn't happen, something went wrong with dependencies specs
${python.interpreter} ${./catch_conflicts.py}
- '';
+ '' + attrs.postFixup or '''';
passthru = {
inherit python; # The python interpreter
diff --git a/pkgs/development/interpreters/python/pypy/2.7/default.nix b/pkgs/development/interpreters/python/pypy/2.7/default.nix
index c0bd10a0d437..bce6d19d58d3 100644
--- a/pkgs/development/interpreters/python/pypy/2.7/default.nix
+++ b/pkgs/development/interpreters/python/pypy/2.7/default.nix
@@ -1,13 +1,15 @@
{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi
-, sqlite, openssl, ncurses, pythonFull, expat, tcl, tk, xlibsWrapper, libX11
+, sqlite, openssl, ncurses, python, expat, tcl, tk, xlibsWrapper, libX11
, makeWrapper, callPackage, self, pypyPackages, gdbm, db }:
assert zlibSupport -> zlib != null;
let
-
- majorVersion = "5.4.1";
- version = "${majorVersion}";
+ majorVersion = "5.4";
+ minorVersion = "1";
+ minorVersionSuffix = "";
+ pythonVersion = "2.7";
+ version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
libPrefix = "pypy${majorVersion}";
pypy = stdenv.mkDerivation rec {
@@ -32,7 +34,7 @@ let
patch lib-python/2.7/test/test_pyexpat.py < '${expatch}'
'';
- buildInputs = [ bzip2 openssl pkgconfig pythonFull libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 makeWrapper gdbm db ]
+ buildInputs = [ bzip2 openssl pkgconfig python libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 makeWrapper gdbm db ]
++ stdenv.lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc
++ stdenv.lib.optional zlibSupport zlib;
@@ -60,7 +62,7 @@ let
'';
buildPhase = ''
- ${pythonFull.interpreter} rpython/bin/rpython --make-jobs="$NIX_BUILD_CORES" -Ojit --batch pypy/goal/targetpypystandalone.py --withmod-_minimal_curses --withmod-unicodedata --withmod-thread --withmod-bz2 --withmod-_multiprocessing
+ ${python.interpreter} rpython/bin/rpython --make-jobs="$NIX_BUILD_CORES" -Ojit --batch pypy/goal/targetpypystandalone.py --withmod-_minimal_curses --withmod-unicodedata --withmod-thread --withmod-bz2 --withmod-_multiprocessing
'';
setupHook = ./setup-hook.sh;
@@ -113,6 +115,9 @@ let
# verify cffi modules
$out/bin/pypy -c "import Tkinter;import sqlite3;import curses"
+
+ # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484
+ echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py
'';
passthru = rec {