pythonPackages.xmlsec: init at 1.3.9

This commit is contained in:
Zhaofeng Li 2021-01-18 14:14:28 -08:00
parent 120bc6754b
commit 64cfeeffd0
3 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,47 @@
{ lib
, fetchPypi
, buildPythonPackage
, pytestCheckHook
, libxslt
, libxml2
, libtool
, pkg-config
, xmlsec
, pkgconfig
, setuptools-scm
, toml
, lxml
, hypothesis
}:
buildPythonPackage rec {
pname = "xmlsec";
version = "1.3.9";
src = fetchPypi {
inherit pname version;
sha256 = "1c4k42zv3plm6v65p7z6l5rxyf50h40d02nhc16vq7cjrfvdf4rx";
};
# https://github.com/mehcode/python-xmlsec/issues/84#issuecomment-632930116
patches = [
./reset-lxml-in-tests.patch
];
nativeBuildInputs = [ pkg-config pkgconfig setuptools-scm toml ];
buildInputs = [ xmlsec libxslt libxml2 libtool ];
propagatedBuildInputs = [ lxml ];
# Full git clone required for test_doc_examples
checkInputs = [ pytestCheckHook hypothesis ];
disabledTestPaths = [ "tests/test_doc_examples.py" ];
meta = with lib; {
description = "Python bindings for the XML Security Library";
homepage = "https://github.com/mehcode/python-xmlsec";
license = licenses.mit;
maintainers = with maintainers; [ zhaofengli ];
};
}

View File

@ -0,0 +1,22 @@
diff --git a/tests/base.py b/tests/base.py
index b05de1d..5ec356f 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -94,6 +94,7 @@ class TestMemoryLeaks(unittest.TestCase):
def load_xml(self, name, xpath=None):
"""returns xml.etree"""
+ etree.set_default_parser(parser=etree.XMLParser())
root = etree.parse(self.path(name)).getroot()
if xpath is None:
return root
diff --git a/tests/test_doc_examples.py b/tests/test_doc_examples.py
index 2fc490f..53d2377 100644
--- a/tests/test_doc_examples.py
+++ b/tests/test_doc_examples.py
@@ -42,3 +42,5 @@ def test_doc_example(example):
"""
with cd(example.parent):
runpy.run_path(str(example))
+ from lxml import etree
+ etree.set_default_parser(parser=etree.XMLParser())

View File

@ -8632,6 +8632,10 @@ in {
xmlschema = callPackage ../development/python-modules/xmlschema { };
xmlsec = callPackage ../development/python-modules/xmlsec {
inherit (pkgs) libxslt libxml2 libtool pkg-config xmlsec;
};
xmltodict = callPackage ../development/python-modules/xmltodict { };
xmodem = callPackage ../development/python-modules/xmodem { };