about summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2011-03-28 09:48:57 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2011-03-28 09:48:57 +0000
commit8ca5d5d8b641cd0b2afd4e3ebabe8a83b7b7f7ea (patch)
tree981308ad0d180e8cc0259b6caa7088a3c239949a /pkgs/development/interpreters
parentf510e6f7e4bf8b1b8f7b4ae2fae259ca71688f86 (diff)
downloadnixlib-8ca5d5d8b641cd0b2afd4e3ebabe8a83b7b7f7ea.tar
nixlib-8ca5d5d8b641cd0b2afd4e3ebabe8a83b7b7f7ea.tar.gz
nixlib-8ca5d5d8b641cd0b2afd4e3ebabe8a83b7b7f7ea.tar.bz2
nixlib-8ca5d5d8b641cd0b2afd4e3ebabe8a83b7b7f7ea.tar.lz
nixlib-8ca5d5d8b641cd0b2afd4e3ebabe8a83b7b7f7ea.tar.xz
nixlib-8ca5d5d8b641cd0b2afd4e3ebabe8a83b7b7f7ea.tar.zst
nixlib-8ca5d5d8b641cd0b2afd4e3ebabe8a83b7b7f7ea.zip
* Move python/2.7/modules.nix into python/2.7/default.nix. Also
  remove the pythonModules attribute.  The built-in modules are now
  accessible as (e.g.) "python.modules.ssl" or "pythonPackages.ssl".

svn path=/nixpkgs/branches/modular-python/; revision=26559
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/python/2.7/default.nix200
-rw-r--r--pkgs/development/interpreters/python/2.7/modules.nix86
2 files changed, 144 insertions, 142 deletions
diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix
index 8b8699db77d8..4bb8e72a1a11 100644
--- a/pkgs/development/interpreters/python/2.7/default.nix
+++ b/pkgs/development/interpreters/python/2.7/default.nix
@@ -1,4 +1,5 @@
 { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2
+, sqlite, tcl, tk, x11, openssl, readline, db4, ncurses, gdbm
 , darwinArchUtility ? null, darwinSwVersUtility ? null
 }:
 
@@ -13,23 +14,11 @@ let
   majorVersion = "2.7";
   version = "${majorVersion}.1";
 
-  buildInputs =
-    optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++
-    [ bzip2 ]
-    ++ optional zlibSupport zlib
-    ++ optionals stdenv.isDarwin [ darwinArchUtility darwinSwVersUtility ];
-
-in
-
-stdenv.mkDerivation {
-  name = "python-${version}";
-  inherit majorVersion version;
-
   src = fetchurl {
     url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.bz2";
     sha256 = "14i2c7yqa7ljmx2i2bb827n61q33zn23ax96czi8rbkyyny8gqw0";
   };
-
+  
   patches =
     [ # Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff.
       ./search-path.patch
@@ -41,51 +30,150 @@ stdenv.mkDerivation {
       ./nix-store-mtime.patch
     ];
 
-  inherit buildInputs;
-  
-  C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
-  LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
-  
-  configureFlags = "--enable-shared --with-threads --enable-unicode --with-wctype-functions";
-
-  preConfigure =
-    ''
-      # Purity.
-      for i in /usr /sw /opt /pkg; do
-        substituteInPlace ./setup.py --replace $i /no-such-path
-      done
-    '';
-
-  NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
+  buildInputs =
+    optional (stdenv ? gcc && stdenv.gcc.libc != null) stdenv.gcc.libc ++
+    [ bzip2 ]
+    ++ optional zlibSupport zlib
+    ++ optionals stdenv.isDarwin [ darwinArchUtility darwinSwVersUtility ];
 
-  setupHook = ./setup-hook.sh;
+    
+  # Build the basic Python interpreter without modules that have
+  # external dependencies.
+  python = stdenv.mkDerivation {
+    name = "python-${version}";
+    
+    inherit majorVersion version src patches buildInputs;
+
+    C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
+    LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
+
+    configureFlags = "--enable-shared --with-threads --enable-unicode --with-wctype-functions";
+
+    preConfigure =
+      ''
+        # Purity.
+        for i in /usr /sw /opt /pkg; do
+          substituteInPlace ./setup.py --replace $i /no-such-path
+        done
+      '';
+
+    NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
+
+    setupHook = ./setup-hook.sh;
+
+    postInstall =
+      ''
+        rm -rf "$out/lib/python${majorVersion}/test"
+      '';
+
+    passthru = {
+      inherit zlibSupport;
+      libPrefix = "python${majorVersion}";
+    };
+
+    enableParallelBuilding = true;
+
+    meta = {
+      homepage = "http://python.org";
+      description = "Python -- 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 = "GPLv2";
+      platforms = stdenv.lib.platforms.all;
+      maintainers = [ stdenv.lib.maintainers.simons ];
+    };
+  };
 
-  postInstall =
-    ''
-      rm -rf "$out/lib/python${majorVersion}/test"
-    '';
 
-  passthru = {
-    inherit zlibSupport;
-    libPrefix = "python${majorVersion}";
-  };
+  # This function builds a Python module included in the main Python
+  # distribution in a separate derivation.
+  buildInternalPythonModule =
+    { moduleName
+    , internalName ? "_" + moduleName
+    , deps
+    }:
+    stdenv.mkDerivation rec {
+      name = "python-${moduleName}-${python.version}";
+
+      inherit src patches;
+
+      buildInputs = [ python ] ++ deps;
+
+      C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
+      LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
+
+      configurePhase = "true";
+
+      buildPhase =
+        ''
+          # Fake the build environment that setup.py expects.
+          ln -s ${python}/include/python*/pyconfig.h .
+          ln -s ${python}/lib/python*/config/Setup Modules/
+          ln -s ${python}/lib/python*/config/Setup.local Modules/
+
+          substituteInPlace setup.py --replace 'self.extensions = extensions' \
+            'self.extensions = [ext for ext in self.extensions if ext.name in ["${internalName}"]]'
+
+          python ./setup.py build_ext
+        '';
+
+      installPhase =
+        ''
+          dest=$out/lib/${python.libPrefix}/site-packages
+          mkdir -p $dest
+          cp -p $(find . -name "*.so") $dest/
+        '';
+    };
+
+
+  # The Python modules included in the main Python distribution, built
+  # as separate derivations.
+  modules = {
+
+    bsddb = buildInternalPythonModule {
+      moduleName = "bsddb";
+      deps = [ db4 ];
+    };
+
+    curses = buildInternalPythonModule {
+      moduleName = "curses";
+      deps = [ ncurses ];
+    };
+
+    gdbm = buildInternalPythonModule {
+      moduleName = "gdbm";
+      internalName = "gdbm";
+      deps = [ gdbm ];
+    };
+
+    sqlite3 = buildInternalPythonModule {
+      moduleName = "sqlite3";
+      deps = [ sqlite ];
+    };
+
+    ssl = buildInternalPythonModule {
+      moduleName = "ssl";
+      deps = [ openssl ];
+    };
+
+    tkinter = buildInternalPythonModule {
+      moduleName = "tkinter";
+      deps = [ tcl tk x11 ];
+    };
+
+    readline = buildInternalPythonModule {
+      moduleName = "readline";
+      internalName = "readline";
+      deps = [ readline ];
+    };
 
-  enableParallelBuilding = true;
-
-  meta = {
-    homepage = "http://python.org";
-    description = "Python -- 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 = "GPLv2";
-    platforms = stdenv.lib.platforms.all;
-    maintainers = [ stdenv.lib.maintainers.simons ];
   };
-}
+  
+in python // { inherit modules; }
diff --git a/pkgs/development/interpreters/python/2.7/modules.nix b/pkgs/development/interpreters/python/2.7/modules.nix
deleted file mode 100644
index 55d559967fb9..000000000000
--- a/pkgs/development/interpreters/python/2.7/modules.nix
+++ /dev/null
@@ -1,86 +0,0 @@
-{ stdenv, python, sqlite, tcl, tk, x11, openssl, readline, db4, ncurses, gdbm }:
-
-with stdenv.lib;
-
-let 
-
-  buildInternalPythonModule =
-    { moduleName
-    , internalName ? "_" + moduleName
-    , deps
-    }:
-    stdenv.mkDerivation rec {
-      name = "python-${moduleName}-${python.version}";
-
-      src = python.src;
-
-      patches = python.patches;
-
-      buildInputs = [ python ] ++ deps;
-
-      C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
-      LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
-
-      configurePhase = "true";
-
-      buildPhase =
-        ''
-          # Fake the build environment that setup.py expects.
-          ln -s ${python}/include/python*/pyconfig.h .
-          ln -s ${python}/lib/python*/config/Setup Modules/
-          ln -s ${python}/lib/python*/config/Setup.local Modules/
-
-          substituteInPlace setup.py --replace 'self.extensions = extensions' \
-            'self.extensions = [ext for ext in self.extensions if ext.name in ["${internalName}"]]'
-
-          python ./setup.py build_ext
-        '';
-
-      installPhase =
-        ''
-          dest=$out/lib/${python.libPrefix}/site-packages
-          mkdir -p $dest
-          cp -p $(find . -name "*.so") $dest/
-        '';
-    };
-
-in {
-    
-  bsddb = buildInternalPythonModule {
-    moduleName = "bsddb";
-    deps = [ db4 ];
-  };
-    
-  curses = buildInternalPythonModule {
-    moduleName = "curses";
-    deps = [ ncurses ];
-  };
-    
-  gdbm = buildInternalPythonModule {
-    moduleName = "gdbm";
-    internalName = "gdbm";
-    deps = [ gdbm ];
-  };
-    
-  sqlite3 = buildInternalPythonModule {
-    moduleName = "sqlite3";
-    deps = [ sqlite ];
-  };
-    
-  ssl = buildInternalPythonModule {
-    moduleName = "ssl";
-    deps = [ openssl ];
-  };
-    
-  tkinter = buildInternalPythonModule {
-    moduleName = "tkinter";
-    deps = [ tcl tk x11 ];
-  };
-    
-  readline = buildInternalPythonModule {
-    moduleName = "readline";
-    internalName = "readline";
-    deps = [ readline ];
-  };
-
-}