1{ lib
2, buildPythonPackage
3, click
4, fetchFromGitHub
5, fetchpatch
6, pytestCheckHook
7, pythonAtLeast
8, pythonOlder
9, six
10}:
11
12buildPythonPackage rec {
13 pname = "xdis";
14 version = "6.0.5";
15 format = "setuptools";
16
17 # No support for Python 3.11, https://github.com/rocky/python-xdis/issues/98
18 disabled = pythonOlder "3.6" || pythonAtLeast "3.11";
19
20 src = fetchFromGitHub {
21 owner = "rocky";
22 repo = "python-xdis";
23 rev = "refs/tags/${version}";
24 hash = "sha256-3mL0EuPHF/dithovrYvMjweYGwGhrN75N9MRfLjNC34=";
25 };
26
27 postPatch = ''
28 # Our Python release is not in the test matrix
29 substituteInPlace xdis/magics.py \
30 --replace "3.10.4" "3.10.5 3.10.6 3.10.7 3.10.8 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14"
31 '';
32
33 propagatedBuildInputs = [
34 click
35 six
36 ];
37
38 nativeCheckInputs = [
39 pytestCheckHook
40 ];
41
42 pythonImportsCheck = [
43 "xdis"
44 ];
45
46 # import file mismatch:
47 # imported module 'test_disasm' has this __file__ attribute:
48 # /build/source/pytest/test_disasm.py
49 # which is not the same as the test file we want to collect:
50 # /build/source/test_unit/test_disasm.py
51 disabledTestPaths = [
52 "test_unit/test_disasm.py"
53 ];
54
55 disabledTests = [
56 # AssertionError: events did not match expectation
57 "test_big_linenos"
58 # AssertionError: False is not true : PYTHON VERSION 4.0 is not in magic.magics.keys
59 "test_basic"
60 ];
61
62 meta = with lib; {
63 description = "Python cross-version byte-code disassembler and marshal routines";
64 homepage = "https://github.com/rocky/python-xdis";
65 changelog = "https://github.com/rocky/python-xdis/releases/tag/${version}";
66 license = licenses.gpl2Plus;
67 maintainers = with maintainers; [ onny ];
68 };
69}