Add a patched version of buildout 2.2.0 for development with nix

Without this patch buildout will copy eggs from the nix store into the
./eggs directory and then try to compile them. This fails because they
are read only. This patch changes the behaviour to create symlinks to
eggs available in the nix store instead of copying them, and not to
try to compile the eggs in the store. To differentiate this from the
default buildout (which may be provided otherwise e.g. as a
dependency) the executable is renamed to buildout-nix.

This can be used in conjuntion with myEnvFun to create development
environments which make use of the python modules available in the
store while downloading any additional required eggs. A pleasant side
effect is that you can conveniently replace the symlink with a copy
for debugging purposes.
This commit is contained in:
Cillian de Róiste 2013-08-28 00:26:06 +02:00
parent efcffe61e4
commit 01cc4301f3
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,21 @@
{ fetchurl, stdenv, buildPythonPackage }:
buildPythonPackage {
name = "zc.buildout-nix-2.2.0";
src = fetchurl {
url = "https://pypi.python.org/packages/source/z/zc.buildout/zc.buildout-2.2.0.tar.gz";
md5 = "771dd9807da7d5ef5bb998991c5fdae1";
};
patches = [ ./nix.patch ];
postInstall = "mv $out/bin/buildout{,-nix}";
meta = {
homepage = "http://www.buildout.org";
description = "A software build and configuration system";
license = stdenv.lib.licenses.zpt21;
maintainers = [ stdenv.lib.maintainers.goibhniu ];
};
}

View File

@ -0,0 +1,23 @@
--- a/src/zc/buildout/easy_install.py 2013-08-27 22:28:40.233718116 +0200
+++ b/src/zc/buildout/easy_install.py 2013-08-27 22:31:07.967871186 +0200
@@ -508,16 +508,15 @@
self._dest, os.path.basename(dist.location))
if os.path.isdir(dist.location):
- # we got a directory. It must have been
- # obtained locally. Just copy it.
- shutil.copytree(dist.location, newloc)
+ # Symlink to dists in /nix/store
+ if not os.path.exists(newloc):
+ os.symlink(dist.location, newloc)
else:
setuptools.archive_util.unpack_archive(
dist.location, newloc)
-
- redo_pyc(newloc)
+ redo_pyc(newloc)
# Getting the dist from the environment causes the
# distribution meta data to be read. Cloning isn't

View File

@ -126,6 +126,9 @@ pythonPackages = modules // import ./python-packages-generated.nix {
inherit python buildPythonPackage pygobject pycairo; inherit python buildPythonPackage pygobject pycairo;
}; };
# A patched version of buildout, useful for buildout based development on Nix
zc_buildout_nix = callPackage ../development/python-modules/buildout-nix { };
# packages defined here # packages defined here
afew = buildPythonPackage rec { afew = buildPythonPackage rec {