nixpkgs/pkgs/development/interpreters/python/2.7/nix-store-mtime.patch
Eelco Dolstra 4a5042a1a1 * 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
2011-01-04 15:10:03 +00:00

13 lines
518 B
Diff

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);