<commit_before>{ stdenv
, buildPythonPackage
, fetchgit
, fetchurl

, pkgs
, pythonPackages
}:

let
  inherit (pythonPackages)
    isPy3k;
in

buildPythonPackage rec {
  name = "deluge-${version}";
  #version = "1.3.12";
  version = "2016-05-18";

  /*src = fetchurl {
    url = "http://download.deluge-torrent.org/source/${name}.tar.bz2";
    sha256 = "565745b2a3f0567fc007dbdfeea2aa96a6bebd7dbdda2ec932a3017c66613c93";
  };*/
  # Remove if 1.3.13 or newer release is ever tagged
  src = fetchgit {
    url = "http://git.deluge-torrent.org/deluge";
    rev = "1a11e085b271d880edde835633d89b1ec4591fa2";
    branchName = "1.3-stable";
    sha256 = "1cq55yiiaq7b3nn4k1kca9y4r6r3kaczll8k3ddw7r22glp6zciz";
  };

  nativeBuildInputs = [
    pkgs.gettext
    pkgs.intltool
  ];

  propagatedBuildInputs = [
  # geoip-database
  # setproctitle
    pkgs.libtorrent-rasterbar_1-0
    pkgs.librsvg
    pkgs.xdg-utils
    pythonPackages.chardet
    pythonPackages.Mako
    #pythonPackages.pillow
    #pythonPackages.pygame
    pythonPackages.pygobject
    pythonPackages.pygtk
    pythonPackages.pyopenssl
    #pythonPackages.python-appindicator
    #pythonPackages.notify-python
    pythonPackages.pyxdg
    pythonPackages.setuptools
    pythonPackages.service-identify
    pythonPackages.simplejson
    pythonPackages.twisted
  ];

  postInstall = ''
    mkdir -pv $out/share/applications
    cp -Rv deluge/data/pixmaps $out/share/
    cp -Rv deluge/data/icons $out/share/
    cp -v deluge/data/share/applications/deluge.desktop $out/share/applications
  '';

  disabled = isPy3k;

  doCheck = true;

  meta = with stdenv.lib; {
    description = "BitTorrent client with a client/server model";
    homepage = http://deluge-torrent.org;
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [
      codyopel<commit_msg>deluge: 2016-05-18 -> 2016-05-25<commit_after>{ stdenv
, buildPythonPackage
, fetchgit
, fetchurl
, pythonPackages

, chardet
, Mako
#, pillow
, pkgs
#, pygame
, pygobject
, pygtk
, pyopenssl
#, python-appindicator
#, notify-python
, pyxdg
, service-identify
, simplejson
, slimit
, twisted

, pytest
}:

let
  inherit (pythonPackages)
    isPy3k;
  inherit (stdenv.lib)
    optionals;
in

buildPythonPackage rec {
  name = "deluge-${version}";
  version = "2016-05-25";

  src = fetchgit {
    url = "git://git.deluge-torrent.org/deluge";
    rev = "7e229ceb2f0bd119f307751bf55106bfec592297";
    branchName = "develop";
    sha256 = "1ai34a1v2c35d0l9cabpp6f5x5acjpjrlnnvplvsw3z637s043jz";
  };

  nativeBuildInputs = [
    pkgs.gettext
    pkgs.intltool
  ];

  propagatedBuildInputs = [
    chardet
    # geoip-database
    Mako
    #pillow
    pkgs.libtorrent-rasterbar_1-0
    pkgs.librsvg
    pkgs.xdg-utils
    #pygame
    pygobject
    pygtk
    pyopenssl
    #python-appindicator
    #notify-python
    pyxdg
    service-identify
    # setproctitle
    simplejson
    twisted
  ] ++ [
    slimit
  ];

  buildInputs = optionals doCheck [
    pytest
  ];

  postPatch = /* Fix version detection */ ''
    sed -i setup.py \
      -e 's/_version = .*/_version = "${version}.dev"/'
  '' + /* Fix incorrect path to build directory */ ''
    sed -i setup.py \
      -e '/js_basedir/ s|self.build_lib, ||'
  '';

  postInstall = ''
    mkdir -pv $out/share/applications
    cp -Rv deluge/ui/data/pixmaps $out/share/
    cp -Rv deluge/ui/data/icons $out/share/
    cp -v deluge/ui/data/share/applications/deluge.desktop \
      $out/share/applications
  '';

  disabled = isPy3k;

  doCheck = false;

  meta = with stdenv.lib; {
    description = "BitTorrent client with a client/server model";
    homepage = http://deluge-torrent.org;
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [
      codyopel
{'fraction_non_alphanumeric': 0.1144, 'fraction_numerical': 0.04933333333333333, 'mean_word_length': 2.977730646871686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '950337', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1432, 'n_words': 241}