1 { lib, buildPythonPackage, python, pythonOlder, glibcLocales, fetchFromGitHub, ipaddress, six, simplejson }:
3 buildPythonPackage rec {
7 # no tests in PyPI tarball
8 src = fetchFromGitHub {
12 sha256 = "0p851jlly6bzcs70kd1lcjwmg4scwh1icymfc0f2y6rkh4kfsdhk";
15 LC_ALL = "en_US.utf-8";
17 # remove version bounds
19 sed -i -e 's/==.*//g' requirements.txt
21 # ipaddress is part of the standard library of Python 3.3+
22 + lib.optionalString (!pythonOlder "3.3") ''
23 substituteInPlace requirements.txt \
24 --replace "ipaddress" ""
27 nativeBuildInputs = [ glibcLocales ];
28 propagatedBuildInputs = [ simplejson six ] ++ lib.optional (pythonOlder "3.3") ipaddress;
30 # Taken from .travis.yml
32 ${python.interpreter} tests/test_main.py
33 ${python.interpreter} -m mailparser -v
34 ${python.interpreter} -m mailparser -h
35 ${python.interpreter} -m mailparser -f tests/mails/mail_malformed_3 -j
36 cat tests/mails/mail_malformed_3 | ${python.interpreter} -m mailparser -k -j
40 description = "A mail parser for python 2 and 3";
41 homepage = "https://github.com/SpamScope/mail-parser";
42 license = licenses.asl20;
43 maintainers = with maintainers; [ psyanticy ];