1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-24 19:08:30 +00:00
nixpkgs/pkgs/development/interpreters/python/build-python-package.nix

38 lines
1.3 KiB
Nix
Raw Normal View History

/* This function provides a generic Python package builder. It is
intended to work with packages that use `distutils/setuptools'
(http://pypi.python.org/pypi/setuptools/), which represents a large
number of Python packages nowadays. */
{ lib
, python
, mkPythonDerivation
, bootstrapped-pip
2016-12-03 12:04:52 +00:00
, flit
}:
2016-12-03 12:04:52 +00:00
let
setuptools-specific = import ./build-python-package-setuptools.nix { inherit lib python bootstrapped-pip; };
2017-02-01 13:26:27 +00:00
flit-specific = import ./build-python-package-flit.nix { inherit python flit; };
2016-12-03 12:04:52 +00:00
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"
, ... } @ attrs:
let
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}";
2017-02-01 13:26:27 +00:00
in mkPythonDerivation ( attrs // formatspecific )