1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, pythonOlder
6, isPyPy
7, lazy-object-proxy
8, wrapt
9, typing-extensions
10, typed-ast
11, pytestCheckHook
12, setuptools-scm
13, pylint
14}:
15
16buildPythonPackage rec {
17 pname = "astroid";
18 version = "2.8.2"; # Check whether the version is compatible with pylint
19
20 disabled = pythonOlder "3.6";
21
22 src = fetchFromGitHub {
23 owner = "PyCQA";
24 repo = pname;
25 rev = "v${version}";
26 sha256 = "0140h4l7licwdw0scnfzsbi5b2ncxi7fxhdab7c1i3sk01r4asp6";
27 };
28
29 SETUPTOOLS_SCM_PRETEND_VERSION=version;
30
31 patches = [
32 (fetchpatch {
33 # Allow wrapt 1.13 (https://github.com/PyCQA/astroid/pull/1203)
34 url = "https://github.com/PyCQA/astroid/commit/fd510e08c2ee862cd284861e02b9bcc9a7fd9809.patch";
35 sha256 = "1s10whslcqnyz251fb76qkc9p41gagxljpljsmw89id1wywmjib4";
36 })
37 ];
38
39 nativeBuildInputs = [
40 setuptools-scm
41 ];
42
43 # From astroid/__pkginfo__.py
44 propagatedBuildInputs = [
45 lazy-object-proxy
46 wrapt
47 ] ++ lib.optionals (pythonOlder "3.10") [
48 typing-extensions
49 ] ++ lib.optional (!isPyPy && pythonOlder "3.8") typed-ast;
50
51 checkInputs = [
52 pytestCheckHook
53 ];
54
55 passthru.tests = {
56 inherit pylint;
57 };
58
59 meta = with lib; {
60 description = "An abstract syntax tree for Python with inference support";
61 homepage = "https://github.com/PyCQA/astroid";
62 license = licenses.lgpl21Plus;
63 platforms = platforms.all;
64 maintainers = with maintainers; [ ];
65 };
66}