Merge commit staging+systemd into closure-size
Many non-conflict problems weren't (fully) resolved in this commit yet.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false
|
||||
, sqlite, tcl, tk, x11, openssl, readline, db, ncurses, gdbm, self, callPackage }:
|
||||
, sqlite, tcl, tk, xlibsWrapper, openssl, readline, db, ncurses, gdbm, self, callPackage }:
|
||||
|
||||
assert zlibSupport -> zlib != null;
|
||||
|
||||
@@ -9,7 +9,6 @@ let
|
||||
majorVersion = "2.6";
|
||||
version = "${majorVersion}.9";
|
||||
|
||||
# python 2.6 will receive security fixes until Oct 2013
|
||||
src = fetchurl {
|
||||
url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
|
||||
sha256 = "0hbfs2691b60c7arbysbzr0w9528d5pl8a4x7mq5psh6a2cvprya";
|
||||
@@ -46,9 +45,11 @@ let
|
||||
touch $out/include/python${majorVersion}/pyconfig.h
|
||||
'';
|
||||
|
||||
configureFlags = "--enable-shared --with-threads --enable-unicode=ucs4";
|
||||
|
||||
buildInputs =
|
||||
optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
|
||||
[ bzip2 openssl ]++ optionals includeModules [ db openssl ncurses gdbm readline x11 tcl tk sqlite ]
|
||||
[ bzip2 openssl ]++ optionals includeModules [ db openssl ncurses gdbm readline xlibsWrapper tcl tk sqlite ]
|
||||
++ optional zlibSupport zlib;
|
||||
|
||||
mkPaths = paths: {
|
||||
@@ -62,12 +63,11 @@ let
|
||||
name = "python${if includeModules then "" else "-minimal"}-${version}";
|
||||
pythonVersion = majorVersion;
|
||||
|
||||
inherit majorVersion version src patches buildInputs preConfigure;
|
||||
inherit majorVersion version src patches buildInputs preConfigure
|
||||
configureFlags;
|
||||
|
||||
inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
|
||||
|
||||
configureFlags = "--enable-shared --with-threads --enable-unicode";
|
||||
|
||||
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
@@ -120,6 +120,10 @@ let
|
||||
license = stdenv.lib.licenses.psfl;
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
maintainers = with stdenv.lib.maintainers; [ simons chaoflow iElectric ];
|
||||
# If you want to use Python 2.6, remove "broken = true;" at your own
|
||||
# risk. Python 2.6 has known security vulnerabilities is not receiving
|
||||
# security updates as of October 2013.
|
||||
broken = true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -134,7 +138,7 @@ let
|
||||
if includeModules then null else stdenv.mkDerivation rec {
|
||||
name = "python-${moduleName}-${python.version}";
|
||||
|
||||
inherit src patches preConfigure;
|
||||
inherit src patches preConfigure configureFlags;
|
||||
|
||||
buildInputs = [ python ] ++ deps;
|
||||
|
||||
@@ -146,6 +150,7 @@ let
|
||||
'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 =
|
||||
@@ -169,7 +174,7 @@ let
|
||||
crypt = buildInternalPythonModule {
|
||||
moduleName = "crypt";
|
||||
internalName = "crypt";
|
||||
deps = [ ];
|
||||
deps = optional (stdenv ? glibc) stdenv.glibc;
|
||||
};
|
||||
|
||||
curses = buildInternalPythonModule {
|
||||
@@ -195,7 +200,7 @@ let
|
||||
|
||||
tkinter = buildInternalPythonModule {
|
||||
moduleName = "tkinter";
|
||||
deps = [ tcl tk x11 ];
|
||||
deps = [ tcl tk xlibsWrapper ];
|
||||
};
|
||||
|
||||
readline = buildInternalPythonModule {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
--- origsrc/Lib/ctypes/util.py 2007-09-14 15:05:26.000000000 -0500
|
||||
+++ src/Lib/ctypes/util.py 2008-11-25 17:54:47.319296200 -0600
|
||||
@@ -41,6 +41,20 @@
|
||||
continue
|
||||
return None
|
||||
|
||||
+elif sys.platform == "cygwin":
|
||||
+ def find_library(name):
|
||||
+ for libdir in ['/usr/lib', '/usr/local/lib']:
|
||||
+ for libext in ['lib%s.dll.a' % name, 'lib%s.a' % name]:
|
||||
+ implib = os.path.join(libdir, libext)
|
||||
+ if not os.path.exists(implib):
|
||||
+ continue
|
||||
+ cmd = "dlltool -I " + implib + " 2>/dev/null"
|
||||
+ res = os.popen(cmd).read().replace("\n","")
|
||||
+ if not res:
|
||||
+ continue
|
||||
+ return res
|
||||
+ return None
|
||||
+
|
||||
elif os.name == "posix":
|
||||
# Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
|
||||
import re, tempfile, errno
|
||||
@@ -157,6 +173,10 @@
|
||||
print cdll.LoadLibrary("libcrypto.dylib")
|
||||
print cdll.LoadLibrary("libSystem.dylib")
|
||||
print cdll.LoadLibrary("System.framework/System")
|
||||
+ elif sys.platform == "cygwin":
|
||||
+ print cdll.LoadLibrary("cygbz2-1.dll")
|
||||
+ print find_library("crypt")
|
||||
+ print cdll.LoadLibrary("cygcrypt-0.dll")
|
||||
else:
|
||||
print cdll.LoadLibrary("libm.so")
|
||||
print cdll.LoadLibrary("libcrypt.so")
|
||||
@@ -0,0 +1,27 @@
|
||||
--- origsrc/setup.py 2008-02-04 17:41:02.000000000 -0600
|
||||
+++ src/setup.py 2008-07-02 02:11:28.671875000 -0500
|
||||
@@ -1277,12 +1279,6 @@
|
||||
include_dirs.append('/usr/X11/include')
|
||||
added_lib_dirs.append('/usr/X11/lib')
|
||||
|
||||
- # If Cygwin, then verify that X is installed before proceeding
|
||||
- if host_platform == 'cygwin':
|
||||
- x11_inc = find_file('X11/Xlib.h', [], include_dirs)
|
||||
- if x11_inc is None:
|
||||
- return
|
||||
-
|
||||
# Check for BLT extension
|
||||
if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
|
||||
'BLT8.0'):
|
||||
@@ -1300,9 +1296,8 @@
|
||||
if host_platform in ['aix3', 'aix4']:
|
||||
libs.append('ld')
|
||||
|
||||
- # Finally, link with the X11 libraries (not appropriate on cygwin)
|
||||
- if host_platform != "cygwin":
|
||||
- libs.append('X11')
|
||||
+ # Finally, link with the X11 libraries
|
||||
+ libs.append('X11')
|
||||
|
||||
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
|
||||
define_macros=[('WITH_APPINIT', 1)] + defs,
|
||||
@@ -0,0 +1,13 @@
|
||||
--- origsrc/Modules/_ssl.c 2009-01-26 10:55:41.000000000 -0600
|
||||
+++ src/Modules/_ssl.c 2009-08-20 00:04:59.346816700 -0500
|
||||
@@ -15,6 +15,10 @@
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
+#ifdef __CYGWIN__
|
||||
+#undef WITH_THREAD
|
||||
+#endif
|
||||
+
|
||||
#ifdef WITH_THREAD
|
||||
#include "pythread.h"
|
||||
#define PySSL_BEGIN_ALLOW_THREADS { \
|
||||
@@ -0,0 +1,41 @@
|
||||
--- Python-2.6.5.orig/Modules/selectmodule.c 2012-02-02 22:35:21.835125000 -0500
|
||||
+++ Python-2.6.5/Modules/selectmodule.c 2012-02-02 22:41:41.210125000 -0500
|
||||
@@ -6,6 +6,21 @@
|
||||
>= 0.
|
||||
*/
|
||||
|
||||
+/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined.
|
||||
+ 64 is too small (too many people have bumped into that limit).
|
||||
+ Here we boost it.
|
||||
+
|
||||
+ Cygwin also defines FD_SETSIZE to 64, so also increase the limit on
|
||||
+ Cygwin. We must do this before sys/types.h is included, which otherwise
|
||||
+ sets FD_SETSIZE to the default.
|
||||
+
|
||||
+ Users who want even more than the boosted limit should #define
|
||||
+ FD_SETSIZE higher before this; e.g., via compiler /D switch.
|
||||
+*/
|
||||
+#if (defined(MS_WINDOWS) || defined(__CYGWIN__)) && !defined(FD_SETSIZE)
|
||||
+#define FD_SETSIZE 512
|
||||
+#endif
|
||||
+
|
||||
#include "Python.h"
|
||||
#include <structmember.h>
|
||||
|
||||
@@ -16,16 +31,6 @@
|
||||
#undef HAVE_BROKEN_POLL
|
||||
#endif
|
||||
|
||||
-/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined.
|
||||
- 64 is too small (too many people have bumped into that limit).
|
||||
- Here we boost it.
|
||||
- Users who want even more than the boosted limit should #define
|
||||
- FD_SETSIZE higher before this; e.g., via compiler /D switch.
|
||||
-*/
|
||||
-#if defined(MS_WINDOWS) && !defined(FD_SETSIZE)
|
||||
-#define FD_SETSIZE 512
|
||||
-#endif
|
||||
-
|
||||
#if defined(HAVE_POLL_H)
|
||||
#include <poll.h>
|
||||
#elif defined(HAVE_SYS_POLL_H)
|
||||
@@ -0,0 +1,11 @@
|
||||
--- origsrc/Include/pyerrors.h 2008-06-08 23:58:54.000000000 -0500
|
||||
+++ src/Include/pyerrors.h 2010-05-12 04:19:31.535297200 -0500
|
||||
@@ -232,7 +232,7 @@ PyAPI_FUNC(int) PyErr_CheckSignals(void)
|
||||
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
|
||||
|
||||
/* In signalmodule.c */
|
||||
-int PySignal_SetWakeupFd(int fd);
|
||||
+PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd);
|
||||
|
||||
/* Support for adding program text to SyntaxErrors */
|
||||
PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
|
||||
@@ -0,0 +1,16 @@
|
||||
--- origsrc/Include/py_curses.h 2009-09-06 16:23:05.000000000 -0500
|
||||
+++ src/Include/py_curses.h 2010-04-14 15:21:23.008971400 -0500
|
||||
@@ -17,6 +17,13 @@
|
||||
#define NCURSES_OPAQUE 0
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
+#ifdef __CYGWIN__
|
||||
+/* the following define is necessary for Cygwin; without it, the
|
||||
+ Cygwin-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
|
||||
+ can't get at the WINDOW flags field. */
|
||||
+#define NCURSES_INTERNALS
|
||||
+#endif /* __CYGWIN__ */
|
||||
+
|
||||
#ifdef __FreeBSD__
|
||||
/*
|
||||
** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards
|
||||
27
pkgs/development/interpreters/python/2.7/2.7.3-dbm.patch
Normal file
27
pkgs/development/interpreters/python/2.7/2.7.3-dbm.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
--- origsrc/setup.py.orig 2012-11-27 10:20:47.442395900 -0500
|
||||
+++ src/setup.py 2012-11-27 10:53:15.583020900 -0500
|
||||
@@ -1141,7 +1141,7 @@
|
||||
|
||||
dbm_order = ['gdbm']
|
||||
# The standard Unix dbm module:
|
||||
- if host_platform not in ['cygwin']:
|
||||
+ if host_platform not in ['win32']:
|
||||
config_args = [arg.strip("'")
|
||||
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
|
||||
dbm_args = [arg for arg in config_args
|
||||
@@ -1192,6 +1192,15 @@
|
||||
],
|
||||
libraries = gdbm_libs)
|
||||
break
|
||||
+ if find_file("ndbm.h", inc_dirs, []) is not None:
|
||||
+ print("building dbm using gdbm")
|
||||
+ dbmext = Extension(
|
||||
+ 'dbm', ['dbmmodule.c'],
|
||||
+ define_macros=[
|
||||
+ ('HAVE_NDBM_H', None),
|
||||
+ ],
|
||||
+ libraries = gdbm_libs)
|
||||
+ break
|
||||
elif cand == "bdb":
|
||||
if db_incs is not None:
|
||||
print "building dbm using bdb"
|
||||
10
pkgs/development/interpreters/python/2.7/2.7.3-dylib.patch
Normal file
10
pkgs/development/interpreters/python/2.7/2.7.3-dylib.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
--- origsrc/Lib/distutils/unixccompiler.py.orig 2012-11-27 07:44:15.409993500 -0500
|
||||
+++ src/Lib/distutils/unixccompiler.py 2012-11-27 08:09:57.801770900 -0500
|
||||
@@ -141,6 +141,7 @@
|
||||
static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
|
||||
if sys.platform == "cygwin":
|
||||
exe_extension = ".exe"
|
||||
+ dylib_lib_extension = ".dll.a"
|
||||
|
||||
def preprocess(self, source,
|
||||
output_file=None, macros=None, include_dirs=None,
|
||||
@@ -0,0 +1,31 @@
|
||||
--- origsrc/Modules/getpath.c.orig 2012-11-27 12:07:56.098645900 -0500
|
||||
+++ src/Modules/getpath.c 2012-11-27 12:10:11.254895900 -0500
|
||||
@@ -436,6 +436,28 @@
|
||||
if (isxfile(progpath))
|
||||
break;
|
||||
|
||||
+#ifdef __CYGWIN__
|
||||
+ /*
|
||||
+ * Cygwin automatically removes the ".exe" extension from argv[0]
|
||||
+ * to make programs feel like they are in a more Unix-like
|
||||
+ * environment. Unfortunately, this can make it problemmatic for
|
||||
+ * Cygwin to distinguish between a directory and an executable with
|
||||
+ * the same name excluding the ".exe" extension. For example, the
|
||||
+ * Cygwin Python build directory has a "Python" directory and a
|
||||
+ * "python.exe" executable. This causes isxfile() to erroneously
|
||||
+ * return false. If isdir() returns true and there is enough space
|
||||
+ * to append the ".exe" extension, then we try again with the
|
||||
+ * extension appended.
|
||||
+ */
|
||||
+#define EXE ".exe"
|
||||
+ if (isdir(progpath) && strlen(progpath) + strlen(EXE) <= MAXPATHLEN)
|
||||
+ {
|
||||
+ strcat(progpath, EXE);
|
||||
+ if (isxfile(progpath))
|
||||
+ break;
|
||||
+ }
|
||||
+#endif /* __CYGWIN__ */
|
||||
+
|
||||
if (!delim) {
|
||||
progpath[0] = '\0';
|
||||
break;
|
||||
11
pkgs/development/interpreters/python/2.7/2.7.3-no-libm.patch
Normal file
11
pkgs/development/interpreters/python/2.7/2.7.3-no-libm.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- origsrc/setup.py.orig 2012-11-27 09:28:34.051770900 -0500
|
||||
+++ src/setup.py 2012-11-27 09:28:47.239270900 -0500
|
||||
@@ -470,7 +470,7 @@
|
||||
|
||||
# Check for MacOS X, which doesn't need libm.a at all
|
||||
math_libs = ['m']
|
||||
- if host_platform in ['darwin', 'beos']:
|
||||
+ if host_platform in ['darwin', 'beos', 'cygwin']:
|
||||
math_libs = []
|
||||
|
||||
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
|
||||
@@ -1,29 +1,32 @@
|
||||
{ stdenv, fetchurl, self, callPackage
|
||||
, bzip2, openssl
|
||||
, bzip2, openssl, gettext
|
||||
|
||||
, includeModules ? false
|
||||
|
||||
, db, gdbm, ncurses, sqlite, readline
|
||||
|
||||
, tcl ? null, tk ? null, x11 ? null, libX11 ? null, x11Support ? true
|
||||
, tcl ? null, tk ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? !stdenv.isCygwin
|
||||
, zlib ? null, zlibSupport ? true
|
||||
, expat, libffi
|
||||
|
||||
, CF, configd
|
||||
}:
|
||||
|
||||
assert zlibSupport -> zlib != null;
|
||||
assert x11Support -> tcl != null
|
||||
&& tk != null
|
||||
&& x11 != null
|
||||
&& xlibsWrapper != null
|
||||
&& libX11 != null;
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
let
|
||||
majorVersion = "2.7";
|
||||
version = "${majorVersion}.9";
|
||||
version = "${majorVersion}.10";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
|
||||
sha256 = "05j9in7yygfgl6nml0rixfvj1bbip982w3l54q05f0vyx8a7xllh";
|
||||
sha256 = "1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw";
|
||||
};
|
||||
|
||||
patches =
|
||||
@@ -39,6 +42,19 @@ let
|
||||
# patch python to put zero timestamp into pyc
|
||||
# if DETERMINISTIC_BUILD env var is set
|
||||
./deterministic-build.patch
|
||||
|
||||
./properly-detect-curses.patch
|
||||
] ++ optionals stdenv.isCygwin [
|
||||
./2.5.2-ctypes-util-find_library.patch
|
||||
./2.5.2-tkinter-x11.patch
|
||||
./2.6.2-ssl-threads.patch
|
||||
./2.6.5-export-PySignal_SetWakeupFd.patch
|
||||
./2.6.5-FD_SETSIZE.patch
|
||||
./2.6.5-ncurses-abi6.patch
|
||||
./2.7.3-dbm.patch
|
||||
./2.7.3-dylib.patch
|
||||
./2.7.3-getpath-exe-extension.patch
|
||||
./2.7.3-no-libm.patch
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
@@ -50,22 +66,40 @@ let
|
||||
for i in Lib/plat-*/regen; do
|
||||
substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/
|
||||
done
|
||||
'' + optionalString stdenv.isCygwin ''
|
||||
# On Cygwin, `make install' tries to read this Makefile.
|
||||
mkdir -p $out/lib/python${majorVersion}/config
|
||||
touch $out/lib/python${majorVersion}/config/Makefile
|
||||
mkdir -p $out/include/python${majorVersion}
|
||||
touch $out/include/python${majorVersion}/pyconfig.h
|
||||
'' + optionalString stdenv.isDarwin ''
|
||||
substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
|
||||
'';
|
||||
|
||||
configureFlags = [
|
||||
"--enable-shared"
|
||||
"--with-threads"
|
||||
"--enable-unicode=ucs4"
|
||||
] ++ optionals stdenv.isCygwin [
|
||||
"--with-system-ffi"
|
||||
"--with-system-expat"
|
||||
"ac_cv_func_bind_textdomain_codeset=yes"
|
||||
] ++ optionals stdenv.isDarwin [
|
||||
"--disable-toolbox-glue"
|
||||
];
|
||||
|
||||
postConfigure = if stdenv.isCygwin then ''
|
||||
sed -i Makefile -e 's,PYTHONPATH="$(srcdir),PYTHONPATH="$(abs_srcdir),'
|
||||
'' else null;
|
||||
|
||||
buildInputs =
|
||||
optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
|
||||
[ bzip2 openssl ]
|
||||
++ optionals stdenv.isCygwin [ expat libffi ]
|
||||
++ optionals includeModules (
|
||||
[ db gdbm ncurses sqlite readline
|
||||
] ++ optionals x11Support [ tcl tk x11 libX11 ]
|
||||
] ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
|
||||
)
|
||||
++ optional zlibSupport zlib;
|
||||
++ optional zlibSupport zlib
|
||||
|
||||
# depend on CF and configd only if purity is an issue
|
||||
# the impure bootstrap compiler can't build CoreFoundation currently. it requires
|
||||
# <mach-o/dyld.h> which is in our pure bootstrapTools, but not in the system headers.
|
||||
++ optionals (stdenv.isDarwin && !stdenv.cc.nativeLibc) [ CF configd ];
|
||||
|
||||
mkPaths = paths: {
|
||||
C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p.dev or p}/include") paths);
|
||||
@@ -78,13 +112,12 @@ let
|
||||
name = "python-${version}";
|
||||
pythonVersion = majorVersion;
|
||||
|
||||
inherit majorVersion version src patches buildInputs preConfigure;
|
||||
inherit majorVersion version src patches buildInputs preConfigure
|
||||
configureFlags;
|
||||
|
||||
LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
|
||||
inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
|
||||
|
||||
configureFlags = "--enable-shared --with-threads --enable-unicode";
|
||||
|
||||
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
|
||||
DETERMINISTIC_BUILD = 1;
|
||||
|
||||
@@ -155,17 +188,21 @@ let
|
||||
if includeModules then null else stdenv.mkDerivation rec {
|
||||
name = "python-${moduleName}-${python.version}";
|
||||
|
||||
inherit src patches preConfigure;
|
||||
inherit src patches preConfigure postConfigure configureFlags;
|
||||
|
||||
buildInputs = [ python ] ++ deps;
|
||||
|
||||
inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
|
||||
|
||||
buildPhase = ''
|
||||
# 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 =
|
||||
@@ -199,13 +236,13 @@ let
|
||||
crypt = buildInternalPythonModule {
|
||||
moduleName = "crypt";
|
||||
internalName = "crypt";
|
||||
deps = [ ];
|
||||
deps = optional (stdenv ? glibc) stdenv.glibc;
|
||||
};
|
||||
|
||||
gdbm = buildInternalPythonModule {
|
||||
moduleName = "gdbm";
|
||||
internalName = "gdbm";
|
||||
deps = [ gdbm ];
|
||||
deps = [ gdbm ] ++ stdenv.lib.optional stdenv.isCygwin gettext;
|
||||
};
|
||||
|
||||
sqlite3 = buildInternalPythonModule {
|
||||
@@ -215,10 +252,10 @@ let
|
||||
|
||||
} // optionalAttrs x11Support {
|
||||
|
||||
tkinter = buildInternalPythonModule {
|
||||
tkinter = if stdenv.isCygwin then null else (buildInternalPythonModule {
|
||||
moduleName = "tkinter";
|
||||
deps = [ tcl tk x11 libX11 ];
|
||||
};
|
||||
deps = [ tcl tk xlibsWrapper libX11 ];
|
||||
});
|
||||
|
||||
} // {
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
From 6dc83db69b5e29d25ba6d73646ea2e9a1097848a Mon Sep 17 00:00:00 2001
|
||||
From: Roumen Petrov <local@example.net>
|
||||
Date: Sun, 19 Feb 2012 16:13:24 +0200
|
||||
Subject: [PATCH] CROSS-properly detect WINDOW _flags for different ncurses versions
|
||||
|
||||
---
|
||||
Include/py_curses.h | 5 +++++
|
||||
configure.ac | 40 ++++++++++++++++++++++++++++++++++++++--
|
||||
pyconfig.h.in | 6 ++++++
|
||||
3 files changed, 49 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Include/py_curses.h b/Include/py_curses.h
|
||||
index f2c08f6..a9b5260 100644
|
||||
--- a/Include/py_curses.h
|
||||
+++ b/Include/py_curses.h
|
||||
@@ -14,7 +14,9 @@
|
||||
/* the following define is necessary for OS X 10.6; without it, the
|
||||
Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
|
||||
can't get at the WINDOW flags field. */
|
||||
+/* NOTE configure check if ncurses require such definition
|
||||
#define NCURSES_OPAQUE 0
|
||||
+*/
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
@@ -57,9 +59,12 @@
|
||||
#ifdef HAVE_NCURSES_H
|
||||
/* configure was checking <curses.h>, but we will
|
||||
use <ncurses.h>, which has all these features. */
|
||||
+/* NOTE configure check for existence of flags
|
||||
+ * Also flags are visible only if WINDOW structure is not opaque
|
||||
#ifndef WINDOW_HAS_FLAGS
|
||||
#define WINDOW_HAS_FLAGS 1
|
||||
#endif
|
||||
+*/
|
||||
#ifndef MVWDELCH_IS_EXPRESSION
|
||||
#define MVWDELCH_IS_EXPRESSION 1
|
||||
#endif
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 0a3a186..75f5142 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -4150,15 +4150,51 @@ then
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether WINDOW has _flags)
|
||||
-AC_CACHE_VAL(ac_cv_window_has_flags,
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
|
||||
WINDOW *w;
|
||||
w->_flags = 0;
|
||||
]])],
|
||||
[ac_cv_window_has_flags=yes],
|
||||
-[ac_cv_window_has_flags=no]))
|
||||
+[ac_cv_window_has_flags=no])
|
||||
AC_MSG_RESULT($ac_cv_window_has_flags)
|
||||
|
||||
+py_curses_window_is_opaque=no
|
||||
+if test no = $ac_cv_window_has_flags; then
|
||||
+ AC_MSG_CHECKING([whether WINDOW has _flags in non-opaque structure])
|
||||
+ AC_COMPILE_IFELSE([
|
||||
+ AC_LANG_PROGRAM([[
|
||||
+ #define NCURSES_OPAQUE 0
|
||||
+ #include <curses.h>
|
||||
+ ]],[[
|
||||
+ WINDOW *w;
|
||||
+ w->_flags = 0;
|
||||
+ ]])],
|
||||
+ [py_curses_window_is_opaque=yes])
|
||||
+ AC_MSG_RESULT([$py_curses_window_is_opaque])
|
||||
+fi
|
||||
+if test yes = $py_curses_window_is_opaque; then
|
||||
+ ac_cv_window_has_flags=yes
|
||||
+ AC_DEFINE([NCURSES_OPAQUE], [0], [Define to 0 if you have WINDOW _flags in non-opaque structure.])
|
||||
+fi
|
||||
+
|
||||
+py_curses_window_is_internal=no
|
||||
+if test no = $ac_cv_window_has_flags; then
|
||||
+ AC_MSG_CHECKING([whether WINDOW has _flags as internal structure])
|
||||
+ AC_COMPILE_IFELSE([
|
||||
+ AC_LANG_PROGRAM([[
|
||||
+ #define NCURSES_INTERNALS 1
|
||||
+ #include <curses.h>
|
||||
+ ]],[[
|
||||
+ WINDOW *w;
|
||||
+ w->_flags = 0;
|
||||
+ ]])],
|
||||
+ [py_curses_window_is_internal=yes])
|
||||
+ AC_MSG_RESULT([$py_curses_window_is_internal])
|
||||
+fi
|
||||
+if test yes = $py_curses_window_is_internal; then
|
||||
+ ac_cv_window_has_flags=yes
|
||||
+ AC_DEFINE([NCURSES_INTERNALS], [1], [Define to 1 if you have WINDOW _flags as internal structure.])
|
||||
+fi
|
||||
|
||||
if test "$ac_cv_window_has_flags" = yes
|
||||
then
|
||||
diff --git a/pyconfig.h.in b/pyconfig.h.in
|
||||
index 3ca3a4f..484c817 100644
|
||||
--- a/pyconfig.h.in
|
||||
+++ b/pyconfig.h.in
|
||||
@@ -1130,6 +1130,12 @@
|
||||
/* Define if mvwdelch in curses.h is an expression. */
|
||||
#undef MVWDELCH_IS_EXPRESSION
|
||||
|
||||
+/* Define to 1 if you have WINDOW _flags as internal structure. */
|
||||
+#undef NCURSES_INTERNALS
|
||||
+
|
||||
+/* Define to 0 if you have WINDOW _flags in non-opaque structure. */
|
||||
+#undef NCURSES_OPAQUE
|
||||
+
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
--
|
||||
1.6.4
|
||||
|
||||
@@ -43,7 +43,7 @@ stdenv.mkDerivation {
|
||||
done
|
||||
${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''}
|
||||
|
||||
configureFlagsArray=( --enable-shared --with-threads
|
||||
configureFlagsArray=( --enable-shared --with-threads --with-wide-unicode
|
||||
CPPFLAGS="${concatStringsSep " " (map (p: "-I${p}/include") buildInputs)}"
|
||||
LDFLAGS="${concatStringsSep " " (map (p: "-L${p}/lib") buildInputs)}"
|
||||
LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}"
|
||||
|
||||
112
pkgs/development/interpreters/python/3.5/default.nix
Normal file
112
pkgs/development/interpreters/python/3.5/default.nix
Normal file
@@ -0,0 +1,112 @@
|
||||
{ stdenv, fetchurl
|
||||
, bzip2
|
||||
, db
|
||||
, gdbm
|
||||
, libX11, xproto
|
||||
, lzma
|
||||
, ncurses
|
||||
, openssl
|
||||
, readline
|
||||
, sqlite
|
||||
, tcl, tk
|
||||
, zlib
|
||||
, callPackage
|
||||
, self
|
||||
}:
|
||||
|
||||
assert readline != null -> ncurses != null;
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
let
|
||||
majorVersion = "3.5";
|
||||
pythonVersion = majorVersion;
|
||||
version = "${majorVersion}.0";
|
||||
fullVersion = "${version}";
|
||||
|
||||
buildInputs = filter (p: p != null) [
|
||||
zlib bzip2 lzma gdbm sqlite db readline ncurses openssl tcl tk libX11 xproto
|
||||
];
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "python3-${fullVersion}";
|
||||
pythonVersion = majorVersion;
|
||||
inherit majorVersion version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.python.org/ftp/python/${version}/Python-${fullVersion}.tar.xz";
|
||||
sha256 = "14dywb94mci0kqbsji9riyyq8kx0h9ljdjjgxnkfrvm56hbammyn";
|
||||
};
|
||||
|
||||
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
|
||||
|
||||
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
|
||||
''}
|
||||
|
||||
configureFlagsArray=( --enable-shared --with-threads
|
||||
CPPFLAGS="${concatStringsSep " " (map (p: "-I${p}/include") buildInputs)}"
|
||||
LDFLAGS="${concatStringsSep " " (map (p: "-L${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; };
|
||||
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 = stdenv.lib.licenses.psfl;
|
||||
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
||||
maintainers = with stdenv.lib.maintainers; [ simons chaoflow iElectric cstrahan ];
|
||||
};
|
||||
}
|
||||
15
pkgs/development/interpreters/python/3.5/setup-hook.sh
Normal file
15
pkgs/development/interpreters/python/3.5/setup-hook.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
addPythonPath() {
|
||||
addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python3.5/site-packages
|
||||
}
|
||||
|
||||
toPythonPath() {
|
||||
local paths="$1"
|
||||
local result=
|
||||
for i in $paths; do
|
||||
p="$i/lib/python3.5/site-packages"
|
||||
result="${result}${result:+:}$p"
|
||||
done
|
||||
echo $result
|
||||
}
|
||||
|
||||
envHooks+=(addPythonPath)
|
||||
@@ -6,28 +6,40 @@
|
||||
# Create a python executable that knows about additional packages.
|
||||
let
|
||||
recursivePthLoader = import ../../python-modules/recursive-pth-loader/default.nix { stdenv = stdenv; python = python; };
|
||||
in
|
||||
(buildEnv {
|
||||
name = "${python.name}-env";
|
||||
paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python recursivePthLoader ];
|
||||
env = (buildEnv {
|
||||
name = "${python.name}-env";
|
||||
paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python recursivePthLoader ];
|
||||
|
||||
inherit ignoreCollisions;
|
||||
inherit ignoreCollisions;
|
||||
|
||||
postBuild = ''
|
||||
. "${makeWrapper}/nix-support/setup-hook"
|
||||
postBuild = ''
|
||||
. "${makeWrapper}/nix-support/setup-hook"
|
||||
|
||||
if [ -L "$out/bin" ]; then
|
||||
unlink "$out/bin"
|
||||
fi
|
||||
mkdir -p "$out/bin"
|
||||
if [ -L "$out/bin" ]; then
|
||||
unlink "$out/bin"
|
||||
fi
|
||||
mkdir -p "$out/bin"
|
||||
|
||||
cd "${python}/bin"
|
||||
for prg in *; do
|
||||
rm -f "$out/bin/$prg"
|
||||
makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
|
||||
done
|
||||
'' + postBuild;
|
||||
}) // {
|
||||
inherit python;
|
||||
inherit (python) meta;
|
||||
}
|
||||
cd "${python}/bin"
|
||||
for prg in *; do
|
||||
rm -f "$out/bin/$prg"
|
||||
makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
|
||||
done
|
||||
'' + postBuild;
|
||||
|
||||
passthru.env = stdenv.mkDerivation {
|
||||
name = "interactive-${python.name}-environment";
|
||||
nativeBuildInputs = [ env ];
|
||||
|
||||
buildCommand = ''
|
||||
echo >&2 ""
|
||||
echo >&2 "*** Python 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
|
||||
echo >&2 ""
|
||||
exit 1
|
||||
'';
|
||||
};
|
||||
}) // {
|
||||
inherit python;
|
||||
inherit (python) meta;
|
||||
};
|
||||
in env
|
||||
|
||||
Reference in New Issue
Block a user