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