1{
2 gui ? true,
3 buildPythonPackage,
4 fetchFromGitHub,
5 lib,
6 sphinx,
7 lxml,
8 isodate,
9 numpy,
10 openpyxl,
11 tkinter ? null,
12 py3to2,
13 isPy3k,
14 python,
15 ...
16}:
17
18buildPythonPackage rec {
19 pname = "arelle${lib.optionalString (!gui) "-headless"}";
20 version = "18.3";
21 format = "setuptools";
22
23 disabled = !isPy3k;
24
25 # Releases are published at http://arelle.org/download/ but sadly no
26 # tags are published on github.
27 src = fetchFromGitHub {
28 owner = "Arelle";
29 repo = "Arelle";
30 rev = "edgr${version}";
31 sha256 = "12a94ipdp6xalqyds7rcp6cjwps6fbj3byigzfy403hlqc9n1g33";
32 };
33 outputs = [
34 "out"
35 "doc"
36 ];
37 patches = [ ./tests.patch ];
38 postPatch = "rm testParser2.py";
39 nativeBuildInputs = [
40 sphinx
41 py3to2
42 ];
43 propagatedBuildInputs = [
44 lxml
45 isodate
46 numpy
47 openpyxl
48 ] ++ lib.optionals gui [ tkinter ];
49
50 # arelle-gui is useless without gui dependencies, so delete it when !gui.
51 postInstall =
52 lib.optionalString (!gui) ''
53 find $out/bin -name "*arelle-gui*" -delete
54 ''
55 +
56 # By default, not the entirety of the src dir is copied. This means we don't
57 # copy the `images` dir, which is needed for the gui version.
58 lib.optionalString (gui) ''
59 targetDir=$out/${python.sitePackages}
60 cp -vr $src/arelle $targetDir
61 '';
62
63 # Documentation
64 postBuild = ''
65 (cd apidocs && make html && cp -r _build $doc)
66 '';
67
68 doCheck = false;
69
70 checkPhase = ''
71 py.test
72 '';
73
74 meta = with lib; {
75 description =
76 ''
77 An open source facility for XBRL, the eXtensible Business Reporting
78 Language supporting various standards, exposed through a Python or
79 REST API''
80 + lib.optionalString gui " and a graphical user interface";
81 mainProgram = "arelle";
82 homepage = "http://arelle.org/";
83 license = licenses.asl20;
84 platforms = platforms.all;
85 maintainers = with maintainers; [ roberth ];
86 };
87}