1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, pythonOlder
7, build
8, git
9, importlib-metadata
10, pep517
11, pytest-mock
12, pytestCheckHook
13, setuptools
14, tomlkit
15, virtualenv
16}:
17
18buildPythonPackage rec {
19 pname = "poetry-core";
20 version = "1.5.1";
21 format = "pyproject";
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "python-poetry";
27 repo = pname;
28 rev = version;
29 hash = "sha256-h3d0h+WCrrNlfPOlUx6Rj0aG6untD6MiunqvPj4yT+0=";
30 };
31
32 # revert update of vendored dependencies to unbreak e.g. zeroconf on x86_64-darwin
33 patches = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
34 (fetchpatch {
35 url = "https://github.com/python-poetry/poetry-core/commit/80d7dcdc722dee0e09e5f3303b663003d794832c.patch";
36 revert = true;
37 hash = "sha256-CPjkNCmuAiowp/kyKqnEfUQNmXK95RMJOIa24nG6xi8=";
38 })
39 (fetchpatch {
40 url = "https://github.com/python-poetry/poetry-core/commit/43fd7fe62676421b3661c96844b5d7cf49b87c07.patch";
41 revert = true;
42 hash = "sha256-fXq8L23qjLraLeMzB1bwW1jU0eGd236/GHIoYKwOuL0=";
43 })
44 ];
45
46 propagatedBuildInputs = lib.optionals (pythonOlder "3.8") [
47 importlib-metadata
48 ];
49
50 nativeCheckInputs = [
51 build
52 git
53 pep517
54 pytest-mock
55 pytestCheckHook
56 setuptools
57 tomlkit
58 virtualenv
59 ];
60
61 # Requires git history to work correctly
62 disabledTests = [
63 "default_with_excluded_data"
64 "default_src_with_excluded_data"
65 ];
66
67 pythonImportsCheck = [
68 "poetry.core"
69 ];
70
71 # Allow for package to use pep420's native namespaces
72 pythonNamespaces = [
73 "poetry"
74 ];
75
76 meta = with lib; {
77 changelog = "https://github.com/python-poetry/poetry-core/blob/${src.rev}/CHANGELOG.md";
78 description = "Core utilities for Poetry";
79 homepage = "https://github.com/python-poetry/poetry-core/";
80 license = licenses.mit;
81 maintainers = with maintainers; [ jonringer ];
82 };
83}