@@ -0,0 +1,55 @@
1+{ gui ? true,
2+ buildPythonPackage, fetchFromGitHub, lib,
3+ sphinx_1_2, lxml, isodate, numpy, pytest,
4+ tkinter ? null,
5+ ... }:
6+
7+let
8+ # Releases are published at http://arelle.org/download/ but sadly no
9+ # tags are published on github.
10+ version = "2017-06-01";
11+
12+ src = fetchFromGitHub {
13+ owner = "Arelle";
14+ repo = "Arelle";
15+ rev = "c883f843d55bb48f03a15afceb4cc823cd4601bd";
16+ sha256 = "1h48qdj0anv541rd3kna8bmcwfrl1l3yw76wsx8p6hx5prbmzg4v";
17+ };
18+
19+in
20+
21+buildPythonPackage {
22+ name = "arelle-${version}${lib.optionalString (!gui) "-headless"}";
23+ inherit src;
24+ outputs = ["out" "doc"];
25+ postPatch = "rm testParser2.py";
26+ buildInputs = [
27+ sphinx_1_2
28+ pytest
29+ ];
30+ propagatedBuildInputs = [
31+ lxml
32+ isodate
33+ numpy
34+ ] ++ lib.optional gui [
35+ tkinter
36+ ];
37+
38+ # arelle-gui is useless without gui dependencies, so delete it when !gui.
39+ postInstall = lib.optionalString (!gui) ''
40+ find $out/bin -name "*arelle-gui*" -delete
41+ '';
42+
43+ # Documentation
44+ postBuild = ''
45+ (cd apidocs && make html && cp -r _build $doc)
46+ '';
47+
48+ meta = {
49+ description = "An open source facility for XBRL, the eXtensible Business Reporting Language supporting various standards, exposed through a python or REST API" + lib.optionalString gui " and a graphical user interface";
50+ homepage = http://arelle.org/;
51+ license = lib.licenses.asl20;
52+ platforms = lib.platforms.all;
53+ maintainers = with lib.maintainers; [ roberth ];
54+ };
55+}