diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
commit | c4625b175f8200f643fd6e11010932ea44c78433 (patch) | |
tree | bce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython | |
parent | 49f735974dd103039ddc4cb576bb76555164a9e7 (diff) | |
parent | d661aa56a8843e991261510c1bb28fdc2f6975ae (diff) |
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie
git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7
git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython')
49 files changed, 3214 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-ctypes-util-find_library.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-ctypes-util-find_library.patch new file mode 100644 index 000000000000..22bc0f7ced0a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-ctypes-util-find_library.patch @@ -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") diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-tkinter-x11.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-tkinter-x11.patch new file mode 100644 index 000000000000..28b6dafc3f15 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-tkinter-x11.patch @@ -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, diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.2-ssl-threads.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.2-ssl-threads.patch new file mode 100644 index 000000000000..bef137efda7b --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.2-ssl-threads.patch @@ -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 { \ diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-FD_SETSIZE.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-FD_SETSIZE.patch new file mode 100644 index 000000000000..d1dae8c47dc1 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-FD_SETSIZE.patch @@ -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) diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-export-PySignal_SetWakeupFd.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-export-PySignal_SetWakeupFd.patch new file mode 100644 index 000000000000..ea696978236a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-export-PySignal_SetWakeupFd.patch @@ -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); diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-ncurses-abi6.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-ncurses-abi6.patch new file mode 100644 index 000000000000..e1cf5ad4bbf9 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-ncurses-abi6.patch @@ -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 diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dbm.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dbm.patch new file mode 100644 index 000000000000..bfaeb37c287d --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dbm.patch @@ -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" diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dylib.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dylib.patch new file mode 100644 index 000000000000..6e1fc8b53e83 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dylib.patch @@ -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, diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-getpath-exe-extension.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-getpath-exe-extension.patch new file mode 100644 index 000000000000..68f6921ba6aa --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-getpath-exe-extension.patch @@ -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; diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-no-libm.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-no-libm.patch new file mode 100644 index 000000000000..55281db6768f --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-no-libm.patch @@ -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 diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/CVE-2019-20907.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/CVE-2019-20907.patch new file mode 100644 index 000000000000..cf67ae2b51be --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/CVE-2019-20907.patch @@ -0,0 +1,24 @@ +From 5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4 Mon Sep 17 00:00:00 2001 +From: Rishi <rishi_devan@mail.com> +Date: Wed, 15 Jul 2020 13:51:00 +0200 +Subject: [PATCH] bpo-39017: Avoid infinite loop in the tarfile module + (GH-21454) + +Avoid infinite loop when reading specially crafted TAR files using the tarfile module +(CVE-2019-20907). +--- + Lib/tarfile.py | 2 ++ + +diff --git a/Lib/tarfile.py b/Lib/tarfile.py +index e2b60532f6..6769066cab 100755 +--- a/Lib/tarfile.py ++++ b/Lib/tarfile.py +@@ -1249,6 +1249,8 @@ class TarInfo(object): + + length, keyword = match.groups() + length = int(length) ++ if length == 0: ++ raise InvalidHeaderError("invalid header") + value = buf[match.end(2) + 1:match.start(1) + length - 1] + + # Normally, we could just use "utf-8" as the encoding and "strict" diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/atomic_pyc.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/atomic_pyc.patch new file mode 100644 index 000000000000..06d3718d4993 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/atomic_pyc.patch @@ -0,0 +1,116 @@ +diff --git a/Lib/py_compile.py b/Lib/py_compile.py +index 978da73d74..3559eb95ca 100644 +--- a/Lib/py_compile.py ++++ b/Lib/py_compile.py +@@ -120,16 +120,27 @@ def compile(file, cfile=None, dfile=None, doraise=False): + return + if cfile is None: + cfile = file + (__debug__ and 'c' or 'o') +- with open(cfile, 'wb') as fc: +- fc.write('\0\0\0\0') +- if "DETERMINISTIC_BUILD" in os.environ: ++ # Atomically write the pyc/pyo file. Issue #13146. ++ # id() is used to generate a pseudo-random filename. ++ path_tmp = '{}.{}'.format(cfile, id(cfile)) ++ try: ++ with open(path_tmp, 'wb') as fc: + fc.write('\0\0\0\0') +- else: +- wr_long(fc, timestamp) +- marshal.dump(codeobject, fc) +- fc.flush() +- fc.seek(0, 0) +- fc.write(MAGIC) ++ if "DETERMINISTIC_BUILD" in os.environ: ++ fc.write('\0\0\0\0') ++ else: ++ wr_long(fc, timestamp) ++ marshal.dump(codeobject, fc) ++ fc.flush() ++ fc.seek(0, 0) ++ fc.write(MAGIC) ++ os.rename(path_tmp, cfile) ++ except OSError: ++ try: ++ os.unlink(path_tmp) ++ except OSError: ++ pass ++ raise + + def main(args=None): + """Compile several source files. +diff --git a/Python/import.c b/Python/import.c +index 1e31d79279..f78a1efcf0 100644 +--- a/Python/import.c ++++ b/Python/import.c +@@ -951,6 +951,8 @@ static void + write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, time_t mtime) + { + FILE *fp; ++ size_t cpathname_len; ++ char *cpathname_tmp; + #ifdef MS_WINDOWS /* since Windows uses different permissions */ + mode_t mode = srcstat->st_mode & ~S_IEXEC; + /* Issue #6074: We ensure user write access, so we can delete it later +@@ -963,11 +965,28 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t + mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH; + #endif + ++#ifdef MS_WINDOWS + fp = open_exclusive(cpathname, mode); ++#else ++ /* Under POSIX, we first write to a tmp file and then take advantage ++ of atomic renaming. */ ++ cpathname_len = strlen(cpathname); ++ cpathname_tmp = PyMem_MALLOC(cpathname_len + 5); ++ if (cpathname_tmp == NULL) { ++ PyErr_Clear(); ++ return; ++ } ++ memcpy(cpathname_tmp, cpathname, cpathname_len); ++ memcpy(cpathname_tmp + cpathname_len, ".tmp", 5); ++ fp = open_exclusive(cpathname_tmp, mode); ++#endif + if (fp == NULL) { + if (Py_VerboseFlag) + PySys_WriteStderr( + "# can't create %s\n", cpathname); ++#ifndef MS_WINDOWS ++ PyMem_FREE(cpathname_tmp); ++#endif + return; + } + PyMarshal_WriteLongToFile(pyc_magic, fp, Py_MARSHAL_VERSION); +@@ -979,7 +998,12 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t + PySys_WriteStderr("# can't write %s\n", cpathname); + /* Don't keep partial file */ + fclose(fp); ++#ifdef MS_WINDOWS + (void) unlink(cpathname); ++#else ++ (void) unlink(cpathname_tmp); ++ PyMem_FREE(cpathname_tmp); ++#endif + return; + } + /* Now write the true mtime (as a 32-bit field) */ +@@ -989,6 +1013,19 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t + PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); + fflush(fp); + } ++ /* Under POSIX, do an atomic rename */ ++#ifndef MS_WINDOWS ++ if (rename(cpathname_tmp, cpathname)) { ++ if (Py_VerboseFlag) ++ PySys_WriteStderr("# can't write %s\n", cpathname); ++ /* Don't keep tmp file */ ++ fclose(fp); ++ (void) unlink(cpathname_tmp); ++ PyMem_FREE(cpathname_tmp); ++ return; ++ } ++ PyMem_FREE(cpathname_tmp); ++#endif + fclose(fp); + if (Py_VerboseFlag) + PySys_WriteStderr("# wrote %s\n", cpathname); diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/cross-compile.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/cross-compile.patch new file mode 100644 index 000000000000..c83b56437a49 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/cross-compile.patch @@ -0,0 +1,32 @@ +--- ./setup.py.orig 2018-04-29 15:47:33.000000000 -0700 ++++ ./setup.py 2018-11-11 09:41:58.097682221 -0800 +@@ -458,8 +458,6 @@ + if not cross_compiling: + add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') +- if cross_compiling: +- self.add_gcc_paths() + self.add_multiarch_paths() + + # Add paths specified in the environment variables LDFLAGS and +@@ -517,7 +515,10 @@ + # be assumed that no additional -I,-L directives are needed. + inc_dirs = self.compiler.include_dirs[:] + lib_dirs = self.compiler.library_dirs[:] +- if not cross_compiling: ++ if cross_compiling: ++ inc_dirs = [] ++ lib_dirs = [] ++ else: + for d in ( + '/usr/include', + ): +@@ -582,6 +584,8 @@ class PyBuildExt(build_ext): + # Some modules that are normally always on: + #exts.append( Extension('_weakref', ['_weakref.c']) ) + ++ self.compiler.library_dirs = lib_dirs + [ '.' ] ++ + # array objects + exts.append( Extension('array', ['arraymodule.c']) ) + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix new file mode 100644 index 000000000000..2cfaa69a4c8b --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -0,0 +1,295 @@ +{ stdenv, fetchurl, fetchpatch +, bzip2 +, expat +, libffi +, gdbm +, db +, ncurses +, openssl +, readline +, sqlite +, tcl ? null, tk ? null, tix ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? false +, zlib +, self +, configd, coreutils +, autoreconfHook +, python-setup-hook +# Some proprietary libs assume UCS2 unicode, especially on darwin :( +, ucsEncoding ? 4 +# For the Python package set +, packageOverrides ? (self: super: {}) +, buildPackages +, sourceVersion +, sha256 +, passthruFun +, static ? false +, enableOptimizations ? (!stdenv.isDarwin) +}: + +assert x11Support -> tcl != null + && tk != null + && xlibsWrapper != null + && libX11 != null; + +with stdenv.lib; + +let + + pythonForBuild = buildPackages.${"python${sourceVersion.major}${sourceVersion.minor}"}; + + passthru = passthruFun rec { + inherit self sourceVersion packageOverrides; + implementation = "cpython"; + libPrefix = "python${pythonVersion}"; + executable = libPrefix; + pythonVersion = with sourceVersion; "${major}.${minor}"; + sitePackages = "lib/${libPrefix}/site-packages"; + inherit hasDistutilsCxxPatch pythonForBuild; + } // { + inherit ucsEncoding; + }; + + version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; + + src = fetchurl { + url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz"; + inherit sha256; + }; + + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); + patches = + [ # Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff. + ./search-path.patch + + # Python recompiles a Python if the mtime stored *in* the + # pyc/pyo file differs from the mtime of the source file. This + # doesn't work in Nix because Nix changes the mtime of files in + # the Nix store to 1. So treat that as a special case. + ./nix-store-mtime.patch + + # patch python to put zero timestamp into pyc + # if DETERMINISTIC_BUILD env var is set + ./deterministic-build.patch + + # Fix python bug #27177 (https://bugs.python.org/issue27177) + # The issue is that `match.group` only recognizes python integers + # instead of everything that has `__index__`. + # This bug was fixed upstream, but not backported to 2.7 + (fetchpatch { + name = "re_match_index.patch"; + url = "https://bugs.python.org/file43084/re_match_index.patch"; + sha256 = "0l9rw6r5r90iybdkp3hhl2pf0h0s1izc68h5d3ywrm92pq32wz57"; + }) + + # Fix race-condition during pyc creation. Has a slight backwards + # incompatible effect: pyc symlinks will now be overridden + # (https://bugs.python.org/issue17222). Included in python >= 3.4, + # backported in debian since 2013. + # https://bugs.python.org/issue13146 + ./atomic_pyc.patch + + # Backport from CPython 3.8 of a good list of tests to run for PGO. + ./profile-task.patch + + # Patch is likely to go away in the next release (if there is any) + ./CVE-2019-20907.patch + ] ++ optionals (x11Support && stdenv.isDarwin) [ + ./use-correct-tcl-tk-on-darwin.patch + ] ++ optionals stdenv.isLinux [ + + # Disable the use of ldconfig in ctypes.util.find_library (since + # ldconfig doesn't work on NixOS), and don't use + # ctypes.util.find_library during the loading of the uuid module + # (since it will do a futile invocation of gcc (!) to find + # libuuid, slowing down program startup a lot). + ./no-ldconfig.patch + + ] ++ optionals stdenv.hostPlatform.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 + ] ++ 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 + ] ++ optional (stdenv.hostPlatform != stdenv.buildPlatform) [ + ./cross-compile.patch + ]; + + preConfigure = '' + # Purity. + for i in /usr /sw /opt /pkg; do + substituteInPlace ./setup.py --replace $i /no-such-path + done + '' + optionalString (stdenv ? cc && stdenv.cc.libc != null) '' + for i in Lib/plat-*/regen; do + substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/ + done + '' + optionalString stdenv.isDarwin '' + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' + substituteInPlace Lib/multiprocessing/__init__.py \ + --replace 'os.popen(comm)' 'os.popen("${coreutils}/bin/nproc")' + ''; + + configureFlags = optionals enableOptimizations [ + "--enable-optimizations" + ] ++ [ + "--enable-shared" + "--with-threads" + "--enable-unicode=ucs${toString ucsEncoding}" + ] ++ optionals (stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isAarch64) [ + "--with-system-ffi" + ] ++ optionals stdenv.hostPlatform.isCygwin [ + "--with-system-expat" + "ac_cv_func_bind_textdomain_codeset=yes" + ] ++ optionals stdenv.isDarwin [ + "--disable-toolbox-glue" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "PYTHON_FOR_BUILD=${getBin buildPackages.python}/bin/python" + "ac_cv_buggy_getaddrinfo=no" + # Assume little-endian IEEE 754 floating point when cross compiling + "ac_cv_little_endian_double=yes" + "ac_cv_big_endian_double=no" + "ac_cv_mixed_endian_double=no" + "ac_cv_x87_double_rounding=yes" + "ac_cv_tanh_preserves_zero_sign=yes" + # Generally assume that things are present and work + "ac_cv_posix_semaphores_enabled=yes" + "ac_cv_broken_sem_getvalue=no" + "ac_cv_wchar_t_signed=yes" + "ac_cv_rshift_extends_sign=yes" + "ac_cv_broken_nice=no" + "ac_cv_broken_poll=no" + "ac_cv_working_tzset=yes" + "ac_cv_have_long_long_format=yes" + "ac_cv_have_size_t_format=yes" + "ac_cv_computed_gotos=yes" + "ac_cv_file__dev_ptmx=yes" + "ac_cv_file__dev_ptc=yes" + ] + # Never even try to use lchmod on linux, + # don't rely on detecting glibc-isms. + ++ optional stdenv.hostPlatform.isLinux "ac_cv_func_lchmod=no" + ++ optional static "LDFLAGS=-static"; + + buildInputs = + optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++ + [ bzip2 openssl zlib ] + ++ optional (stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isAarch64) libffi + ++ optional stdenv.hostPlatform.isCygwin expat + ++ [ db gdbm ncurses sqlite readline ] + ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ] + ++ optional (stdenv.isDarwin && configd != null) configd; + nativeBuildInputs = + [ autoreconfHook ] + ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) + [ buildPackages.stdenv.cc buildPackages.python ]; + + mkPaths = paths: { + C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths; + LIBRARY_PATH = makeLibraryPath paths; + }; + + # Python 2.7 needs this + crossCompileEnv = stdenv.lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) + { _PYTHON_HOST_PLATFORM = stdenv.hostPlatform.config; }; + + # Build the basic Python interpreter without modules that have + # external dependencies. + +in with passthru; stdenv.mkDerivation ({ + pname = "python"; + inherit version; + + inherit src patches buildInputs nativeBuildInputs preConfigure configureFlags; + + LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; + inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH; + + NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2" + + optionalString stdenv.hostPlatform.isMusl " -DTHREAD_STACK_SIZE=0x100000"; + DETERMINISTIC_BUILD = 1; + + setupHook = python-setup-hook sitePackages; + + postPatch = optionalString (x11Support && (tix != null)) '' + substituteInPlace "Lib/lib-tk/Tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + ''; + + postInstall = + '' + # needed for some packages, especially packages that backport + # functionality to 2.x from 3.x + for item in $out/lib/${libPrefix}/test/*; do + if [[ "$item" != */test_support.py* + && "$item" != */test/support + && "$item" != */test/regrtest.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/${libPrefix}/test/__init__.py + ln -s $out/lib/${libPrefix}/pdb.py $out/bin/pdb + ln -s $out/lib/${libPrefix}/pdb.py $out/bin/pdb${sourceVersion.major}.${sourceVersion.minor} + ln -s $out/share/man/man1/{python2.7.1.gz,python.1.gz} + + rm "$out"/lib/python*/plat-*/regen # refers to glibc.dev + + # Determinism: Windows installers were not deterministic. + # We're also not interested in building Windows installers. + find "$out" -name 'wininst*.exe' | xargs -r rm -f + '' + optionalString (stdenv.hostPlatform == stdenv.buildPlatform) + '' + # Determinism: rebuild all bytecode + # We exclude lib2to3 because that's Python 2 code which fails + # We rebuild three times, once for each optimization level + find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i - + '' + optionalString stdenv.hostPlatform.isCygwin '' + cp libpython2.7.dll.a $out/lib + ''; + + inherit passthru; + + postFixup = '' + # Include a sitecustomize.py file. Note it causes an error when it's in postInstall with 2.7. + cp ${../../sitecustomize.py} $out/${sitePackages}/sitecustomize.py + ''; + + enableParallelBuilding = true; + + doCheck = false; # expensive, and fails + + 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 = stdenv.lib.platforms.all; + maintainers = with stdenv.lib.maintainers; [ fridh ]; + # Higher priority than Python 3.x so that `/bin/python` points to `/bin/python2` + # in case both 2 and 3 are installed. + priority = -100; + }; + } // crossCompileEnv) diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/deterministic-build.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/deterministic-build.patch new file mode 100644 index 000000000000..98d9d339fa11 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/deterministic-build.patch @@ -0,0 +1,36 @@ +diff -ur orig/Lib/py_compile.py new/Lib/py_compile.py +--- orig/Lib/py_compile.py ++++ new/Lib/py_compile.py +@@ -122,7 +122,10 @@ + cfile = file + (__debug__ and 'c' or 'o') + with open(cfile, 'wb') as fc: + fc.write('\0\0\0\0') +- wr_long(fc, timestamp) ++ if "DETERMINISTIC_BUILD" in os.environ: ++ fc.write('\0\0\0\0') ++ else: ++ wr_long(fc, timestamp) + marshal.dump(codeobject, fc) + fc.flush() + fc.seek(0, 0) +diff -ur orig/Python/import.c new/Python/import.c +--- orig/Python/import.c ++++ new/Python/import.c +@@ -939,10 +939,12 @@ + return; + } + /* Now write the true mtime (as a 32-bit field) */ +- fseek(fp, 4L, 0); +- assert(mtime <= 0xFFFFFFFF); +- PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); +- fflush(fp); ++ if (Py_GETENV("DETERMINISTIC_BUILD") == NULL) { ++ fseek(fp, 4L, 0); ++ assert(mtime <= 0xFFFFFFFF); ++ PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); ++ fflush(fp); ++ } + fclose(fp); + if (Py_VerboseFlag) + PySys_WriteStderr("# wrote %s\n", cpathname); + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/nix-store-mtime.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/nix-store-mtime.patch new file mode 100644 index 000000000000..83f3fea1931b --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/nix-store-mtime.patch @@ -0,0 +1,12 @@ +diff -ru -x '*~' Python-2.7.1-orig/Python/import.c Python-2.7.1/Python/import.c +--- Python-2.7.1-orig/Python/import.c 2010-05-20 20:37:55.000000000 +0200 ++++ Python-2.7.1/Python/import.c 2011-01-04 15:55:11.000000000 +0100 +@@ -751,7 +751,7 @@ + return NULL; + } + pyc_mtime = PyMarshal_ReadLongFromFile(fp); +- if (pyc_mtime != mtime) { ++ if (pyc_mtime != mtime && mtime != 1) { + if (Py_VerboseFlag) + PySys_WriteStderr("# %s has bad mtime\n", cpathname); + fclose(fp); diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/no-ldconfig.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/no-ldconfig.patch new file mode 100644 index 000000000000..2a6b2a20dd19 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/no-ldconfig.patch @@ -0,0 +1,117 @@ +From 6b0f329a9f37110020ca02b35c8125391ef282b7 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Sat, 24 Dec 2016 15:56:10 +0100 +Subject: [PATCH] no ldconfig + +--- + Lib/ctypes/util.py | 35 +---------------------------------- + Lib/uuid.py | 47 ----------------------------------------------- + 2 files changed, 1 insertion(+), 81 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index ab10ec5..f253e34 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -235,40 +235,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname()[4] + '-32' +- else: +- machine = os.uname()[4] + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type) +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- null = open(os.devnull, 'wb') +- try: +- with null: +- p = subprocess.Popen(['/sbin/ldconfig', '-p'], +- stderr=null, +- stdout=subprocess.PIPE, +- env=env) +- except OSError: # E.g. command not found +- return None +- [data, _] = p.communicate() +- res = re.search(expr, data) +- if not res: +- return None +- return res.group(1) ++ return None + + def find_library(name): + return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) +diff --git a/Lib/uuid.py b/Lib/uuid.py +index 7432032..05eeee5 100644 +--- a/Lib/uuid.py ++++ b/Lib/uuid.py +@@ -441,53 +441,6 @@ def _netbios_getnode(): + + # If ctypes is available, use it to find system routines for UUID generation. + _uuid_generate_time = _UuidCreate = None +-try: +- import ctypes, ctypes.util +- import sys +- +- # The uuid_generate_* routines are provided by libuuid on at least +- # Linux and FreeBSD, and provided by libc on Mac OS X. +- _libnames = ['uuid'] +- if not sys.platform.startswith('win'): +- _libnames.append('c') +- for libname in _libnames: +- try: +- lib = ctypes.CDLL(ctypes.util.find_library(libname)) +- except: +- continue +- if hasattr(lib, 'uuid_generate_time'): +- _uuid_generate_time = lib.uuid_generate_time +- break +- del _libnames +- +- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted +- # in issue #8621 the function generates the same sequence of values +- # in the parent process and all children created using fork (unless +- # those children use exec as well). +- # +- # Assume that the uuid_generate functions are broken from 10.5 onward, +- # the test can be adjusted when a later version is fixed. +- if sys.platform == 'darwin': +- import os +- if int(os.uname()[2].split('.')[0]) >= 9: +- _uuid_generate_time = None +- +- # On Windows prior to 2000, UuidCreate gives a UUID containing the +- # hardware address. On Windows 2000 and later, UuidCreate makes a +- # random UUID and UuidCreateSequential gives a UUID containing the +- # hardware address. These routines are provided by the RPC runtime. +- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last +- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear +- # to bear any relationship to the MAC address of any network device +- # on the box. +- try: +- lib = ctypes.windll.rpcrt4 +- except: +- lib = None +- _UuidCreate = getattr(lib, 'UuidCreateSequential', +- getattr(lib, 'UuidCreate', None)) +-except: +- pass + + def _unixdll_getnode(): + """Get the hardware address on Unix using ctypes.""" +-- +2.11.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch new file mode 100644 index 000000000000..9c085657ac9d --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch @@ -0,0 +1,21 @@ +Backport from CPython 3.8 of a good list of tests to run for PGO. + +Upstream commit: + https://github.com/python/cpython/commit/4e16a4a31 + +Upstream discussion: + https://bugs.python.org/issue36044 + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 00fdd21ce..713dc1e53 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -259,7 +259,7 @@ TCLTK_LIBS= + # The task to run while instrumented when building the profile-opt target. + # We exclude unittests with -x that take a rediculious amount of time to + # run in the instrumented training build or do not provide much value. +-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess ++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c + + # report files for gcov / lcov coverage report + COVERAGE_INFO= $(abs_builddir)/coverage.info diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch new file mode 100644 index 000000000000..78d9272d098a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch @@ -0,0 +1,259 @@ +--- 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, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', '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 = 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/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/search-path.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/search-path.patch new file mode 100644 index 000000000000..2e7b7526c0ce --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/search-path.patch @@ -0,0 +1,27 @@ +diff -rc Python-2.4.4-orig/setup.py Python-2.4.4/setup.py +*** Python-2.4.4-orig/setup.py 2006-10-08 19:41:25.000000000 +0200 +--- Python-2.4.4/setup.py 2007-05-27 16:04:54.000000000 +0200 +*************** +*** 279,288 **** + # Check for AtheOS which has libraries in non-standard locations + if platform == 'atheos': + lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] +- lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) + inc_dirs += ['/system/include', '/atheos/autolnk/include'] +- inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) + + # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) + if platform in ['osf1', 'unixware7', 'openunix8']: + lib_dirs += ['/usr/ccs/lib'] +--- 279,289 ---- + # Check for AtheOS which has libraries in non-standard locations + if platform == 'atheos': + lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] + inc_dirs += ['/system/include', '/atheos/autolnk/include'] + ++ lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) ++ inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) ++ + # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) + if platform in ['osf1', 'unixware7', 'openunix8']: + lib_dirs += ['/usr/ccs/lib'] diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- 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) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + 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') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/force_bytecode_determinism.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/force_bytecode_determinism.patch new file mode 100644 index 000000000000..c263cdbff4db --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/force_bytecode_determinism.patch @@ -0,0 +1,17 @@ +--- a/Lib/py_compile.py ++++ b/Lib/py_compile.py +@@ -139,3 +139,4 @@ + source_stats = loader.path_stats(file) ++ source_mtime = 1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime'] + bytecode = importlib._bootstrap_external._code_to_bytecode( +- code, source_stats['mtime'], source_stats['size']) ++ code, source_mtime, source_stats['size']) +--- a/Lib/importlib/_bootstrap_external.py ++++ b/Lib/importlib/_bootstrap_external.py +@@ -485,5 +485,5 @@ + if source_stats is not None: + try: +- source_mtime = int(source_stats['mtime']) ++ source_mtime = 1 + except KeyError: + pass diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/ld_library_path.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/ld_library_path.patch new file mode 100644 index 000000000000..013c2d266eff --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/ld_library_path.patch @@ -0,0 +1,51 @@ +From 918201682127ed8a270a4bd1a448b490019e4ada Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Thu, 14 Sep 2017 10:00:31 +0200 +Subject: [PATCH] ctypes.util: support LD_LIBRARY_PATH + +Backports support for LD_LIBRARY_PATH from 3.6 +--- + Lib/ctypes/util.py | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index e9957d7951..9926f6c881 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -219,8 +219,32 @@ elif os.name == "posix": + def _findSoname_ldconfig(name): + return None + ++ def _findLib_ld(name): ++ # See issue #9998 for why this is needed ++ expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) ++ cmd = ['ld', '-t'] ++ libpath = os.environ.get('LD_LIBRARY_PATH') ++ if libpath: ++ for d in libpath.split(':'): ++ cmd.extend(['-L', d]) ++ cmd.extend(['-o', os.devnull, '-l%s' % name]) ++ result = None ++ try: ++ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, ++ stderr=subprocess.PIPE, ++ universal_newlines=True) ++ out, _ = p.communicate() ++ res = re.search(expr, os.fsdecode(out)) ++ if res: ++ result = res.group(0) ++ except Exception as e: ++ pass # result will be None ++ return result ++ + def find_library(name): +- return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) ++ # See issue #9998 ++ return _findSoname_ldconfig(name) or \ ++ _get_soname(_findLib_gcc(name) or _findLib_ld(name)) + + ################################################################ + # test code +-- +2.14.1 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/no-ldconfig.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/no-ldconfig.patch new file mode 100644 index 000000000000..9718b1d8dceb --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/no-ldconfig.patch @@ -0,0 +1,164 @@ +From 590c46bb04f79ab611b2f8fd682dd7e43a01f268 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Mon, 28 Aug 2017 09:24:06 +0200 +Subject: [PATCH] Don't use ldconfig and speed up uuid load + +--- + Lib/ctypes/util.py | 70 ++---------------------------------------------------- + Lib/uuid.py | 49 -------------------------------------- + 2 files changed, 2 insertions(+), 117 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 7684eab81d..e9957d7951 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -95,46 +95,7 @@ elif os.name == "posix": + import re, tempfile + + def _findLib_gcc(name): +- # Run GCC's linker with the -t (aka --trace) option and examine the +- # library name it prints out. The GCC command will fail because we +- # haven't supplied a proper program with main(), but that does not +- # matter. +- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) +- +- c_compiler = shutil.which('gcc') +- if not c_compiler: +- c_compiler = shutil.which('cc') +- if not c_compiler: +- # No C compiler available, give up +- return None +- +- temp = tempfile.NamedTemporaryFile() +- try: +- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- try: +- proc = subprocess.Popen(args, +- stdout=subprocess.PIPE, +- stderr=subprocess.STDOUT, +- env=env) +- except OSError: # E.g. bad executable +- return None +- with proc: +- trace = proc.stdout.read() +- finally: +- try: +- temp.close() +- except FileNotFoundError: +- # Raised if the file was already removed, which is the normal +- # behaviour of GCC if linking fails +- pass +- res = re.search(expr, trace) +- if not res: +- return None +- return os.fsdecode(res.group(0)) ++ return None + + + if sys.platform == "sunos5": +@@ -256,34 +217,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname().machine + '-32' +- else: +- machine = os.uname().machine + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- regex = os.fsencode( +- '\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type)) +- try: +- with subprocess.Popen(['/sbin/ldconfig', '-p'], +- stdin=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL, +- stdout=subprocess.PIPE, +- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: +- res = re.search(regex, p.stdout.read()) +- if res: +- return os.fsdecode(res.group(1)) +- except OSError: +- pass ++ return None + + def find_library(name): + return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) +diff --git a/Lib/uuid.py b/Lib/uuid.py +index e96e7e034c..31160ace95 100644 +--- a/Lib/uuid.py ++++ b/Lib/uuid.py +@@ -455,58 +455,9 @@ def _netbios_getnode(): + continue + return int.from_bytes(bytes, 'big') + +-# Thanks to Thomas Heller for ctypes and for his help with its use here. + +-# If ctypes is available, use it to find system routines for UUID generation. +-# XXX This makes the module non-thread-safe! + _uuid_generate_time = _UuidCreate = None +-try: +- import ctypes, ctypes.util +- import sys + +- # The uuid_generate_* routines are provided by libuuid on at least +- # Linux and FreeBSD, and provided by libc on Mac OS X. +- _libnames = ['uuid'] +- if not sys.platform.startswith('win'): +- _libnames.append('c') +- for libname in _libnames: +- try: +- lib = ctypes.CDLL(ctypes.util.find_library(libname)) +- except Exception: +- continue +- if hasattr(lib, 'uuid_generate_time'): +- _uuid_generate_time = lib.uuid_generate_time +- break +- del _libnames +- +- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted +- # in issue #8621 the function generates the same sequence of values +- # in the parent process and all children created using fork (unless +- # those children use exec as well). +- # +- # Assume that the uuid_generate functions are broken from 10.5 onward, +- # the test can be adjusted when a later version is fixed. +- if sys.platform == 'darwin': +- import os +- if int(os.uname().release.split('.')[0]) >= 9: +- _uuid_generate_time = None +- +- # On Windows prior to 2000, UuidCreate gives a UUID containing the +- # hardware address. On Windows 2000 and later, UuidCreate makes a +- # random UUID and UuidCreateSequential gives a UUID containing the +- # hardware address. These routines are provided by the RPC runtime. +- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last +- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear +- # to bear any relationship to the MAC address of any network device +- # on the box. +- try: +- lib = ctypes.windll.rpcrt4 +- except: +- lib = None +- _UuidCreate = getattr(lib, 'UuidCreateSequential', +- getattr(lib, 'UuidCreate', None)) +-except: +- pass + + def _unixdll_getnode(): + """Get the hardware address on Unix using ctypes.""" +-- +2.14.1 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch new file mode 100644 index 000000000000..39d5587379ca --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch @@ -0,0 +1,21 @@ +Backport from CPython 3.8 of a good list of tests to run for PGO. + +Upstream commit: + https://github.com/python/cpython/commit/4e16a4a31 + +Upstream discussion: + https://bugs.python.org/issue36044 + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 00fdd21ce..713dc1e53 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -259,7 +259,7 @@ TCLTK_LIBS= + # The task to run while instrumented when building the profile-opt target. + # We exclude unittests with -x that take a rediculious amount of time to + # run in the instrumented training build or do not provide much value. +-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_subprocess ++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c + + # report files for gcov / lcov coverage report + COVERAGE_INFO= $(abs_builddir)/coverage.info diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/python-3.x-distutils-C++.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/python-3.x-distutils-C++.patch new file mode 100644 index 000000000000..01356020b394 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/python-3.x-distutils-C++.patch @@ -0,0 +1,237 @@ +Source: https://bugs.python.org/file47046/python-3.x-distutils-C++.patch +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -125,8 +125,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 +@@ -140,9 +142,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": +@@ -166,8 +172,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 as msg: + raise CompileError(msg) + +@@ -302,9 +312,14 @@ + self.set_executables(compiler='gcc -O -Wall', + compiler_so='gcc -mdll -O -Wall', + compiler_cxx='g++ -O -Wall', ++ compiler_so_cxx='g++ -mdll -O -Wall', + linker_exe='gcc', + linker_so='%s %s %s' + % (self.linker_dll, shared_option, ++ entry_point), ++ linker_exe_cxx='g++', ++ linker_so_cxx='%s %s %s' ++ % (self.linker_dll_cxx, 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/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -184,9 +184,11 @@ + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ ++ cxxflags = cflags + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -201,19 +204,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: +@@ -222,13 +233,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 = shlib_suffix +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -52,14 +52,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": +@@ -108,12 +111,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 as msg: + raise CompileError(msg) + +@@ -171,22 +181,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 += 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_' +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -538,7 +538,7 @@ + *\ -s*|s*) quiet="-q";; \ + *) quiet="";; \ + esac; \ +- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- 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) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + 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') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/no-ldconfig.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/no-ldconfig.patch new file mode 100644 index 000000000000..0f829860a5b7 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/no-ldconfig.patch @@ -0,0 +1,163 @@ +From 105621b99cc30615c79b5aa3d12d6732e14b0d59 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Mon, 28 Aug 2017 09:24:06 +0200 +Subject: [PATCH] Don't use ldconfig and speed up uuid load + +--- + Lib/ctypes/util.py | 70 ++---------------------------------------------------- + Lib/uuid.py | 48 ------------------------------------- + 2 files changed, 2 insertions(+), 116 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 339ae8aa8a..2944985c30 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -85,46 +85,7 @@ elif os.name == "posix": + import re, tempfile + + def _findLib_gcc(name): +- # Run GCC's linker with the -t (aka --trace) option and examine the +- # library name it prints out. The GCC command will fail because we +- # haven't supplied a proper program with main(), but that does not +- # matter. +- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) +- +- c_compiler = shutil.which('gcc') +- if not c_compiler: +- c_compiler = shutil.which('cc') +- if not c_compiler: +- # No C compiler available, give up +- return None +- +- temp = tempfile.NamedTemporaryFile() +- try: +- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- try: +- proc = subprocess.Popen(args, +- stdout=subprocess.PIPE, +- stderr=subprocess.STDOUT, +- env=env) +- except OSError: # E.g. bad executable +- return None +- with proc: +- trace = proc.stdout.read() +- finally: +- try: +- temp.close() +- except FileNotFoundError: +- # Raised if the file was already removed, which is the normal +- # behaviour of GCC if linking fails +- pass +- res = re.search(expr, trace) +- if not res: +- return None +- return os.fsdecode(res.group(0)) ++ return None + + + if sys.platform == "sunos5": +@@ -246,34 +207,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname().machine + '-32' +- else: +- machine = os.uname().machine + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' +- regex = os.fsencode(regex % (re.escape(name), abi_type)) +- try: +- with subprocess.Popen(['/sbin/ldconfig', '-p'], +- stdin=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL, +- stdout=subprocess.PIPE, +- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: +- res = re.search(regex, p.stdout.read()) +- if res: +- return os.fsdecode(res.group(1)) +- except OSError: +- pass ++ return None + + def _findLib_ld(name): + # See issue #9998 for why this is needed +diff --git a/Lib/uuid.py b/Lib/uuid.py +index 200c800b34..31160ace95 100644 +--- a/Lib/uuid.py ++++ b/Lib/uuid.py +@@ -455,57 +455,9 @@ def _netbios_getnode(): + continue + return int.from_bytes(bytes, 'big') + +-# Thanks to Thomas Heller for ctypes and for his help with its use here. + +-# If ctypes is available, use it to find system routines for UUID generation. +-# XXX This makes the module non-thread-safe! + _uuid_generate_time = _UuidCreate = None +-try: +- import ctypes, ctypes.util +- import sys + +- # The uuid_generate_* routines are provided by libuuid on at least +- # Linux and FreeBSD, and provided by libc on Mac OS X. +- _libnames = ['uuid'] +- if not sys.platform.startswith('win'): +- _libnames.append('c') +- for libname in _libnames: +- try: +- lib = ctypes.CDLL(ctypes.util.find_library(libname)) +- except Exception: +- continue +- if hasattr(lib, 'uuid_generate_time'): +- _uuid_generate_time = lib.uuid_generate_time +- break +- del _libnames +- +- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted +- # in issue #8621 the function generates the same sequence of values +- # in the parent process and all children created using fork (unless +- # those children use exec as well). +- # +- # Assume that the uuid_generate functions are broken from 10.5 onward, +- # the test can be adjusted when a later version is fixed. +- if sys.platform == 'darwin': +- if int(os.uname().release.split('.')[0]) >= 9: +- _uuid_generate_time = None +- +- # On Windows prior to 2000, UuidCreate gives a UUID containing the +- # hardware address. On Windows 2000 and later, UuidCreate makes a +- # random UUID and UuidCreateSequential gives a UUID containing the +- # hardware address. These routines are provided by the RPC runtime. +- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last +- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear +- # to bear any relationship to the MAC address of any network device +- # on the box. +- try: +- lib = ctypes.windll.rpcrt4 +- except: +- lib = None +- _UuidCreate = getattr(lib, 'UuidCreateSequential', +- getattr(lib, 'UuidCreate', None)) +-except: +- pass + + def _unixdll_getnode(): + """Get the hardware address on Unix using ctypes.""" +-- +2.14.1 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch new file mode 100644 index 000000000000..df55da3a4132 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch @@ -0,0 +1,21 @@ +Backport from CPython 3.8 of a good list of tests to run for PGO. + +Upstream commit: + https://github.com/python/cpython/commit/4e16a4a31 + +Upstream discussion: + https://bugs.python.org/issue36044 + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 00fdd21ce..713dc1e53 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -259,7 +259,7 @@ TCLTK_LIBS= + # The task to run while instrumented when building the profile-opt target. + # We exclude unittests with -x that take a rediculious amount of time to + # run in the instrumented training build or do not provide much value. +-PROFILE_TASK=-m test.regrtest --pgo ++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c + + # report files for gcov / lcov coverage report + COVERAGE_INFO= $(abs_builddir)/coverage.info diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- 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) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + 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') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/darwin-libutil.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/darwin-libutil.patch new file mode 100644 index 000000000000..51e3cb6d7f11 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/darwin-libutil.patch @@ -0,0 +1,23 @@ +diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c +index c3682b4..16826c6 100644 +--- a/Modules/posixmodule.c ++++ b/Modules/posixmodule.c +@@ -5880,15 +5880,13 @@ error: + #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX) + #ifdef HAVE_PTY_H + #include <pty.h> +-#else ++#endif + #ifdef HAVE_LIBUTIL_H + #include <libutil.h> +-#else ++#endif + #ifdef HAVE_UTIL_H + #include <util.h> +-#endif /* HAVE_UTIL_H */ +-#endif /* HAVE_LIBUTIL_H */ +-#endif /* HAVE_PTY_H */ ++#endif + #ifdef HAVE_STROPTS_H + #include <stropts.h> + #endif diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/fix-hardcoded-path-checking-for-rpmbuild.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/fix-hardcoded-path-checking-for-rpmbuild.patch new file mode 100644 index 000000000000..bb3d992612d3 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/fix-hardcoded-path-checking-for-rpmbuild.patch @@ -0,0 +1,30 @@ +From a612c481f6116955d420db5ae1fe4c1eb93eb2f2 Mon Sep 17 00:00:00 2001 +From: Marcin Niemira <marcin.niemira@gmail.com> +Date: Sun, 9 Jun 2019 07:05:06 +1000 +Subject: [PATCH] bpo-11122: fix hardcoded path checking for rpmbuild in + bdist_rpm.py (GH-10594) (cherry picked from commit + 45a14942c969ed508b35abd5e116cb18f84ce5b4) + +Co-authored-by: Marcin Niemira <marcin.niemira@gmail.com> +--- + Lib/distutils/command/bdist_rpm.py | 5 +---- + .../next/Library/2018-11-12-19-08-50.bpo-11122.Gj7BQn.rst | 1 + + 2 files changed, 2 insertions(+), 4 deletions(-) + create mode 100644 Misc/NEWS.d/next/Library/2018-11-12-19-08-50.bpo-11122.Gj7BQn.rst + +diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py +index 20ca7ac6dcffa..74381cc69a6ce 100644 +--- a/Lib/distutils/command/bdist_rpm.py ++++ b/Lib/distutils/command/bdist_rpm.py +@@ -309,10 +309,7 @@ def run(self): + + # build package + log.info("building RPMs") +- rpm_cmd = ['rpm'] +- if os.path.exists('/usr/bin/rpmbuild') or \ +- os.path.exists('/bin/rpmbuild'): +- rpm_cmd = ['rpmbuild'] ++ rpm_cmd = ['rpmbuild'] + + if self.source_only: # what kind of RPMs? + rpm_cmd.append('-bs') diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch new file mode 100644 index 000000000000..a1f9d68eb166 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch @@ -0,0 +1,100 @@ +From 597e73f2a4b2f0b508127931b36d5540d6941823 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Mon, 28 Aug 2017 09:24:06 +0200 +Subject: [PATCH] Don't use ldconfig + +--- + Lib/ctypes/util.py | 70 ++---------------------------------------------------- + 1 file changed, 2 insertions(+), 68 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 5e8b31a854..7b45ce6c15 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -94,46 +94,7 @@ elif os.name == "posix": + import re, tempfile + + def _findLib_gcc(name): +- # Run GCC's linker with the -t (aka --trace) option and examine the +- # library name it prints out. The GCC command will fail because we +- # haven't supplied a proper program with main(), but that does not +- # matter. +- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) +- +- c_compiler = shutil.which('gcc') +- if not c_compiler: +- c_compiler = shutil.which('cc') +- if not c_compiler: +- # No C compiler available, give up +- return None +- +- temp = tempfile.NamedTemporaryFile() +- try: +- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- try: +- proc = subprocess.Popen(args, +- stdout=subprocess.PIPE, +- stderr=subprocess.STDOUT, +- env=env) +- except OSError: # E.g. bad executable +- return None +- with proc: +- trace = proc.stdout.read() +- finally: +- try: +- temp.close() +- except FileNotFoundError: +- # Raised if the file was already removed, which is the normal +- # behaviour of GCC if linking fails +- pass +- res = re.search(expr, trace) +- if not res: +- return None +- return os.fsdecode(res.group(0)) ++ return None + + + if sys.platform == "sunos5": +@@ -255,34 +216,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname().machine + '-32' +- else: +- machine = os.uname().machine + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' +- regex = os.fsencode(regex % (re.escape(name), abi_type)) +- try: +- with subprocess.Popen(['/sbin/ldconfig', '-p'], +- stdin=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL, +- stdout=subprocess.PIPE, +- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: +- res = re.search(regex, p.stdout.read()) +- if res: +- return os.fsdecode(res.group(1)) +- except OSError: +- pass ++ return None + + def _findLib_ld(name): + # See issue #9998 for why this is needed +-- +2.15.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/python-3.x-distutils-C++.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/python-3.x-distutils-C++.patch new file mode 100644 index 000000000000..243313f76548 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/python-3.x-distutils-C++.patch @@ -0,0 +1,248 @@ +--- a/Lib/_osx_support.py ++++ b/Lib/_osx_support.py +@@ -14,13 +14,13 @@ __all__ = [ + # 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', 'PY_CORE_LDFLAGS') ++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', ++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', ++ 'PY_CPPFLAGS', 'PY_CORE_LDFLAGS', '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_' +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler): + # 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 +@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler): + 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": +@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler): + 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 as msg: + raise CompileError(msg) + +@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler): + self.set_executables(compiler='gcc -O -Wall', + compiler_so='gcc -mdll -O -Wall', + compiler_cxx='g++ -O -Wall', ++ compiler_so_cxx='g++ -mdll -O -Wall', + linker_exe='gcc', + linker_so='%s %s %s' + % (self.linker_dll, shared_option, ++ entry_point), ++ linker_exe_cxx='g++', ++ linker_so_cxx='%s %s %s' ++ % (self.linker_dll_cxx, 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/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -170,9 +170,11 @@ def customize_compiler(compiler): + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ ++ cxxflags = cflags + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -187,19 +189,27 @@ def customize_compiler(compiler): + 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 = cflags + ' ' + 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: +@@ -208,13 +218,17 @@ def customize_compiler(compiler): + 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 = shlib_suffix +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler): + # 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": +@@ -110,12 +113,19 @@ class UnixCCompiler(CCompiler): + + 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 as msg: + raise CompileError(msg) + +@@ -173,30 +183,16 @@ class UnixCCompiler(CCompiler): + 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 += 1 +- +- if os.path.basename(linker[i]) == 'ld_so_aix': +- # AIX platforms prefix the compiler with the ld_so_aix +- # script, so we need to adjust our linker index +- offset = 1 ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] + else: +- offset = 0 +- +- linker[i+offset] = self.compiler_cxx[i] ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _osx_support.compiler_fixup(linker, ld_args) +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -584,10 +584,10 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o + *\ -s*|s*) quiet="-q";; \ + *) quiet="";; \ + esac; \ +- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ +- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch new file mode 100644 index 000000000000..0c26300d9c06 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch @@ -0,0 +1,33 @@ +From 1911995b1a1252d80bf2b9651840e185a1a6baf5 Mon Sep 17 00:00:00 2001 +From: Hong Xu <hong@topbug.net> +Date: Thu, 25 Jul 2019 10:25:55 -0700 +Subject: [PATCH] On all posix systems, not just Darwin, set LDSHARED (if not + set) according to CC + +This patch is slightly different from https://bugs.python.org/issue24935 +, except that we now handle LDSHARED according to CC on all posix +systems, not just Darwin or Linux. +--- + Lib/distutils/sysconfig.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 37feae5df7..9fdce6896d 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -199,10 +199,10 @@ def customize_compiler(compiler): + + if 'CC' in os.environ: + newcc = os.environ['CC'] +- if (sys.platform == 'darwin' ++ if (os.name == 'posix' + and 'LDSHARED' not in os.environ + and ldshared.startswith(cc)): +- # On OS X, if CC is overridden, use that as the default ++ # On POSIX systems, if CC is overridden, use that as the default + # command for LDSHARED as well + ldshared = newcc + ldshared[len(cc):] + cc = newcc +-- +2.25.1 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch new file mode 100644 index 000000000000..a1f9d68eb166 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch @@ -0,0 +1,100 @@ +From 597e73f2a4b2f0b508127931b36d5540d6941823 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Mon, 28 Aug 2017 09:24:06 +0200 +Subject: [PATCH] Don't use ldconfig + +--- + Lib/ctypes/util.py | 70 ++---------------------------------------------------- + 1 file changed, 2 insertions(+), 68 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 5e8b31a854..7b45ce6c15 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -94,46 +94,7 @@ elif os.name == "posix": + import re, tempfile + + def _findLib_gcc(name): +- # Run GCC's linker with the -t (aka --trace) option and examine the +- # library name it prints out. The GCC command will fail because we +- # haven't supplied a proper program with main(), but that does not +- # matter. +- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) +- +- c_compiler = shutil.which('gcc') +- if not c_compiler: +- c_compiler = shutil.which('cc') +- if not c_compiler: +- # No C compiler available, give up +- return None +- +- temp = tempfile.NamedTemporaryFile() +- try: +- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- try: +- proc = subprocess.Popen(args, +- stdout=subprocess.PIPE, +- stderr=subprocess.STDOUT, +- env=env) +- except OSError: # E.g. bad executable +- return None +- with proc: +- trace = proc.stdout.read() +- finally: +- try: +- temp.close() +- except FileNotFoundError: +- # Raised if the file was already removed, which is the normal +- # behaviour of GCC if linking fails +- pass +- res = re.search(expr, trace) +- if not res: +- return None +- return os.fsdecode(res.group(0)) ++ return None + + + if sys.platform == "sunos5": +@@ -255,34 +216,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname().machine + '-32' +- else: +- machine = os.uname().machine + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' +- regex = os.fsencode(regex % (re.escape(name), abi_type)) +- try: +- with subprocess.Popen(['/sbin/ldconfig', '-p'], +- stdin=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL, +- stdout=subprocess.PIPE, +- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: +- res = re.search(regex, p.stdout.read()) +- if res: +- return os.fsdecode(res.group(1)) +- except OSError: +- pass ++ return None + + def _findLib_ld(name): + # See issue #9998 for why this is needed +-- +2.15.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.9/no-ldconfig.patch b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.9/no-ldconfig.patch new file mode 100644 index 000000000000..a1f9d68eb166 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/3.9/no-ldconfig.patch @@ -0,0 +1,100 @@ +From 597e73f2a4b2f0b508127931b36d5540d6941823 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Mon, 28 Aug 2017 09:24:06 +0200 +Subject: [PATCH] Don't use ldconfig + +--- + Lib/ctypes/util.py | 70 ++---------------------------------------------------- + 1 file changed, 2 insertions(+), 68 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 5e8b31a854..7b45ce6c15 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -94,46 +94,7 @@ elif os.name == "posix": + import re, tempfile + + def _findLib_gcc(name): +- # Run GCC's linker with the -t (aka --trace) option and examine the +- # library name it prints out. The GCC command will fail because we +- # haven't supplied a proper program with main(), but that does not +- # matter. +- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) +- +- c_compiler = shutil.which('gcc') +- if not c_compiler: +- c_compiler = shutil.which('cc') +- if not c_compiler: +- # No C compiler available, give up +- return None +- +- temp = tempfile.NamedTemporaryFile() +- try: +- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- try: +- proc = subprocess.Popen(args, +- stdout=subprocess.PIPE, +- stderr=subprocess.STDOUT, +- env=env) +- except OSError: # E.g. bad executable +- return None +- with proc: +- trace = proc.stdout.read() +- finally: +- try: +- temp.close() +- except FileNotFoundError: +- # Raised if the file was already removed, which is the normal +- # behaviour of GCC if linking fails +- pass +- res = re.search(expr, trace) +- if not res: +- return None +- return os.fsdecode(res.group(0)) ++ return None + + + if sys.platform == "sunos5": +@@ -255,34 +216,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname().machine + '-32' +- else: +- machine = os.uname().machine + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' +- regex = os.fsencode(regex % (re.escape(name), abi_type)) +- try: +- with subprocess.Popen(['/sbin/ldconfig', '-p'], +- stdin=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL, +- stdout=subprocess.PIPE, +- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: +- res = re.search(regex, p.stdout.read()) +- if res: +- return os.fsdecode(res.group(1)) +- except OSError: +- pass ++ return None + + def _findLib_ld(name): + # See issue #9998 for why this is needed +-- +2.15.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix new file mode 100644 index 000000000000..b25d613eb7f3 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix @@ -0,0 +1,340 @@ +{ stdenv, fetchurl, fetchpatch +, bzip2 +, expat +, libffi +, gdbm +, lzma +, ncurses +, openssl +, readline +, sqlite +, tcl ? null, tk ? null, tix ? null, libX11 ? null, xorgproto ? null, x11Support ? false +, bluez ? null, bluezSupport ? false +, zlib +, self +, configd +, autoreconfHook +, python-setup-hook +, nukeReferences +# For the Python package set +, packageOverrides ? (self: super: {}) +, buildPackages +, pythonForBuild ? buildPackages.${"python${sourceVersion.major}${sourceVersion.minor}"} +, sourceVersion +, sha256 +, passthruFun +, bash +, stripConfig ? false +, stripIdlelib ? false +, stripTests ? false +, stripTkinter ? false +, rebuildBytecode ? true +, stripBytecode ? false +, includeSiteCustomize ? true +, static ? false +# Not using optimizations on Darwin +# configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found. +, enableOptimizations ? (!stdenv.isDarwin) +}: + +# Note: this package is used for bootstrapping fetchurl, and thus +# cannot use fetchpatch! All mutable patches (generated by GitHub or +# cgit) that are needed here should be included directly in Nixpkgs as +# files. + +assert x11Support -> tcl != null + && tk != null + && xorgproto != null + && libX11 != null; + +assert bluezSupport -> bluez != null; + +with stdenv.lib; + +let + + passthru = passthruFun rec { + inherit self sourceVersion packageOverrides; + implementation = "cpython"; + libPrefix = "python${pythonVersion}"; + executable = libPrefix; + pythonVersion = with sourceVersion; "${major}.${minor}"; + sitePackages = "lib/${libPrefix}/site-packages"; + inherit hasDistutilsCxxPatch pythonForBuild; + }; + + version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; + + nativeBuildInputs = optionals (!stdenv.isDarwin) [ + autoreconfHook + ] ++ [ + nukeReferences + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + buildPackages.stdenv.cc + pythonForBuild + ]; + + buildInputs = filter (p: p != null) ([ + zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xorgproto ] + ++ optionals (bluezSupport && stdenv.isLinux) [ bluez ] + ++ optionals stdenv.isDarwin [ configd ]); + + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); + + inherit pythonForBuild; + + pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then + "$out/bin/python" + else pythonForBuild.interpreter; + +in with passthru; stdenv.mkDerivation { + pname = "python3"; + inherit version; + + inherit buildInputs nativeBuildInputs; + + src = fetchurl { + url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz"; + inherit sha256; + }; + + prePatch = optionalString stdenv.isDarwin '' + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' + substituteInPlace configure --replace '-Wl,-stack_size,1000000' ' ' + '' + optionalString (stdenv.isDarwin && x11Support) '' + substituteInPlace setup.py --replace /Library/Frameworks /no-such-path + ''; + + patches = [ + # Disable the use of ldconfig in ctypes.util.find_library (since + # ldconfig doesn't work on NixOS), and don't use + # ctypes.util.find_library during the loading of the uuid module + # (since it will do a futile invocation of gcc (!) to find + # libuuid, slowing down program startup a lot). + (./. + "/${sourceVersion.major}.${sourceVersion.minor}/no-ldconfig.patch") + ] ++ optionals (isPy35 || isPy36) [ + # Determinism: Write null timestamps when compiling python files. + ./3.5/force_bytecode_determinism.patch + ] ++ optionals isPy35 [ + # Backports support for LD_LIBRARY_PATH from 3.6 + ./3.5/ld_library_path.patch + ] ++ optionals (isPy35 || isPy36 || isPy37) [ + # Backport a fix for discovering `rpmbuild` command when doing `python setup.py bdist_rpm` to 3.5, 3.6, 3.7. + # See: https://bugs.python.org/issue11122 + ./3.7/fix-hardcoded-path-checking-for-rpmbuild.patch + ] ++ optionals (isPy37 || isPy38 || isPy39) [ + # Fix darwin build https://bugs.python.org/issue34027 + ./3.7/darwin-libutil.patch + ] ++ optionals (pythonOlder "3.8") [ + # Backport from CPython 3.8 of a good list of tests to run for PGO. + ( + if isPy36 || isPy37 then + ./3.6/profile-task.patch + else + ./3.5/profile-task.patch + ) + ] ++ optionals (isPy3k && hasDistutilsCxxPatch) [ + # Fix for http://bugs.python.org/issue1222585 + # 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. + ( + if isPy35 then + ./3.5/python-3.x-distutils-C++.patch + else if isPy37 || isPy38 || isPy39 then + ./3.7/python-3.x-distutils-C++.patch + else + fetchpatch { + url = "https://bugs.python.org/file48016/python-3.x-distutils-C++.patch"; + sha256 = "1h18lnpx539h5lfxyk379dxwr8m2raigcjixkf133l4xy3f4bzi2"; + } + ) + ] ++ [ + # LDSHARED now uses $CC instead of gcc. Fixes cross-compilation of extension modules. + ./3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch + ]; + + postPatch = '' + substituteInPlace Lib/subprocess.py \ + --replace "'/bin/sh'" "'${bash}/bin/sh'" + '' + optionalString (x11Support && (tix != null)) '' + substituteInPlace "Lib/tkinter/tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + ''; + + 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"}"; + NIX_LDFLAGS = optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "-lgcc_s" + optionalString stdenv.hostPlatform.isMusl "-lgcc_eh"; + # Determinism: We fix the hashes of str, bytes and datetime objects. + PYTHONHASHSEED=0; + + configureFlags = [ + "--enable-shared" + "--without-ensurepip" + "--with-system-expat" + "--with-system-ffi" + ] ++ optionals enableOptimizations [ + "--enable-optimizations" + ] ++ optionals (pythonOlder "3.7") [ + # This is unconditionally true starting in CPython 3.7. + "--with-threads" + ] ++ optionals (sqlite != null && isPy3k) [ + "--enable-loadable-sqlite-extensions" + ] ++ optionals (openssl != null) [ + "--with-openssl=${openssl.dev}" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "ac_cv_buggy_getaddrinfo=no" + # Assume little-endian IEEE 754 floating point when cross compiling + "ac_cv_little_endian_double=yes" + "ac_cv_big_endian_double=no" + "ac_cv_mixed_endian_double=no" + "ac_cv_x87_double_rounding=yes" + "ac_cv_tanh_preserves_zero_sign=yes" + # Generally assume that things are present and work + "ac_cv_posix_semaphores_enabled=yes" + "ac_cv_broken_sem_getvalue=no" + "ac_cv_wchar_t_signed=yes" + "ac_cv_rshift_extends_sign=yes" + "ac_cv_broken_nice=no" + "ac_cv_broken_poll=no" + "ac_cv_working_tzset=yes" + "ac_cv_have_long_long_format=yes" + "ac_cv_have_size_t_format=yes" + "ac_cv_computed_gotos=yes" + "ac_cv_file__dev_ptmx=yes" + "ac_cv_file__dev_ptc=yes" + ] ++ optionals stdenv.hostPlatform.isLinux [ + # Never even try to use lchmod on linux, + # don't rely on detecting glibc-isms. + "ac_cv_func_lchmod=no" + ] ++ optional static "LDFLAGS=-static"; + + 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 + '' + optionalString (isPy3k && pythonOlder "3.7") '' + # Determinism: The interpreter is patched to write null timestamps when compiling Python files + # so Python doesn't try to update the bytecode when seeing frozen timestamps in Nix's store. + export DETERMINISTIC_BUILD=1; + '' + optionalString stdenv.hostPlatform.isMusl '' + export NIX_CFLAGS_COMPILE+=" -DTHREAD_STACK_SIZE=0x100000" + ''; + + setupHook = python-setup-hook sitePackages; + + postInstall = '' + # needed for some packages, especially packages that backport functionality + # to 2.x from 3.x + for item in $out/lib/${libPrefix}/test/*; do + if [[ "$item" != */test_support.py* + && "$item" != */test/support + && "$item" != */test/libregrtest + && "$item" != */test/regrtest.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/${libPrefix}/test/__init__.py + + ln -s "$out/include/${executable}m" "$out/include/${executable}" + + # Determinism: Windows installers were not deterministic. + # We're also not interested in building Windows installers. + find "$out" -name 'wininst*.exe' | xargs -r rm -f + + # Use Python3 as default python + ln -s "$out/bin/idle3" "$out/bin/idle" + 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" + + # Get rid of retained dependencies on -dev packages, and remove + # some $TMPDIR references to improve binary reproducibility. + # Note that the .pyc file of _sysconfigdata.py should be regenerated! + for i in $out/lib/${libPrefix}/_sysconfigdata*.py $out/lib/${libPrefix}/config-${sourceVersion.major}${sourceVersion.minor}*/Makefile; do + sed -i $i -e "s|$TMPDIR|/no-such-path|g" + done + + # Further get rid of references. https://github.com/NixOS/nixpkgs/issues/51668 + find $out/lib/python*/config-* -type f -print -exec nuke-refs -e $out '{}' + + find $out/lib -name '_sysconfigdata*.py*' -print -exec nuke-refs -e $out '{}' + + + '' + optionalString stripConfig '' + rm -R $out/bin/python*-config $out/lib/python*/config-* + '' + optionalString stripIdlelib '' + # Strip IDLE (and turtledemo, which uses it) + rm -R $out/bin/idle* $out/lib/python*/{idlelib,turtledemo} + '' + optionalString stripTkinter '' + rm -R $out/lib/python*/tkinter + '' + optionalString stripTests '' + # Strip tests + rm -R $out/lib/python*/test $out/lib/python*/**/test{,s} + '' + optionalString includeSiteCustomize '' + # Include a sitecustomize.py file + cp ${../sitecustomize.py} $out/${sitePackages}/sitecustomize.py + '' + optionalString rebuildBytecode '' + + # Determinism: rebuild all bytecode + # We exclude lib2to3 because that's Python 2 code which fails + # We rebuild three times, once for each optimization level + # Python 3.7 implements PEP 552, introducing support for deterministic bytecode. + # This is automatically used when `SOURCE_DATE_EPOCH` is set. + find $out -name "*.py" | ${pythonForBuildInterpreter} -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | ${pythonForBuildInterpreter} -O -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | ${pythonForBuildInterpreter} -OO -m compileall -q -f -x "lib2to3" -i - + '' + optionalString stripBytecode '' + find $out -type d -name __pycache__ -print0 | xargs -0 -I {} rm -rf "{}" + '' + '' + # *strip* shebang from libpython gdb script - it should be dual-syntax and + # interpretable by whatever python the gdb in question is using, which may + # not even match the major version of this python. doing this after the + # bytecode compilations for the same reason. + mkdir -p $out/share/gdb + sed '/^#!/d' Tools/gdb/libpython.py > $out/share/gdb/libpython.py + ''; + + preFixup = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + # Ensure patch-shebangs uses shebangs of host interpreter. + export PATH=${stdenv.lib.makeBinPath [ "$out" bash ]}:$PATH + ''; + + # Enforce that we don't have references to the OpenSSL -dev package, which we + # explicitly specify in our configure flags above. + disallowedReferences = + stdenv.lib.optionals (openssl != null && !static) [ openssl.dev ] + ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Ensure we don't have references to build-time packages. + # These typically end up in shebangs. + pythonForBuild buildPackages.bash + ]; + + separateDebugInfo = true; + + inherit passthru; + + 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; [ fridh ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-html.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-html.nix new file mode 100644 index 000000000000..e033858acc01 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-html.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python27-docs-html-2.7.16"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/2.7.16/python-2.7.16-docs-html.tar.bz2"; + sha256 = "1razs1grzhai65ihaiyph8kz6ncjkgp1gsn3c8v7kanf13lqim02"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/html + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-a4.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-a4.nix new file mode 100644 index 000000000000..c9a770a6fcf1 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-a4.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python27-docs-pdf-a4-2.7.16"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/2.7.16/python-2.7.16-docs-pdf-a4.tar.bz2"; + sha256 = "14ml1ynrlbhg43737bdsb8k5y39wsffqj4iwhylhb8n8l5dplfdq"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/pdf-a4 + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-letter.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-letter.nix new file mode 100644 index 000000000000..e03d031bae48 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-letter.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python27-docs-pdf-letter-2.7.16"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/2.7.16/python-2.7.16-docs-pdf-letter.tar.bz2"; + sha256 = "019i8n48m71mn31v8d85kkwyqfgcgqnqh506y4a7fcgf656bajs0"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/pdf-letter + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-text.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-text.nix new file mode 100644 index 000000000000..d19d7be19357 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-text.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python27-docs-text-2.7.16"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/2.7.16/python-2.7.16-docs-text.tar.bz2"; + sha256 = "1da7swlykvc013684nywycinfz3v8dqkcmv0zj8p7l5lyi5mq03r"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/text + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-html.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-html.nix new file mode 100644 index 000000000000..a83363b5c473 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-html.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python37-docs-html-3.7.2"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/3.7.2/python-3.7.2-docs-html.tar.bz2"; + sha256 = "19wbrawpdam09fmyipfy92sxwn1rl93v8jkfqsfx028qhvzf0422"; + }; + installPhase = '' + mkdir -p $out/share/doc/python37 + cp -R ./ $out/share/doc/python37/html + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-a4.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-a4.nix new file mode 100644 index 000000000000..e60032f71bf8 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-a4.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python37-docs-pdf-a4-3.7.2"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/3.7.2/python-3.7.2-docs-pdf-a4.tar.bz2"; + sha256 = "0vdx762m30hjaabn6w88awcj2qpbz0b6z59zn9wmamd35k59lfba"; + }; + installPhase = '' + mkdir -p $out/share/doc/python37 + cp -R ./ $out/share/doc/python37/pdf-a4 + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-letter.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-letter.nix new file mode 100644 index 000000000000..b737a1e32995 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-letter.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python37-docs-pdf-letter-3.7.2"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/3.7.2/python-3.7.2-docs-pdf-letter.tar.bz2"; + sha256 = "17g57vlyvqx0k916q84q2pcx7y8myw0fda9fvg9kh0ph930c837x"; + }; + installPhase = '' + mkdir -p $out/share/doc/python37 + cp -R ./ $out/share/doc/python37/pdf-letter + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-text.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-text.nix new file mode 100644 index 000000000000..2897042ec04a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-text.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python37-docs-text-3.7.2"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/3.7.2/python-3.7.2-docs-text.tar.bz2"; + sha256 = "0h50rlr8jclwfxa106b42q2vn2ynp219c4zsy5qz65n5m3b7y1g2"; + }; + installPhase = '' + mkdir -p $out/share/doc/python37 + cp -R ./ $out/share/doc/python37/text + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/default.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/default.nix new file mode 100644 index 000000000000..a538f731473b --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/default.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchurl, lib }: + +let +pythonDocs = { + html = { + recurseForDerivations = true; + python27 = import ./2.7-html.nix { + inherit stdenv fetchurl lib; + }; + python37 = import ./3.7-html.nix { + inherit stdenv fetchurl lib; + }; + }; + pdf_a4 = { + recurseForDerivations = true; + python27 = import ./2.7-pdf-a4.nix { + inherit stdenv fetchurl lib; + }; + python37 = import ./3.7-pdf-a4.nix { + inherit stdenv fetchurl lib; + }; + }; + pdf_letter = { + recurseForDerivations = true; + python27 = import ./2.7-pdf-letter.nix { + inherit stdenv fetchurl lib; + }; + python37 = import ./3.7-pdf-letter.nix { + inherit stdenv fetchurl lib; + }; + }; + text = { + recurseForDerivations = true; + python27 = import ./2.7-text.nix { + inherit stdenv fetchurl lib; + }; + python37 = import ./3.7-text.nix { + inherit stdenv fetchurl lib; + }; + }; +}; in pythonDocs diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/generate.sh b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/generate.sh new file mode 100755 index 000000000000..a4b2e0893fcd --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/generate.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +TYPES="html pdf-a4 pdf-letter text" +URL=http://docs.python.org/ftp/python/doc/VERSION/python-VERSION-docs-TYPE.tar.bz2 +VERSIONS=$(for major in 2 3; do curl https://docs.python.org/$major/archives/ 2>/dev/null | perl -l -n -e'/<a href="python-([23].[0-9].[0-9]+)-docs-html.tar.bz2/ && print $1' | tail -n 1; done) +echo "Generating expressions for: +${VERSIONS} +" + + +cat >default.nix <<EOF +{ stdenv, fetchurl, lib }: + +let +pythonDocs = { +EOF + +for type in $TYPES; do + cat >>default.nix <<EOF + ${type/-/_} = { + recurseForDerivations = true; +EOF + + for version in $VERSIONS; do + major=$(echo -n ${version}| cut -d. -f1) + minor=$(echo -n ${version}| cut -d. -f2) + outfile=${major}.${minor}-${type}.nix + hash= + if [ -e ${outfile} ]; then + currentversion=$(grep "url =" ${outfile} |cut -d/ -f7) + if [ ${version} = ${currentversion} ]; then + hash=$(grep sha256 ${outfile} | cut -d'"' -f2) + fi + fi + echo "Generating ${outfile}" + url=$(echo -n $URL |sed -e "s,VERSION,${version},g" -e "s,TYPE,${type},") + sha=$(nix-prefetch-url ${url} ${hash}) + + sed -e "s,VERSION,${version}," \ + -e "s,MAJOR,${major}," \ + -e "s,MINOR,${minor}," \ + -e "s,TYPE,${type}," \ + -e "s,URL,${url}," \ + -e "s,SHA,${sha}," < template.nix > ${outfile} + + attrname=python${major}${minor} + cat >>default.nix <<EOF + ${attrname} = import ./${major}.${minor}-${type}.nix { + inherit stdenv fetchurl lib; + }; +EOF + + echo "done." + echo + done + echo " };" >> default.nix +done + +echo "}; in pythonDocs" >> default.nix diff --git a/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/template.nix b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/template.nix new file mode 100644 index 000000000000..3cc0c2a9ee85 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/interpreters/python/cpython/docs/template.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "pythonMAJORMINOR-docs-TYPE-VERSION"; + src = fetchurl { + url = URL; + sha256 = "SHA"; + }; + installPhase = '' + mkdir -p $out/share/doc/pythonMAJORMINOR + cp -R ./ $out/share/doc/pythonMAJORMINOR/TYPE + ''; + meta = { + maintainers = [ ]; + }; +} |