Author: eelco
Date: Tue Jan  4 15:10:03 2011
New Revision: 25387
URL: https://svn.nixos.org/websvn/nix/?rev=25387&sc=1

Log:
* 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.

Added:
   
nixpkgs/branches/modular-python/pkgs/development/interpreters/python/2.7/nix-store-mtime.patch
Modified:
   
nixpkgs/branches/modular-python/pkgs/development/interpreters/python/2.7/default.nix

Modified: 
nixpkgs/branches/modular-python/pkgs/development/interpreters/python/2.7/default.nix
==============================================================================
--- 
nixpkgs/branches/modular-python/pkgs/development/interpreters/python/2.7/default.nix
        Tue Jan  4 15:07:43 2011        (r25386)
+++ 
nixpkgs/branches/modular-python/pkgs/development/interpreters/python/2.7/default.nix
        Tue Jan  4 15:10:03 2011        (r25387)
@@ -33,6 +33,12 @@
   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;

Added: 
nixpkgs/branches/modular-python/pkgs/development/interpreters/python/2.7/nix-store-mtime.patch
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
nixpkgs/branches/modular-python/pkgs/development/interpreters/python/2.7/nix-store-mtime.patch
      Tue Jan  4 15:10:03 2011        (r25387)
@@ -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);
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to