about summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorRobert Schütz <rschuetz17@gmail.com>2018-05-17 12:24:30 +0200
committerGitHub <noreply@github.com>2018-05-17 12:24:30 +0200
commit2c91ab54c947e7b283d98da3f970a69414273348 (patch)
treeaf6a364b1b72e4543bb1bac54ad00eac775bbca1 /pkgs/development/python-modules
parent910644ef50f26beb9fd7a0bef20faa53e0c56add (diff)
parentfb7340d3e546c1272c69a6408d205dedce89e05b (diff)
downloadnixlib-2c91ab54c947e7b283d98da3f970a69414273348.tar
nixlib-2c91ab54c947e7b283d98da3f970a69414273348.tar.gz
nixlib-2c91ab54c947e7b283d98da3f970a69414273348.tar.bz2
nixlib-2c91ab54c947e7b283d98da3f970a69414273348.tar.lz
nixlib-2c91ab54c947e7b283d98da3f970a69414273348.tar.xz
nixlib-2c91ab54c947e7b283d98da3f970a69414273348.tar.zst
nixlib-2c91ab54c947e7b283d98da3f970a69414273348.zip
Merge pull request #40353 from Assassinkin/mail-parser
pythonPackages.mail-parser: init at 3.3.1
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/mail-parser/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/mail-parser/default.nix b/pkgs/development/python-modules/mail-parser/default.nix
new file mode 100644
index 000000000000..e05dc3f2861f
--- /dev/null
+++ b/pkgs/development/python-modules/mail-parser/default.nix
@@ -0,0 +1,41 @@
+{ lib, buildPythonPackage, python, pythonOlder, glibcLocales, fetchFromGitHub, ipaddress, six, simplejson }:
+
+buildPythonPackage rec {
+  pname = "mail-parser";
+  version = "3.3.1";
+
+  # no tests in PyPI tarball
+  src = fetchFromGitHub {
+    owner = "SpamScope";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1b1v61zwgdx2xjzds3hp6bv53yq424hhlrhf445n4faj1l0c4lkg";
+  };
+
+  LC_ALL = "en_US.utf-8";
+
+  # ipaddress is part of the standard library of Python 3.3+
+  prePatch = lib.optionalString (!pythonOlder "3.3") ''
+    substituteInPlace requirements.txt \
+      --replace "ipaddress" ""
+  '';
+
+  nativeBuildInputs = [ glibcLocales ];
+  propagatedBuildInputs = [ simplejson six ] ++ lib.optional (pythonOlder "3.3") ipaddress;
+
+  # Taken from .travis.yml
+  checkPhase = ''
+    ${python.interpreter} tests/test_main.py
+    ${python.interpreter} -m mailparser -v
+    ${python.interpreter} -m mailparser -h
+    ${python.interpreter} -m mailparser -f tests/mails/mail_malformed_3 -j
+    cat tests/mails/mail_malformed_3 | ${python.interpreter} -m mailparser -k -j
+  '';
+
+  meta = with lib; {
+    description = "A mail parser for python 2 and 3";
+    homepage = https://github.com/SpamScope/mail-parser;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ psyanticy ];
+  };
+}