1{
2 lib,
3 buildPythonPackage,
4 click,
5 fetchFromGitHub,
6 fetchpatch,
7 pytestCheckHook,
8 pythonOlder,
9 setuptools,
10 six,
11}:
12
13buildPythonPackage rec {
14 pname = "xdis";
15 version = "6.1.1";
16 pyproject = true;
17
18 disabled = pythonOlder "3.6";
19
20 src = fetchFromGitHub {
21 owner = "rocky";
22 repo = "python-xdis";
23 rev = "refs/tags/${version}";
24 hash = "sha256-Fn1cyUPMrn1SEXl4sdQwJiNHaY+BbxBDz3nKZY965/0=";
25 };
26
27 # Backport magics for newer newer python versions
28 patches = [
29 (fetchpatch {
30 url = "https://github.com/rocky/python-xdis/commit/fcba74a7f64c5e2879ca0779ff10f38f9229e7da.patch";
31 hash = "sha256-D7eJ97g4G6pmYL/guq0Ndf8yKTVBD2gAuUCAKwvlYbE=";
32 })
33 (fetchpatch {
34 url = "https://github.com/rocky/python-xdis/commit/b66976ff53a2c6e17a73fb7652ddd6c8054df8db.patch";
35 hash = "sha256-KO1y0nDTPmEZ+0/3Pjh+CvTdpr/p4AYZ8XdH5J+XzXo=";
36 })
37 (fetchpatch {
38 url = "https://github.com/rocky/python-xdis/commit/a9f50c0ba77cdbf4693388404c13a02796a4221a.patch";
39 hash = "sha256-gwMagKBY7d/+ohESTSl6M2IEjzABxfrddpdr58VJAk8=";
40 })
41 (fetchpatch {
42 url = "https://github.com/rocky/python-xdis/commit/d9e15acae76a413667912a10fbf8259711ed9c65.patch";
43 hash = "sha256-hpmKg+K1RiLSnmUIS8KtZRVBfvTO9bWbpsNhBFUM38o=";
44 })
45 (fetchpatch {
46 url = "https://github.com/rocky/python-xdis/commit/b412c878d0bc1b516bd01612d46d8830c36a14ad.patch";
47 hash = "sha256-W1JuIXYLO6iyjWiSnzCoXzFsedZjesq31gEPgrtjxas=";
48 })
49 ];
50
51 build-system = [
52 setuptools
53 ];
54
55 dependencies = [
56 click
57 six
58 ];
59
60 nativeCheckInputs = [ pytestCheckHook ];
61
62 pythonImportsCheck = [ "xdis" ];
63
64 disabledTestPaths = [
65 # import file mismatch:
66 # imported module 'test_disasm' has this __file__ attribute:
67 # /build/source/pytest/test_disasm.py
68 # which is not the same as the test file we want to collect:
69 # /build/source/test_unit/test_disasm.py
70 "test_unit/test_disasm.py"
71
72 # Doesn't run on non-2.7 but has global-level mis-import
73 "test_unit/test_dis27.py"
74
75 # Has Python 2 style prints
76 "test/decompyle/test_nested_scopes.py"
77 ];
78
79 disabledTests = [
80 # AssertionError: events did not match expectation
81 "test_big_linenos"
82 # AssertionError: False is not true : PYTHON VERSION 4.0 is not in magic.magics.keys
83 "test_basic"
84 ];
85
86 meta = {
87 description = "Python cross-version byte-code disassembler and marshal routines";
88 homepage = "https://github.com/rocky/python-xdis";
89 changelog = "https://github.com/rocky/python-xdis/releases/tag/${version}";
90 license = lib.licenses.gpl2Plus;
91 maintainers = with lib.maintainers; [
92 onny
93 melvyn2
94 ];
95 };
96}