summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-02-17 10:06:31 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-02-17 10:06:31 +0100
commite9520e81b375fca8bcf06b3f4c2dd3bb0b757be6 (patch)
tree7da1bda216c30520d864a266735c48988c2b2369 /pkgs/development/python-modules
parentee994dfae6e897ee4e7405e1624be43625086622 (diff)
parent2f3eae3a87eb4f9e330ac2c31611061c1ae8699f (diff)
downloadnixlib-e9520e81b375fca8bcf06b3f4c2dd3bb0b757be6.tar
nixlib-e9520e81b375fca8bcf06b3f4c2dd3bb0b757be6.tar.gz
nixlib-e9520e81b375fca8bcf06b3f4c2dd3bb0b757be6.tar.bz2
nixlib-e9520e81b375fca8bcf06b3f4c2dd3bb0b757be6.tar.lz
nixlib-e9520e81b375fca8bcf06b3f4c2dd3bb0b757be6.tar.xz
nixlib-e9520e81b375fca8bcf06b3f4c2dd3bb0b757be6.tar.zst
nixlib-e9520e81b375fca8bcf06b3f4c2dd3bb0b757be6.zip
Merge branch 'master' into staging
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/bootstrapped-pip/default.nix14
-rw-r--r--pkgs/development/python-modules/bootstrapped-pip/pip-7.0.1-prefix.patch151
-rw-r--r--pkgs/development/python-modules/cairocffi/dlopen-paths.patch47
-rw-r--r--pkgs/development/python-modules/numpy-scipy-support.nix35
-rw-r--r--pkgs/development/python-modules/numpy.nix51
-rw-r--r--pkgs/development/python-modules/scipy.nix47
6 files changed, 149 insertions, 196 deletions
diff --git a/pkgs/development/python-modules/bootstrapped-pip/default.nix b/pkgs/development/python-modules/bootstrapped-pip/default.nix
index 43f8cca4c827..c0e5ae0ec774 100644
--- a/pkgs/development/python-modules/bootstrapped-pip/default.nix
+++ b/pkgs/development/python-modules/bootstrapped-pip/default.nix
@@ -2,8 +2,8 @@
 
 let
   wheel_source = fetchurl {
-    url = "https://pypi.python.org/packages/py2.py3/w/wheel/wheel-0.26.0-py2.py3-none-any.whl";
-    sha256 = "1sl642ncvipqx0hzypvl5hsiqngy0sib0kq242g4mic7vnid6bn9";
+    url = "https://pypi.python.org/packages/py2.py3/w/wheel/wheel-0.29.0-py2.py3-none-any.whl";
+    sha256 = "ea8033fc9905804e652f75474d33410a07404c1a78dd3c949a66863bd1050ebd";
   };
   setuptools_source = fetchurl {
     url = "https://pypi.python.org/packages/3.5/s/setuptools/setuptools-19.4-py2.py3-none-any.whl";
@@ -11,11 +11,11 @@ let
   };
 in stdenv.mkDerivation rec {
   name = "python-${python.version}-bootstrapped-pip-${version}";
-  version = "7.1.2";
+  version = "8.0.2";
 
   src = fetchurl {
     url = "https://pypi.python.org/packages/py2.py3/p/pip/pip-${version}-py2.py3-none-any.whl";
-    sha256 = "133hx6jaspm6hd02gza66lng37l65yficc2y2x1gh16fbhxrilxr";
+    sha256 = "249a6f3194be8c2e8cb4d4be3f6fd16a9f1e3336218caffa8e7419e3816f9988";
   };
 
   unpackPhase = ''
@@ -27,12 +27,6 @@ in stdenv.mkDerivation rec {
 
   patchPhase = ''
     mkdir -p $out/bin
-
-    # patch pip to support "pip install --prefix"
-    # https://github.com/pypa/pip/pull/3252
-    pushd $out/${python.sitePackages}/
-    patch -p1 < ${./pip-7.0.1-prefix.patch}
-    popd
   '';
 
   buildInputs = [ python makeWrapper unzip ];
diff --git a/pkgs/development/python-modules/bootstrapped-pip/pip-7.0.1-prefix.patch b/pkgs/development/python-modules/bootstrapped-pip/pip-7.0.1-prefix.patch
deleted file mode 100644
index 21936ec99e6b..000000000000
--- a/pkgs/development/python-modules/bootstrapped-pip/pip-7.0.1-prefix.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-commit e87c83d95bb91acdca92202e94488ca51a70e059
-Author: Domen Kožar <domen@dev.si>
-Date:   Mon Nov 16 17:39:44 2015 +0100
-
-    WIP
-
-diff --git a/pip/commands/install.py b/pip/commands/install.py
-index dbcf100..05d5a08 100644
---- a/pip/commands/install.py
-+++ b/pip/commands/install.py
-@@ -139,6 +139,13 @@ class InstallCommand(RequirementCommand):
-                  "directory.")
- 
-         cmd_opts.add_option(
-+            '--prefix',
-+            dest='prefix_path',
-+            metavar='dir',
-+            default=None,
-+            help="Installation prefix where lib, bin and other top-level folders are placed")
-+
-+        cmd_opts.add_option(
-             "--compile",
-             action="store_true",
-             dest="compile",
-@@ -309,6 +316,7 @@ class InstallCommand(RequirementCommand):
-                             install_options,
-                             global_options,
-                             root=options.root_path,
-+                            prefix=options.prefix_path,
-                         )
-                         reqs = sorted(
-                             requirement_set.successfully_installed,
-diff --git a/pip/locations.py b/pip/locations.py
-index 4e6f65d..43aeb1f 100644
---- a/pip/locations.py
-+++ b/pip/locations.py
-@@ -163,7 +163,7 @@ site_config_files = [
- 
- 
- def distutils_scheme(dist_name, user=False, home=None, root=None,
--                     isolated=False):
-+                     isolated=False, prefix=None):
-     """
-     Return a distutils install scheme
-     """
-@@ -187,6 +187,8 @@ def distutils_scheme(dist_name, user=False, home=None, root=None,
-     i.user = user or i.user
-     if user:
-         i.prefix = ""
-+    else:
-+        i.prefix = prefix or i.prefix
-     i.home = home or i.home
-     i.root = root or i.root
-     i.finalize_options()
-diff --git a/pip/req/req_install.py b/pip/req/req_install.py
-index 7c5bf8f..6f80a18 100644
---- a/pip/req/req_install.py
-+++ b/pip/req/req_install.py
-@@ -792,7 +792,7 @@ exec(compile(
-         else:
-             return True
- 
--    def install(self, install_options, global_options=[], root=None):
-+    def install(self, install_options, global_options=[], root=None, prefix=None):
-         if self.editable:
-             self.install_editable(install_options, global_options)
-             return
-@@ -800,7 +800,7 @@ exec(compile(
-             version = pip.wheel.wheel_version(self.source_dir)
-             pip.wheel.check_compatibility(version, self.name)
- 
--            self.move_wheel_files(self.source_dir, root=root)
-+            self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
-             self.install_succeeded = True
-             return
- 
-@@ -833,6 +833,8 @@ exec(compile(
- 
-             if root is not None:
-                 install_args += ['--root', root]
-+            if prefix is not None:
-+                install_args += ['--prefix', prefix]
- 
-             if self.pycompile:
-                 install_args += ["--compile"]
-@@ -988,12 +990,13 @@ exec(compile(
-     def is_wheel(self):
-         return self.link and self.link.is_wheel
- 
--    def move_wheel_files(self, wheeldir, root=None):
-+    def move_wheel_files(self, wheeldir, root=None, prefix=None):
-         move_wheel_files(
-             self.name, self.req, wheeldir,
-             user=self.use_user_site,
-             home=self.target_dir,
-             root=root,
-+            prefix=prefix,
-             pycompile=self.pycompile,
-             isolated=self.isolated,
-         )
-diff --git a/pip/wheel.py b/pip/wheel.py
-index 403f48b..14eb141 100644
---- a/pip/wheel.py
-+++ b/pip/wheel.py
-@@ -234,12 +234,12 @@ def get_entrypoints(filename):
- 
- 
- def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
--                     pycompile=True, scheme=None, isolated=False):
-+                     pycompile=True, scheme=None, isolated=False, prefix=None):
-     """Install a wheel"""
- 
-     if not scheme:
-         scheme = distutils_scheme(
--            name, user=user, home=home, root=root, isolated=isolated
-+            name, user=user, home=home, root=root, isolated=isolated, prefix=prefix,
-         )
- 
-     if root_is_purelib(name, wheeldir):
-diff --git a/pip/req/req_install.py b/pip/req/req_install.py
-index 51bf4a7..e2e285e 100644
---- a/pip/req/req_install.py
-+++ b/pip/req/req_install.py
-@@ -795,7 +795,7 @@ exec(compile(
-     def install(self, install_options, global_options=[], root=None,
-                 prefix=None):
-         if self.editable:
--            self.install_editable(install_options, global_options)
-+            self.install_editable(install_options, global_options, prefix=prefix)
-             return
-         if self.is_wheel:
-             version = pip.wheel.wheel_version(self.source_dir)
-@@ -929,12 +929,16 @@ exec(compile(
-             rmtree(self._temp_build_dir)
-         self._temp_build_dir = None
- 
--    def install_editable(self, install_options, global_options=()):
-+    def install_editable(self, install_options, global_options=(), prefix=None):
-         logger.info('Running setup.py develop for %s', self.name)
- 
-         if self.isolated:
-             global_options = list(global_options) + ["--no-user-cfg"]
- 
-+        if prefix:
-+            prefix_param = ['--prefix={0}'.format(prefix)]
-+            install_options = list(install_options) + prefix_param
-+
-         with indent_log():
-             # FIXME: should we do --install-headers here too?
-             cwd = self.source_dir
-
diff --git a/pkgs/development/python-modules/cairocffi/dlopen-paths.patch b/pkgs/development/python-modules/cairocffi/dlopen-paths.patch
new file mode 100644
index 000000000000..bc5e939ceba9
--- /dev/null
+++ b/pkgs/development/python-modules/cairocffi/dlopen-paths.patch
@@ -0,0 +1,47 @@
+commit 705dc9a55bd160625d9996e63fc7dc532d0ad0ab
+Author: Alexander V. Nikolaev <avn@avnik.info>
+Date:   Sat Feb 6 08:09:06 2016 +0200
+
+    Patch dlopen() to allow direct paths to all required libs
+    
+    This patch is NixOS specific
+
+diff --git a/cairocffi/__init__.py b/cairocffi/__init__.py
+index 718aa7f..1a1dcff 100644
+--- a/cairocffi/__init__.py
++++ b/cairocffi/__init__.py
+@@ -27,20 +27,22 @@ VERSION = '0.7.2'
+ version = '1.10.0'
+ version_info = (1, 10, 0)
+ 
++# Use hardcoded soname, because ctypes.util use gcc/objdump which shouldn't be required for runtime
++_LIBS = {
++    'cairo': '@cairo@/lib/libcairo.so.2',
++    'glib-2.0': '@glib@/lib/libglib-2.0.so.0',
++    'gobject-2.0': '@glib@/lib/libgobject-2.0.so.0',
++    'gdk_pixbuf-2.0': '@gdk_pixbuf@/lib/libgdk_pixbuf-2.0.so.0',
++}
+ 
+-def dlopen(ffi, *names):
++def dlopen(ffi, name, *names):
+     """Try various names for the same library, for different platforms."""
+-    for name in names:
+-        for lib_name in [name, 'lib' + name]:
+-            try:
+-                path = ctypes.util.find_library(lib_name)
+-                if path:
+-                    lib = ffi.dlopen(path)
+-                    if lib:
+-                        return lib
+-            except OSError:
+-                pass
+-    raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
++    path = _LIBS.get(name, None)
++    if path:
++        lib = ffi.dlopen(path)
++        if lib:
++            return lib
++    raise OSError("dlopen() failed to load a library: %s as %s" % (name, path))
+ 
+ 
+ cairo = dlopen(ffi, 'cairo', 'cairo-2')
diff --git a/pkgs/development/python-modules/numpy-scipy-support.nix b/pkgs/development/python-modules/numpy-scipy-support.nix
deleted file mode 100644
index 422de794e31b..000000000000
--- a/pkgs/development/python-modules/numpy-scipy-support.nix
+++ /dev/null
@@ -1,35 +0,0 @@
-{
-  # Python package expression
-  python,
-  # Name of package (e.g. numpy or scipy)
-  pkgName,
-  # OpenBLAS math library
-  openblas
-}:
-
-{
-  # Re-export openblas here so that it can be sure that the same one will be used
-  # in the propagatedBuildInputs.
-  inherit openblas;
-
-  # First "install" the package, then import what was installed, and call the
-  # .test() function, which will run the test suite.
-  checkPhase = ''
-    runHook preCheck
-    pushd dist
-    ${python.interpreter} -c 'import ${pkgName}; ${pkgName}.test("fast", verbose=10)'
-    popd
-    runHook postCheck
-  '';
-
-  # Creates a site.cfg telling the setup script where to find depended-on
-  # math libraries.
-  preBuild = ''
-    echo "Creating site.cfg file..."
-    cat << EOF > site.cfg
-    [openblas]
-    include_dirs = ${openblas}/include
-    library_dirs = ${openblas}/lib
-    EOF
-  '';
-}
diff --git a/pkgs/development/python-modules/numpy.nix b/pkgs/development/python-modules/numpy.nix
new file mode 100644
index 000000000000..141c8b14fa6d
--- /dev/null
+++ b/pkgs/development/python-modules/numpy.nix
@@ -0,0 +1,51 @@
+{lib, python, buildPythonPackage, isPyPy, gfortran, nose, blas}:
+
+args:
+
+let
+  inherit (args) version;
+in buildPythonPackage (args // rec {
+
+  name = "numpy-${version}";
+
+  disabled = isPyPy;
+  buildInputs = args.buildInputs or [ gfortran nose ];
+  propagatedBuildInputs = args.propagatedBuildInputs or [ passthru.blas ];
+
+  preConfigure = ''
+    sed -i 's/-faltivec//' numpy/distutils/system_info.py
+  '';
+
+  preBuild = ''
+    echo "Creating site.cfg file..."
+    cat << EOF > site.cfg
+    [openblas]
+    include_dirs = ${passthru.blas}/include
+    library_dirs = ${passthru.blas}/lib
+    EOF
+  '';
+
+  checkPhase = ''
+    runHook preCheck
+    pushd dist
+    ${python.interpreter} -c 'import numpy; numpy.test("fast", verbose=10)'
+    popd
+    runHook postCheck
+  '';
+
+  passthru = {
+    blas = blas;
+  };
+
+  # The large file support test is disabled because it takes forever
+  # and can cause the machine to run out of disk space when run.
+  prePatch = ''
+    sed -i 's/test_large_file_support/donttest/' numpy/lib/tests/test_format.py
+  '';
+
+  meta = {
+    description = "Scientific tools for Python";
+    homepage = "http://numpy.scipy.org/";
+    maintainers = with lib.maintainers; [ fridh ];
+  } // (args.meta or {});
+})
diff --git a/pkgs/development/python-modules/scipy.nix b/pkgs/development/python-modules/scipy.nix
new file mode 100644
index 000000000000..ae312cd32d59
--- /dev/null
+++ b/pkgs/development/python-modules/scipy.nix
@@ -0,0 +1,47 @@
+{lib, python, buildPythonPackage, isPyPy, gfortran, nose}:
+
+args:
+
+let
+  inherit (args) version;
+  inherit (args) numpy;
+in buildPythonPackage (args // rec {
+
+  name = "scipy-${version}";
+
+  buildInputs = (args.buildInputs or [ gfortran nose ]);
+  propagatedBuildInputs = (args.propagatedBuildInputs or [ passthru.blas numpy]);
+
+  preConfigure = ''
+    sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py
+  '';
+
+  preBuild = ''
+    echo "Creating site.cfg file..."
+    cat << EOF > site.cfg
+    [openblas]
+    include_dirs = ${passthru.blas}/include
+    library_dirs = ${passthru.blas}/lib
+    EOF
+  '';
+
+  checkPhase = ''
+    runHook preCheck
+    pushd dist
+    ${python.interpreter} -c 'import scipy; scipy.test("fast", verbose=10)'
+    popd
+    runHook postCheck
+  '';
+
+  passthru = {
+    blas = numpy.blas;
+  };
+
+  setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
+
+  meta = {
+    description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. ";
+    homepage = http://www.scipy.org/;
+    maintainers = with lib.maintainers; [ fridh ];
+  } // (args.meta or {});
+})