1{ lib, buildPythonPackage, fetchFromGitHub, pythonOlder, isPy27
2, git
3, importlib-metadata
4, intreehooks
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.7";
17 format = "pyproject";
18
19 src = fetchFromGitHub {
20 owner = "python-poetry";
21 repo = pname;
22 rev = version;
23 sha256 = "0v86x8f8pcbviv2cdn7jjbgj3c994qasx0bqk1kr0mj8m6pjwy9z";
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 git
46 pep517
47 pytest-mock
48 pytestCheckHook
49 tomlkit
50 virtualenv
51 ];
52
53 # requires git history to work correctly
54 disabledTests = [ "default_with_excluded_data" "default_src_with_excluded_data" ];
55
56 pythonImportsCheck = [ "poetry.core" ];
57
58 # allow for package to use pep420's native namespaces
59 pythonNamespaces = [ "poetry" ];
60
61 meta = with lib; {
62 description = "Core utilities for Poetry";
63 homepage = "https://github.com/python-poetry/poetry-core/";
64 license = licenses.mit;
65 maintainers = with maintainers; [ jonringer ];
66 };
67}