Merge remote-tracking branch 'origin/master' into stdenv-updates

This commit is contained in:
Eelco Dolstra
2013-01-17 14:19:14 +01:00
120 changed files with 2870 additions and 471 deletions

View File

@@ -3,7 +3,7 @@
(http://pypi.python.org/pypi/setuptools/), which represents a large
number of Python packages nowadays. */
{ python, setuptools, wrapPython, lib, offlineDistutils, setuptoolsSite }:
{ python, setuptools, wrapPython, lib, offlineDistutils, recursivePthLoader }:
{ name, namePrefix ? "python-"
@@ -23,7 +23,7 @@
''
easy_install --always-unzip --prefix="$out" .
''
, preConfigure ? "true"
, buildPhase ? "true"
@@ -48,16 +48,14 @@ python.stdenv.mkDerivation (attrs // {
name = namePrefix + name;
# checkPhase after installPhase to run tests on installed packages
phases = "unpackPhase patchPhase configurePhase buildPhase installPhase checkPhase fixupPhase distPhase";
buildInputs = [ python wrapPython setuptools ] ++ buildInputs ++ pythonPath;
# setuptoolsSite is responsible for loading pth files
propagatedBuildInputs = propagatedBuildInputs ++ [ setuptoolsSite ];
propagatedBuildInputs = propagatedBuildInputs ++ [ recursivePthLoader ];
buildInputStrings = map toString buildInputs;
pythonPath = [ setuptools] ++ pythonPath;
pythonPath = [ setuptools ] ++ pythonPath;
preConfigure = ''
PYTHONPATH="${offlineDistutils}/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
@@ -83,9 +81,7 @@ python.stdenv.mkDerivation (attrs // {
# Remove any site.py files generated by easy_install as these
# cause collisions. If pth files are to be processed a
# corresponding site.py needs to be included in the PYTHONPATH.
#
# leave them until we have a better solution: see #209
#rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py*
rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py*
${postInstall}
'';

View File

@@ -51,6 +51,9 @@ createBuildInputsPth() {
local inputs="$2"
if [ foo"$inputs" != foo ]; then
for x in $inputs; do
if $(echo -n $x |grep -q python-recursive-pth-loader); then
continue
fi
if test -d "$x"/lib/@libPrefix@/site-packages; then
echo $x/lib/@libPrefix@/site-packages \
>> "$out"/lib/@libPrefix@/site-packages/${name}-nix-python-$category.pth

View File

@@ -1,4 +1,4 @@
{stdenv, fetchurl, python, pkgconfig, cairo, x11}:
{ stdenv, fetchurl, python, pkgconfig, cairo, x11 }:
stdenv.mkDerivation {
name = "pycairo-1.8.8";
@@ -7,5 +7,5 @@ stdenv.mkDerivation {
sha256 = "0q18hd4ai4raljlvd76ylgi30kxpr2qq83ka6gzwh0ya8fcmjlig";
};
buildInputs = [python pkgconfig cairo x11];
buildInputs = [ python pkgconfig cairo x11 ];
}

View File

@@ -12,16 +12,12 @@ stdenv.mkDerivation rec {
buildInputs = [ python pkgconfig glib ];
# in a "normal" setup, pygobject and pygtk are installed into the
# same site-packages: we need a pth file for both. pygtk.py would be
# used to select a specific version, in our setup it should have no
# effect, but we leave it in case somebody expects and calls it.
postInstall = ''
# All python code is installed into a "gtk-2.0" sub-directory. That
# sub-directory may be useful on systems which share several library
# versions in the same prefix, i.e. /usr/local, but on Nix that directory
# is useless. Furthermore, its existence makes it very hard to guess a
# proper $PYTHONPATH that allows "import gtk" to succeed.
cd $(toPythonPath $out)/gtk-2.0
for n in *; do
ln -s "gtk-2.0/$n" "../$n"
done
mv $out/lib/${python.libPrefix}/site-packages/{pygtk.pth,${name}.pth}
'';
meta = {

View File

@@ -1,7 +1,7 @@
{ stdenv, fetchurl, makeWrapper, python, pkgconfig, glib, gtk, pygobject, pycairo
, libglade ? null }:
{ stdenv, fetchurl, python, pkgconfig, glib, gtk, pygobject, pycairo
, buildPythonPackage, libglade ? null }:
stdenv.mkDerivation rec {
buildPythonPackage rec {
name = "pygtk-2.22.0";
src = fetchurl {
@@ -10,26 +10,35 @@ stdenv.mkDerivation rec {
};
buildInputs =
[ makeWrapper python pkgconfig glib gtk ]
[ pkgconfig glib gtk ]
++ stdenv.lib.optional (libglade != null) libglade;
propagatedBuildInputs = [ pygobject pycairo ];
installCommand = "make install";
checkPhase = stdenv.lib.optionalString (libglade == null)
''
sed -i -e "s/glade = importModule('gtk.glade', buildDir)//" \
tests/common.py
sed -i -e "s/, glade$//" \
-e "s/.*testGlade.*//" \
-e "s/.*(glade.*//" \
tests/test_api.py
'' + ''
sed -i -e "s/sys.path.insert(0, os.path.join(buildDir, 'gtk'))//" \
-e "s/sys.path.insert(0, buildDir)//" \
tests/common.py
make check
'';
# XXX: TypeError: Unsupported type: <class 'gtk._gtk.WindowType'>
# The check phase was not executed in the previous
# non-buildPythonPackage setup - not sure why not.
doCheck = false;
postInstall = ''
rm $out/bin/pygtk-codegen-2.0
ln -s ${pygobject}/bin/pygobject-codegen-2.0 $out/bin/pygtk-codegen-2.0
# All python code is installed into a "gtk-2.0" sub-directory. That
# sub-directory may be useful on systems which share several library
# versions in the same prefix, i.e. /usr/local, but on Nix that directory
# is useless. Furthermore, its existence makes it very hard to guess a
# proper $PYTHONPATH that allows "import gtk" to succeed.
cd $(toPythonPath $out)/gtk-2.0
for n in *; do
ln -s "gtk-2.0/$n" "../$n"
done
wrapProgram $out/bin/pygtk-demo --prefix PYTHONPATH ":" \
$(toPythonPath "${pygobject} ${pycairo} $out")
ln -s ${pygobject}/lib/${python.libPrefix}/site-packages/${pygobject.name}.pth \
$out/lib/${python.libPrefix}/site-packages/${name}.pth
'';
}

View File

@@ -1,7 +1,7 @@
{ stdenv, fetchurl, python, wrapPython }:
stdenv.mkDerivation rec {
name = "setuptools-" + version;
name = "python-setuptools-" + version;
version = "0.6c11";

View File

@@ -1,29 +1,32 @@
Without this patch `virtualenv --python=python2.7 .` fails with an error because it notices that the python readline.so is not in the same path as python2.7. I assume this is to avoid copying the wrong file on systems where it is possible to find incompatible libraries by accident. Adding "/nix/store" to the prefix fixes this problem. Unfortunately readline is still not available if you just run `virtualenv .`.
--- virtualenv-1.6.4/virtualenv.py 2012-05-20 00:40:38.070649647 +0200
+++ virtualenv-1.6.4/virtualenv.py 2012-05-20 00:45:10.596242604 +0200
@@ -951,13 +951,7 @@
--- virtualenv-1.8.4/virtualenv.py 2013-01-16 23:43:37.583615220 +0100
+++ virtualenv-1.8.4/virtualenv.py 2013-01-16 23:44:47.885973431 +0100
@@ -1135,17 +1135,7 @@
def change_prefix(filename, dst_prefix):
- prefixes = [sys.prefix]
-
- if sys.platform == "darwin":
- if is_darwin:
- prefixes.extend((
- os.path.join("/Library/Python", sys.version[:3], "site-packages"),
- os.path.join(sys.prefix, "Extras", "lib", "python"),
- os.path.join("~", "Library", "Python", sys.version[:3], "site-packages")))
- os.path.join("~", "Library", "Python", sys.version[:3], "site-packages"),
- # Python 2.6 no-frameworks
- os.path.join("~", ".local", "lib","python", sys.version[:3], "site-packages"),
- # System Python 2.7 on OSX Mountain Lion
- os.path.join("~", "Library", "Python", sys.version[:3], "lib", "python", "site-packages")))
+ prefixes = ["/nix/store", sys.prefix]
if hasattr(sys, 'real_prefix'):
prefixes.append(sys.real_prefix)
@@ -968,6 +962,8 @@
_, relpath = filename.split(src_prefix, 1)
assert relpath[0] == os.sep
relpath = relpath[1:]
+ if src_prefix == "/nix/store":
+ relpath = "/".join(relpath.split("/")[1:])
@@ -1162,6 +1152,8 @@
if src_prefix != os.sep: # sys.prefix == "/"
assert relpath[0] == os.sep
relpath = relpath[1:]
+ if src_prefix == "/nix/store":
+ relpath = "/".join(relpath.split("/")[1:])
return join(dst_prefix, relpath)
assert False, "Filename %s does not start with any of these prefixes: %s" % \
(filename, prefixes)