1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 python,
7 pythonOlder,
8 setuptools,
9}:
10
11buildPythonPackage rec {
12 pname = "pyelftools";
13 version = "0.32";
14 pyproject = true;
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchFromGitHub {
19 owner = "eliben";
20 repo = "pyelftools";
21 tag = "v${version}";
22 hash = "sha256-58Twjf7ECOPynQ5KPCTDQWdD3nb7ADJZISozWGRGoXM=";
23 };
24
25 build-system = [ setuptools ];
26
27 doCheck = stdenv.hostPlatform.system == "x86_64-linux" && stdenv.hostPlatform.isGnu;
28
29 checkPhase = ''
30 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" test/external_tools/readelf
31 ${python.interpreter} test/run_all_unittests.py
32 ${python.interpreter} test/run_examples_test.py
33 ${python.interpreter} test/run_readelf_tests.py --parallel
34 '';
35
36 pythonImportsCheck = [ "elftools" ];
37
38 meta = {
39 description = "Python library for analyzing ELF files and DWARF debugging information";
40 homepage = "https://github.com/eliben/pyelftools";
41 changelog = "https://github.com/eliben/pyelftools/blob/v${version}/CHANGES";
42 license = with lib.licenses; [
43 # Public domain with Unlicense waiver.
44 unlicense
45 # pyelftools bundles construct library that is licensed under MIT license.
46 # See elftools/construct/{LICENSE,README} in the source code.
47 mit
48 ];
49 maintainers = with lib.maintainers; [
50 igsha
51 pamplemousse
52 ];
53 mainProgram = "readelf.py";
54 };
55}