1{
2 lib,
3 buildPythonPackage,
4 python,
5 glibcLocales,
6 fetchFromGitHub,
7 pytest-cov-stub,
8 pytestCheckHook,
9 setuptools,
10 six,
11}:
12
13buildPythonPackage rec {
14 pname = "mail-parser";
15 version = "4.1.4";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "SpamScope";
20 repo = "mail-parser";
21 tag = version;
22 hash = "sha256-wwLUD/k26utugK/Yx9eXYEdSOvrk0Cy6RkXGDnzZ+fE=";
23 };
24
25 LC_ALL = "en_US.utf-8";
26
27 nativeBuildInputs = [ glibcLocales ];
28
29 build-system = [ setuptools ];
30
31 pythonRemoveDeps = [ "ipaddress" ];
32
33 dependencies = [
34 six
35 ];
36
37 pythonImportsCheck = [ "mailparser" ];
38
39 nativeCheckInputs = [
40 pytest-cov-stub
41 pytestCheckHook
42 ];
43
44 # Taken from .travis.yml
45 postCheck = ''
46 ${python.interpreter} -m mailparser -v
47 ${python.interpreter} -m mailparser -h
48 ${python.interpreter} -m mailparser -f tests/mails/mail_malformed_3 -j
49 cat tests/mails/mail_malformed_3 | ${python.interpreter} -m mailparser -k -j
50 '';
51
52 meta = {
53 description = "Mail parser for python 2 and 3";
54 mainProgram = "mailparser";
55 homepage = "https://github.com/SpamScope/mail-parser";
56 license = lib.licenses.asl20;
57 maintainers = with lib.maintainers; [ psyanticy ];
58 };
59}