2018-02-22 00:12:44 +01:00
|
|
|
{ stdenv, fetchFromGitHub, perl, python, sqlite, gpsbabel
|
2017-09-30 19:03:07 +02:00
|
|
|
, withWebKit ? false }:
|
2014-12-21 11:23:53 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
# Pytrainer needs a matplotlib with GTK backend. Also ensure we are
|
|
|
|
# using the pygtk with glade support as needed by pytrainer.
|
2018-02-22 00:12:44 +01:00
|
|
|
matplotlibGtk = python.pkgs.matplotlib.override {
|
2014-12-21 11:23:53 +01:00
|
|
|
enableGtk2 = true;
|
2018-02-22 00:12:44 +01:00
|
|
|
pygtk = python.pkgs.pyGtkGlade;
|
2014-12-21 11:23:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2018-02-22 00:12:44 +01:00
|
|
|
python.pkgs.buildPythonApplication rec {
|
2018-02-26 22:53:18 +01:00
|
|
|
name = "pytrainer-${version}";
|
2018-05-10 21:41:40 +02:00
|
|
|
version = "1.12.1";
|
2014-12-21 11:23:53 +01:00
|
|
|
|
2017-09-30 19:03:07 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pytrainer";
|
|
|
|
repo = "pytrainer";
|
|
|
|
rev = "v${version}";
|
2018-05-10 21:41:40 +02:00
|
|
|
sha256 = "0rzf8kks96qzlknh6g3b9pjq04j7qk6rmz58scp7sck8xz9rjbwx";
|
2014-12-21 11:23:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
namePrefix = "";
|
|
|
|
|
2017-09-30 19:03:07 +02:00
|
|
|
patches = [
|
|
|
|
# The test fails in the UTC timezone and C locale.
|
|
|
|
./fix-test-tz.patch
|
2014-12-21 11:23:53 +01:00
|
|
|
|
2017-09-30 19:03:07 +02:00
|
|
|
# The existing use of pywebkitgtk shows raw HTML text instead of
|
|
|
|
# map. This patch solves the problems by showing the file from a
|
|
|
|
# string, which allows setting an explicit MIME type.
|
|
|
|
./pytrainer-webkit.patch
|
2014-12-21 11:23:53 +01:00
|
|
|
];
|
|
|
|
|
2018-02-27 22:20:26 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace ./setup.py \
|
|
|
|
--replace "'mysqlclient'," ""
|
|
|
|
'';
|
|
|
|
|
2018-02-22 00:12:44 +01:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
2018-02-27 22:20:26 +01:00
|
|
|
dateutil lxml matplotlibGtk pyGtkGlade sqlalchemy sqlalchemy_migrate psycopg2
|
2017-09-30 19:03:07 +02:00
|
|
|
] ++ stdenv.lib.optional withWebKit [ pywebkitgtk ];
|
|
|
|
|
|
|
|
buildInputs = [ perl gpsbabel sqlite ];
|
2014-12-21 11:23:53 +01:00
|
|
|
|
|
|
|
# This package contains no binaries to patch or strip.
|
|
|
|
dontPatchELF = true;
|
|
|
|
dontStrip = true;
|
|
|
|
|
2018-02-22 00:12:44 +01:00
|
|
|
checkPhase = ''
|
|
|
|
${python.interpreter} -m unittest discover
|
|
|
|
'';
|
|
|
|
|
2014-12-21 11:23:53 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = https://github.com/pytrainer/pytrainer/wiki;
|
|
|
|
description = "Application for logging and graphing sporting excursions";
|
|
|
|
maintainers = [ maintainers.rycee ];
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|