1{ lib, buildPythonPackage, python, pythonOlder, glibcLocales, fetchFromGitHub, ipaddress, six, simplejson }: 2 3buildPythonPackage rec { 4 pname = "mail-parser"; 5 version = "3.15.0"; 6 7 # no tests in PyPI tarball 8 src = fetchFromGitHub { 9 owner = "SpamScope"; 10 repo = pname; 11 rev = "v${version}"; 12 sha256 = "0da2qr4p8jnjw6jdhbagm6slfcjnjyyjkszwfcfqvcywh1zm1sdw"; 13 }; 14 15 LC_ALL = "en_US.utf-8"; 16 17 nativeBuildInputs = [ glibcLocales ]; 18 propagatedBuildInputs = [ simplejson six ] ++ lib.optional (pythonOlder "3.3") ipaddress; 19 20 # Taken from .travis.yml 21 checkPhase = '' 22 ${python.interpreter} tests/test_main.py 23 ${python.interpreter} -m mailparser -v 24 ${python.interpreter} -m mailparser -h 25 ${python.interpreter} -m mailparser -f tests/mails/mail_malformed_3 -j 26 cat tests/mails/mail_malformed_3 | ${python.interpreter} -m mailparser -k -j 27 ''; 28 29 meta = with lib; { 30 description = "A mail parser for python 2 and 3"; 31 homepage = "https://github.com/SpamScope/mail-parser"; 32 license = licenses.asl20; 33 maintainers = with maintainers; [ psyanticy ]; 34 }; 35}