]> git.immae.eu Git - perso/Immae/Config/Nix/NUR.git/commitdiff
Upgrade weboob
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 8 Mar 2020 13:40:45 +0000 (14:40 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 24 Apr 2020 22:04:51 +0000 (00:04 +0200)
overlays/weboob/default.nix
overlays/weboob/weboob.nix [new file with mode: 0644]

index d0a15a7d1ad7a578b78784e56387c627a8922601..6e5656b77d11d88ca545113ef6ed661e68a92f7c 100644 (file)
@@ -1,15 +1,8 @@
 self: super: {
-  weboob = (self.pythonPackages.weboob.overridePythonAttrs {
-    setupPyBuildFlags = [ "--no-qt" "--xdg" ];
-  }).overrideAttrs (old: rec {
-    version = "1.5";
-    src = self.fetchurl {
-      url = "https://git.weboob.org/weboob/weboob/-/archive/${version}/${old.pname}-${version}.tar.gz";
-      sha256 = "0l6q5nm5g0zn6gmf809059kddrbds27wgygxsfkqja9blks5vq7z";
-    };
-    postInstall = ''${old.postInstall or ""}
-      mkdir -p $out/share/bash-completion/completions/
-      cp tools/weboob_bash_completion $out/share/bash-completion/completions/weboob
-    '';
-  });
+  weboob = self.callPackage ./weboob.nix {
+    inherit (super.python3Packages) buildPythonPackage fetchPypi nose
+    pillow prettytable pyyaml dateutil gdata requests feedparser lxml
+    pyqt5 simplejson cssselect pdfminer termcolor
+    google_api_python_client unidecode Babel html5lib html2text;
+  };
 }
diff --git a/overlays/weboob/weboob.nix b/overlays/weboob/weboob.nix
new file mode 100644 (file)
index 0000000..faafbc4
--- /dev/null
@@ -0,0 +1,67 @@
+{ buildPythonPackage, fetchurl, fetchPypi, stdenv
+, nose, pillow, prettytable, pyyaml, dateutil, gdata
+, requests, feedparser, lxml, gnupg, pyqt5
+, libyaml, simplejson, cssselect, pdfminer
+, termcolor, google_api_python_client, html2text
+, unidecode, html5lib, Babel
+}:
+let
+  mechanize = buildPythonPackage rec {
+    pname = "mechanize";
+    version = "0.4.4";
+    src = fetchPypi {
+      inherit version pname;
+      sha256 = "9fff89e973bdf1aee75a351bd4dde53ca51a7e76944ddeae3ea3b6ad6c46045c";
+    };
+    propagatedBuildInputs = [ html5lib ];
+    doCheck = false;
+  };
+in
+
+buildPythonPackage rec {
+  pname = "weboob";
+  version = "2.0";
+
+  src = fetchurl {
+    url = "https://symlink.me/attachments/download/356/${pname}-${version}.tar.gz";
+    sha256 = "1p0wd6k28s0cdxkrj5s6vmi120w6v5vfxxyddqg7s2xjxv6mbbbm";
+  };
+
+  postPatch = ''
+    # Disable doctests that require networking:
+    sed -i -n -e '/^ *def \+pagination *(.*: *$/ {
+      p; n; p; /"""\|'\'\'\'''/!b
+
+      :loop
+      n; /^ *\(>>>\|\.\.\.\)/ { h; bloop }
+      x; /^ *\(>>>\|\.\.\.\)/bloop; x
+      p; /"""\|'\'\'\'''/b
+      bloop
+    }; p' weboob/browser/browsers.py weboob/browser/pages.py
+  '';
+
+  postInstall = ''
+    mkdir -p $out/share/bash-completion/completions/
+    cp tools/weboob_bash_completion $out/share/bash-completion/completions/weboob
+  '';
+
+  checkInputs = [ nose ];
+
+  nativeBuildInputs = [ pyqt5 ];
+
+  propagatedBuildInputs = [ pillow prettytable pyyaml dateutil
+    gdata requests feedparser lxml gnupg pyqt5 libyaml
+    simplejson cssselect mechanize pdfminer termcolor
+    google_api_python_client html2text unidecode Babel ];
+
+  checkPhase = ''
+    nosetests
+  '';
+
+  meta = {
+    homepage = http://weboob.org;
+    description = "Collection of applications and APIs to interact with websites without requiring the user to open a browser";
+    license = stdenv.lib.licenses.agpl3;
+  };
+}
+