1{ lib, buildPythonPackage, fetchFromGitHub, pythonOlder, isPy27
2, importlib-metadata
3, intreehooks
4, isort
5, pathlib2
6, pep517
7, pytest-mock
8, pytestCheckHook
9, tomlkit
10, typing ? null
11, virtualenv
12}:
13
14buildPythonPackage rec {
15 pname = "poetry-core";
16 version = "1.0.3";
17 format = "pyproject";
18
19 src = fetchFromGitHub {
20 owner = "python-poetry";
21 repo = pname;
22 rev = version;
23 sha256 = "07x0zagf9cfr7g3132jjd5byywkbnzpfbxjfjzpzpj70fqw70qrc";
24 };
25
26 postPatch = lib.optionalString (pythonOlder "3.8") ''
27 # remove >1.0.3
28 substituteInPlace pyproject.toml \
29 --replace 'importlib-metadata = {version = "^1.7.0", python = "~2.7 || >=3.5, <3.8"}' \
30 'importlib-metadata = {version = ">=1.7.0", python = "~2.7 || >=3.5, <3.8"}'
31 '';
32
33 nativeBuildInputs = [
34 intreehooks
35 ];
36
37 propagatedBuildInputs = lib.optionals (pythonOlder "3.8") [
38 importlib-metadata
39 ] ++ lib.optionals isPy27 [
40 pathlib2
41 typing
42 ];
43
44 checkInputs = [
45 pep517
46 pytest-mock
47 pytestCheckHook
48 tomlkit
49 virtualenv
50 ];
51
52 # requires git history to work correctly
53 disabledTests = [ "default_with_excluded_data" "default_src_with_excluded_data" ];
54
55 pythonImportsCheck = [ "poetry.core" ];
56
57 meta = with lib; {
58 description = "Core utilities for Poetry";
59 homepage = "https://github.com/python-poetry/poetry-core/";
60 license = licenses.mit;
61 maintainers = with maintainers; [ jonringer ];
62 };
63}