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