Author: eelco
Date: Mon Mar 28 16:33:33 2011
New Revision: 26580
URL: https://svn.nixos.org/websvn/nix/?rev=26580&sc=1
Log:
* Move the wrapPythonPrograms function into a separate setup hook
(wrapPython).
Added:
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/wrap.sh
Modified:
nixpkgs/branches/modular-python/pkgs/applications/version-management/bazaar/default.nix
nixpkgs/branches/modular-python/pkgs/build-support/trivial-builders.nix
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/default.nix
nixpkgs/branches/modular-python/pkgs/top-level/all-packages.nix
Modified:
nixpkgs/branches/modular-python/pkgs/applications/version-management/bazaar/default.nix
==============================================================================
---
nixpkgs/branches/modular-python/pkgs/applications/version-management/bazaar/default.nix
Mon Mar 28 16:11:16 2011 (r26579)
+++
nixpkgs/branches/modular-python/pkgs/applications/version-management/bazaar/default.nix
Mon Mar 28 16:33:33 2011 (r26580)
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python, pythonPackages, makeWrapper }:
+{ stdenv, fetchurl, python, pythonPackages, wrapPython }:
stdenv.mkDerivation rec {
version = "2.3";
@@ -10,11 +10,13 @@
sha256 = "07kx41w4gqv68bcykdflsg68wvpmcyqknzyb4vr1zqlf27hahp53";
};
- buildInputs = [ python makeWrapper ];
+ buildInputs = [ python wrapPython ];
+
+ pythonPath = [ pythonPackages.ssl ];
installPhase = ''
python setup.py install --prefix=$out
- wrapProgram $out/bin/bzr --prefix PYTHONPATH : "$(toPythonPath $out
${pythonPackages.ssl})"
+ wrapPythonPrograms
'';
meta = {
Modified:
nixpkgs/branches/modular-python/pkgs/build-support/trivial-builders.nix
==============================================================================
--- nixpkgs/branches/modular-python/pkgs/build-support/trivial-builders.nix
Mon Mar 28 16:11:16 2011 (r26579)
+++ nixpkgs/branches/modular-python/pkgs/build-support/trivial-builders.nix
Mon Mar 28 16:33:33 2011 (r26580)
@@ -45,12 +45,14 @@
# Make a package that just contains a setup hook with the given contents.
- makeSetupHook = script:
- runCommand "hook" {}
- ''
+ makeSetupHook = deps: script:
+ runCommand "hook" { }
+ (''
ensureDir $out/nix-support
cp ${script} $out/nix-support/setup-hook
- '';
+ '' + stdenv.lib.optionalString (deps != []) ''
+ echo ${toString deps} > $out/nix-support/propagated-build-native-inputs
+ '');
# Write the references (i.e. the runtime dependencies in the Nix store) of
`path' to a file.
Modified:
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/default.nix
==============================================================================
---
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/default.nix
Mon Mar 28 16:11:16 2011 (r26579)
+++
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/default.nix
Mon Mar 28 16:33:33 2011 (r26580)
@@ -3,7 +3,7 @@
(http://pypi.python.org/pypi/setuptools/), which represents a large
number of Python packages nowadays. */
-{ python, setuptools, makeWrapper, lib }:
+{ python, setuptools, wrapPython, lib }:
{ name, namePrefix ? "python-"
@@ -36,7 +36,7 @@
name = namePrefix + name;
- buildInputs = [ python makeWrapper setuptools ] ++ buildInputs ++ pythonPath;
+ buildInputs = [ python wrapPython setuptools ] ++ buildInputs ++ pythonPath;
pythonPath = [ setuptools] ++ pythonPath;
@@ -54,47 +54,8 @@
postFixup =
''
- declare -A pythonPathsSeen
+ wrapPythonPrograms
- addToPythonPath() {
- local dir="$1"
- if [ -n "''${pythonPathsSeen[$dir]}" ]; then return; fi
- pythonPathsSeen[$dir]=1
- addToSearchPath program_PYTHONPATH
$dir/lib/${python.libPrefix}/site-packages
- addToSearchPath program_PATH $dir/bin
- local prop="$dir/nix-support/propagated-build-native-inputs"
- if [ -e $prop ]; then
- local i
- for i in $(cat $prop); do
- addToPythonPath $i
- done
- fi
- }
-
- wrapPythonPrograms() {
- local dir="$1"
- local pythonPath="$2"
- local i
-
- pythonPathsSeen=()
- program_PYTHONPATH=
- program_PATH=
- for i in $pythonPath; do
- addToPythonPath $i
- done
-
- for i in $(find "$out" -type f -perm +0100); do
- if head -n1 "$i" | grep -q "${python}"; then
- echo "wrapping \`$i'..."
- wrapProgram "$i" \
- --prefix PYTHONPATH ":" $program_PYTHONPATH \
- --prefix PATH ":" $program_PATH
- fi
- done
- }
-
- wrapPythonPrograms $out "$out $pythonPath"
-
# If a user installs a Python package, she probably also wants its
# dependencies in the user environment (since Python modules don't
# have something like an RPATH, so the only way to find the
Added:
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/wrap.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++
nixpkgs/branches/modular-python/pkgs/development/python-modules/generic/wrap.sh
Mon Mar 28 16:33:33 2011 (r26580)
@@ -0,0 +1,40 @@
+wrapPythonPrograms() {
+ wrapPythonProgramsIn $out "$out $pythonPath"
+}
+
+wrapPythonProgramsIn() {
+ local dir="$1"
+ local pythonPath="$2"
+ local i
+
+ declare -A pythonPathsSeen=()
+ program_PYTHONPATH=
+ program_PATH=
+ for i in $pythonPath; do
+ _addToPythonPath $i
+ done
+
+ for i in $(find "$dir" -type f -perm +0100); do
+ if head -n1 "$i" | grep -q /python; then
+ echo "wrapping \`$i'..."
+ wrapProgram "$i" \
+ --prefix PYTHONPATH ":" $program_PYTHONPATH \
+ --prefix PATH ":" $program_PATH
+ fi
+ done
+}
+
+_addToPythonPath() {
+ local dir="$1"
+ if [ -n "${pythonPathsSeen[$dir]}" ]; then return; fi
+ pythonPathsSeen[$dir]=1
+ addToSearchPath program_PYTHONPATH $dir/lib/python2.7/site-packages
+ addToSearchPath program_PATH $dir/bin
+ local prop="$dir/nix-support/propagated-build-native-inputs"
+ if [ -e $prop ]; then
+ local i
+ for i in $(cat $prop); do
+ _addToPythonPath $i
+ done
+ fi
+}
Modified: nixpkgs/branches/modular-python/pkgs/top-level/all-packages.nix
==============================================================================
--- nixpkgs/branches/modular-python/pkgs/top-level/all-packages.nix Mon Mar
28 16:11:16 2011 (r26579)
+++ nixpkgs/branches/modular-python/pkgs/top-level/all-packages.nix Mon Mar
28 16:33:33 2011 (r26580)
@@ -312,7 +312,9 @@
inherit stdenv perl cpio contents ubootChooser;
};
- makeWrapper = makeSetupHook ../build-support/make-wrapper/make-wrapper.sh;
+ makeWrapper = makeSetupHook [] ../build-support/make-wrapper/make-wrapper.sh;
+
+ wrapPython = makeSetupHook [ makeWrapper ]
../development/python-modules/generic/wrap.sh;
makeModulesClosure = {kernel, rootModules, allowMissing ? false}:
import ../build-support/kernel/modules-closure.nix {
@@ -343,6 +345,7 @@
};
platforms = import ./platforms.nix;
+
### TOOLS
@@ -4264,7 +4267,7 @@
buildPythonPackage = buildPython27Package;
buildPython27Package = import ../development/python-modules/generic {
- inherit makeWrapper lib;
+ inherit wrapPython lib;
python = python27;
setuptools = setuptools.override { python = python27; doCheck = false; };
};
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits