diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2011-01-04 15:10:03 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2011-01-04 15:10:03 +0000 |
commit | 4a5042a1a13f97c8163e77283998b6442d8c2af2 (patch) | |
tree | fdf9cd1f7dc91208a005e0512582bbb166b16806 /pkgs/development/interpreters/python | |
parent | b7b1fc322a6cf152c2621714e63e0938162a4af9 (diff) | |
download | nixlib-4a5042a1a13f97c8163e77283998b6442d8c2af2.tar nixlib-4a5042a1a13f97c8163e77283998b6442d8c2af2.tar.gz nixlib-4a5042a1a13f97c8163e77283998b6442d8c2af2.tar.bz2 nixlib-4a5042a1a13f97c8163e77283998b6442d8c2af2.tar.lz nixlib-4a5042a1a13f97c8163e77283998b6442d8c2af2.tar.xz nixlib-4a5042a1a13f97c8163e77283998b6442d8c2af2.tar.zst nixlib-4a5042a1a13f97c8163e77283998b6442d8c2af2.zip |
* 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. Yes, this should make Python programs faster. svn path=/nixpkgs/branches/modular-python/; revision=25387
Diffstat (limited to 'pkgs/development/interpreters/python')
-rw-r--r-- | pkgs/development/interpreters/python/2.7/default.nix | 6 | ||||
-rw-r--r-- | pkgs/development/interpreters/python/2.7/nix-store-mtime.patch | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix index 88147fef31dc..8b8699db77d8 100644 --- a/pkgs/development/interpreters/python/2.7/default.nix +++ b/pkgs/development/interpreters/python/2.7/default.nix @@ -33,6 +33,12 @@ stdenv.mkDerivation { 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 ]; inherit buildInputs; diff --git a/pkgs/development/interpreters/python/2.7/nix-store-mtime.patch b/pkgs/development/interpreters/python/2.7/nix-store-mtime.patch new file mode 100644 index 000000000000..044a96e3a8a3 --- /dev/null +++ b/pkgs/development/interpreters/python/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); |