1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools-scm,
8
9 # dependencies
10 extractcode-7z,
11 extractcode-libarchive,
12 patch,
13 six,
14 typecode,
15
16 # tests
17 pytest-xdist,
18 pytestCheckHook,
19}:
20
21buildPythonPackage rec {
22 pname = "extractcode";
23 version = "31.0.0";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "aboutcode-org";
28 repo = "extractcode";
29 tag = "v${version}";
30 hash = "sha256-mPHGe/pMaOnIykDd4AjGcvh/T4UrbaGxrSVGhchqYFM=";
31 };
32
33 postPatch = ''
34 # PEP440 support was removed in newer setuptools, https://github.com/nexB/extractcode/pull/46
35 substituteInPlace setup.cfg \
36 --replace-fail ">=3.6.*" ">=3.6"
37 '';
38
39 dontConfigure = true;
40
41 build-system = [ setuptools-scm ];
42
43 dependencies = [
44 extractcode-7z
45 extractcode-libarchive
46 patch
47 six
48 typecode
49 ];
50
51 nativeCheckInputs = [
52 pytest-xdist
53 pytestCheckHook
54 ];
55
56 disabledTestPaths = [
57 # CLI test tests the CLI which we can't do until after install
58 "tests/test_extractcode_cli.py"
59 ];
60
61 disabledTests = [
62 # test_uncompress_* wants to use a binary to extract instead of the provided library
63 "test_uncompress_lz4_basic"
64 "test_extract_tarlz4_basic"
65 "test_extract_rar_with_trailing_data"
66 # Tries to parse /boot/vmlinuz-*, which is not available in the nix sandbox
67 "test_can_extract_qcow2_vm_image_as_tarball"
68 "test_can_extract_qcow2_vm_image_not_as_tarball"
69 "test_can_listfs_from_qcow2_image"
70 "test_get_extractor_qcow2"
71 # WARNING patch:patch.py:450 inconsistent line ends in patch hunks
72 "test_patch_info_patch_patches_windows_plugin_explorer_patch"
73 # AssertionError: assert [['linux-2.6...._end;', ...]]] == [['linux-2.6...._end;', ...]]]
74 "test_patch_info_patch_patches_misc_linux_st710x_patches_motorola_rootdisk_c_patch"
75 # extractcode.libarchive2.ArchiveErrorRetryable: Damaged tar archive
76 "test_extract_python_testtar_tar_archive_with_special_files"
77 # AssertionError: [<function extract at 0x7ffff493dd00>] == [] for archive/rar/basic.rar
78 "test_get_extractors_2"
79 ];
80
81 pythonImportsCheck = [ "extractcode" ];
82
83 meta = {
84 description = "Universal archive extractor using z7zip, libarchive, other libraries and the Python standard library";
85 homepage = "https://github.com/aboutcode-org/extractcode";
86 changelog = "https://github.com/aboutcode-org/extractcode/releases/tag/v${version}";
87 license = lib.licenses.asl20;
88 maintainers = [ ];
89 mainProgram = "extractcode";
90 };
91}