1/* This function provides a generic Python package builder. It is
2 intended to work with packages that use `distutils/setuptools'
3 (http://pypi.python.org/pypi/setuptools/), which represents a large
4 number of Python packages nowadays. */
5
6{ lib
7, python
8, mkPythonDerivation
9, bootstrapped-pip
10, flit
11}:
12
13let
14 setuptools-specific = import ./build-python-package-setuptools.nix { inherit lib python bootstrapped-pip; };
15 flit-specific = import ./build-python-package-flit.nix { inherit python flit; };
16 wheel-specific = import ./build-python-package-wheel.nix { };
17 common = import ./build-python-package-common.nix { inherit python bootstrapped-pip; };
18in
19
20{
21# Several package formats are supported.
22# "setuptools" : Install a common setuptools/distutils based package. This builds a wheel.
23# "wheel" : Install from a pre-compiled wheel.
24# "flit" : Install a flit package. This builds a wheel.
25# "other" : Provide your own buildPhase and installPhase.
26format ? "setuptools"
27, ... } @ attrs:
28
29let
30 formatspecific =
31 if format == "setuptools" then common (setuptools-specific attrs)
32 else if format == "flit" then common (flit-specific attrs)
33 else if format == "wheel" then common (wheel-specific attrs)
34 else if format == "other" then {}
35 else throw "Unsupported format ${format}";
36
37in mkPythonDerivation ( attrs // formatspecific )