2009-05-24 22:02:59 +01:00
|
|
|
/* This function provides a generic Python package builder. It is
|
2014-01-06 22:24:05 +00:00
|
|
|
intended to work with packages that use `distutils/setuptools'
|
2009-05-24 22:02:59 +01:00
|
|
|
(http://pypi.python.org/pypi/setuptools/), which represents a large
|
|
|
|
number of Python packages nowadays. */
|
|
|
|
|
2016-08-17 13:23:47 +01:00
|
|
|
{ lib
|
|
|
|
, python
|
|
|
|
, mkPythonDerivation
|
|
|
|
, bootstrapped-pip
|
2016-12-03 12:04:52 +00:00
|
|
|
, flit
|
2016-08-17 13:23:47 +01:00
|
|
|
}:
|
2009-05-24 22:02:59 +01:00
|
|
|
|
2016-12-03 12:04:52 +00:00
|
|
|
let
|
|
|
|
setuptools-specific = import ./build-python-package-setuptools.nix { inherit lib python bootstrapped-pip; };
|
|
|
|
flit-specific = import ./build-python-package-flit.nix { inherit flit; };
|
|
|
|
wheel-specific = import ./build-python-package-wheel.nix { };
|
|
|
|
common = import ./build-python-package-common.nix { inherit python bootstrapped-pip; };
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
# Several package formats are supported.
|
|
|
|
# "setuptools" : Install a common setuptools/distutils based package. This builds a wheel.
|
|
|
|
# "wheel" : Install from a pre-compiled wheel.
|
|
|
|
# "flit" : Install a flit package. This builds a wheel.
|
|
|
|
# "other" : Provide your own buildPhase and installPhase.
|
|
|
|
format ? "setuptools"
|
2011-03-28 16:30:48 +01:00
|
|
|
, ... } @ attrs:
|
2009-05-24 22:02:59 +01:00
|
|
|
|
2015-11-17 10:38:26 +00:00
|
|
|
let
|
2016-04-26 16:57:13 +01:00
|
|
|
formatspecific =
|
2016-12-03 12:04:52 +00:00
|
|
|
if format == "setuptools" then common (setuptools-specific attrs)
|
|
|
|
else if format == "flit" then common (flit-specific attrs)
|
|
|
|
else if format == "wheel" then common (wheel-specific attrs)
|
|
|
|
else if format == "other" then {}
|
|
|
|
else throw "Unsupported format ${format}";
|
2014-03-10 09:06:04 +00:00
|
|
|
|
2016-12-03 12:04:52 +00:00
|
|
|
in mkPythonDerivation ( attrs // formatspecific )
|