From cca42b5cc08aaf3ab928f6eaa5ef50ad74a83ddc Mon Sep 17 00:00:00 2001
From: Alexander Tsamutali <astsmtl@yandex.ru>
Date: Sat, 17 Sep 2011 16:29:40 +0000
Subject: [PATCH] development/interpreters/python/2.7: Fix building on Linux
 3.x (iirc, that was the problem).

svn path=/nixpkgs/trunk/; revision=29325
---
 pkgs/development/interpreters/python/2.7/default.nix | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix
index 483a7e5fc002..4ba380436bbe 100644
--- a/pkgs/development/interpreters/python/2.7/default.nix
+++ b/pkgs/development/interpreters/python/2.7/default.nix
@@ -30,6 +30,12 @@ let
       ./nix-store-mtime.patch
     ];
 
+  postPatch = ''
+    substituteInPlace ./Lib/plat-generic/regen \
+                      --replace /usr/include/netinet/in.h \
+                                ${stdenv.gcc.libc}/include/netinet/in.h
+  '';
+
   buildInputs =
     optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++
     [ bzip2 ]
@@ -49,7 +55,7 @@ let
   python = stdenv.mkDerivation {
     name = "python-${version}";
 
-    inherit majorVersion version src patches buildInputs;
+    inherit majorVersion version src patches postPatch buildInputs;
 
     C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
     LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
@@ -110,7 +116,7 @@ let
     stdenv.mkDerivation rec {
       name = "python-${moduleName}-${python.version}";
 
-      inherit src patches;
+      inherit src patches postPatch;
 
       buildInputs = [ python ] ++ deps;