<commit_before>{ stdenv, fetchurl, python, buildPythonPackage, pythonPackages, pkgconfig
, pyrex096, ffmpeg, boost, glib, pygobject, gtk2, webkit_gtk2, libsoup, pygtk
, taglib, pysqlite, pycurl, mutagen, pycairo, pythonDBus, pywebkitgtk
, libtorrentRasterbar
, gst_python, gst_plugins_base, gst_plugins_good, gst_ffmpeg
}:

buildPythonPackage rec {
  name = "miro-${version}";
  namePrefix = "";
  version = "6.0";

  src = fetchurl {
    url = "http://ftp.osuosl.org/pub/pculture.org/miro/src/${name}.tar.gz";
    sha256 = "0sq25w365i1fz95398vxql3yjl5i6mq77mnmlhmn0pgyg111k3am";
  };

  setSourceRoot = ''
    sourceRoot=${name}/linux
  '';

  patches = [ ./gconf.patch ];

  postPatch = ''
    sed -i -e '2i import os; os.environ["GST_PLUGIN_PATH"] = \\\
      '"'$GST_PLUGIN_PATH'" miro.real

    sed -i -e 's/\$(shell which python)/python/' Makefile
    sed -i -e 's|/usr/bin/||' -e 's|/usr||' \
           -e 's/BUILD_TIME[^,]*/BUILD_TIME=0/' setup.py

    sed -i -e 's|default="/usr/bin/ffmpeg"|default="${ffmpeg}/bin/ffmpeg"|' \
      plat/options.py

    sed -i -e 's|/usr/share/miro/themes|'"$out/share/miro/themes"'|' \
           -e 's/gnome-open/xdg-open/g' \
           -e '/RESOURCE_ROOT =.*(/,/)/ {
                 c RESOURCE_ROOT = '"'$out/share/miro/resources/'"'
               }' \
           plat/resources.py
  '';

  # Disabled for now, because it requires networking and even if we skip those
  # tests, the whole test run takes around 10-20 minutes.
  doCheck = false;
  checkPhase = ''
    HOME="$TEMPDIR" LANG=en_US.UTF-8 python miro.real --unittest
  '';

  preInstall = ''
    # see https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix
    ${python}/bin/${python.executable} setup.py install_data --root=$out
    sed -i '/data_files=data_files/d' setup.py
  '';

  postInstall = ''
    mv "$out/bin/miro.real" "$out/bin/miro"
  '';

  buildInputs = [
    pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkit_gtk2 libsoup
    pygtk taglib
  ];<commit_msg>miro: build with webkitgtk2<commit_after>{ stdenv, fetchurl, python, buildPythonPackage, pythonPackages, pkgconfig
, pyrex096, ffmpeg, boost, glib, pygobject, gtk2, webkitgtk2, libsoup, pygtk
, taglib, pysqlite, pycurl, mutagen, pycairo, pythonDBus, pywebkitgtk
, libtorrentRasterbar, glib_networking, gsettings_desktop_schemas
, gst_python, gst_plugins_base, gst_plugins_good, gst_ffmpeg
}:

buildPythonPackage rec {
  name = "miro-${version}";
  namePrefix = "";
  version = "6.0";

  src = fetchurl {
    url = "http://ftp.osuosl.org/pub/pculture.org/miro/src/${name}.tar.gz";
    sha256 = "0sq25w365i1fz95398vxql3yjl5i6mq77mnmlhmn0pgyg111k3am";
  };

  setSourceRoot = ''
    sourceRoot=${name}/linux
  '';

  patches = [ ./gconf.patch ];

  postPatch = ''
    sed -i -e 's/\$(shell which python)/python/' Makefile
    sed -i -e 's|/usr/bin/||' -e 's|/usr||' \
           -e 's/BUILD_TIME[^,]*/BUILD_TIME=0/' setup.py

    sed -i -e 's|default="/usr/bin/ffmpeg"|default="${ffmpeg}/bin/ffmpeg"|' \
      plat/options.py

    sed -i -e 's|/usr/share/miro/themes|'"$out/share/miro/themes"'|' \
           -e 's/gnome-open/xdg-open/g' \
           -e '/RESOURCE_ROOT =.*(/,/)/ {
                 c RESOURCE_ROOT = '"'$out/share/miro/resources/'"'
               }' \
           plat/resources.py
  '';

  # Disabled for now, because it requires networking and even if we skip those
  # tests, the whole test run takes around 10-20 minutes.
  doCheck = false;
  checkPhase = ''
    HOME="$TEMPDIR" LANG=en_US.UTF-8 python miro.real --unittest
  '';

  preInstall = ''
    # see https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix
    ${python}/bin/${python.executable} setup.py install_data --root=$out
    sed -i '/data_files=data_files/d' setup.py
  '';

  postInstall = ''
    mv "$out/bin/miro.real" "$out/bin/miro"
    wrapProgram "$out/bin/miro" \
      --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH" \
      --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
      --prefix XDG_DATA_DIRS : "${gsettings_desktop_schemas}/share:$out/share"
  '';

  buildInputs = [
    pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkitgtk2 libsoup
    pygtk taglib
  ];
{'fraction_non_alphanumeric': 0.16113074204946998, 'fraction_numerical': 0.022143698468786808, 'mean_word_length': 3.0056603773584905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7474015', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1628, 'n_words': 297}