xmlsec 1.3.16__tar.gz → 1.3.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. xmlsec-1.3.18/.pre-commit-config.yaml +42 -0
  2. {xmlsec-1.3.16 → xmlsec-1.3.18}/.readthedocs.yaml +2 -2
  3. xmlsec-1.3.18/PKG-INFO +281 -0
  4. xmlsec-1.3.18/README.md +250 -0
  5. xmlsec-1.3.18/build_libs_xmlsec.py +55 -0
  6. xmlsec-1.3.18/build_support/build_ext.py +97 -0
  7. xmlsec-1.3.18/build_support/lib_xmlsec_dependency_builder.py +423 -0
  8. xmlsec-1.3.18/build_support/network.py +29 -0
  9. xmlsec-1.3.18/build_support/releases.py +77 -0
  10. xmlsec-1.3.18/build_support/static_build.py +115 -0
  11. xmlsec-1.3.18/libs/README.md +50 -0
  12. xmlsec-1.3.18/pyproject.toml +189 -0
  13. xmlsec-1.3.18/setup.cfg +4 -0
  14. xmlsec-1.3.18/setup.py +15 -0
  15. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/constants.c +7 -0
  16. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/ds.c +41 -0
  17. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/enc.c +11 -0
  18. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/main.c +17 -3
  19. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/template.c +5 -5
  20. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/xmlsec/__init__.pyi +1 -0
  21. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/xmlsec/constants.pyi +7 -6
  22. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/xmlsec/template.pyi +1 -1
  23. xmlsec-1.3.18/src/xmlsec.egg-info/PKG-INFO +281 -0
  24. {xmlsec-1.3.16/src/pyxmlsec.egg-info → xmlsec-1.3.18/src/xmlsec.egg-info}/SOURCES.txt +11 -19
  25. xmlsec-1.3.18/src/xmlsec.egg-info/scm_file_list.json +123 -0
  26. xmlsec-1.3.18/src/xmlsec.egg-info/scm_version.json +8 -0
  27. xmlsec-1.3.18/tests/__init__.py +0 -0
  28. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/base.py +18 -20
  29. xmlsec-1.3.18/tests/conftest.py +11 -0
  30. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/softhsm_setup.py +12 -16
  31. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_constants.py +4 -4
  32. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_doc_examples.py +3 -11
  33. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_ds.py +72 -55
  34. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_enc.py +25 -25
  35. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_keys.py +58 -62
  36. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_main.py +8 -6
  37. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_pkcs11.py +4 -4
  38. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_templates.py +44 -44
  39. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_tree.py +5 -5
  40. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/test_type_stubs.py +3 -5
  41. xmlsec-1.3.18/tests/test_xmlsec.py +16 -0
  42. xmlsec-1.3.16/.pre-commit-config.yaml +0 -48
  43. xmlsec-1.3.16/PKG-INFO +0 -278
  44. xmlsec-1.3.16/README.rst +0 -229
  45. xmlsec-1.3.16/pyproject.toml +0 -88
  46. xmlsec-1.3.16/setup.cfg +0 -30
  47. xmlsec-1.3.16/setup.py +0 -635
  48. xmlsec-1.3.16/src/python_xmlsec1.egg-info/PKG-INFO +0 -258
  49. xmlsec-1.3.16/src/python_xmlsec1.egg-info/SOURCES.txt +0 -103
  50. xmlsec-1.3.16/src/pyxmlsec.egg-info/PKG-INFO +0 -258
  51. xmlsec-1.3.16/src/pyxmlsec.egg-info/dependency_links.txt +0 -1
  52. xmlsec-1.3.16/src/pyxmlsec.egg-info/not-zip-safe +0 -1
  53. xmlsec-1.3.16/src/pyxmlsec.egg-info/requires.txt +0 -1
  54. xmlsec-1.3.16/src/pyxmlsec.egg-info/top_level.txt +0 -1
  55. xmlsec-1.3.16/src/xmlsec.cpython-39-darwin.so +0 -0
  56. xmlsec-1.3.16/src/xmlsec.egg-info/PKG-INFO +0 -278
  57. xmlsec-1.3.16/src/xmlsec.egg-info/SOURCES.txt +0 -103
  58. xmlsec-1.3.16/src/xmlsec.egg-info/dependency_links.txt +0 -1
  59. xmlsec-1.3.16/src/xmlsec.egg-info/not-zip-safe +0 -1
  60. xmlsec-1.3.16/src/xmlsec.egg-info/requires.txt +0 -1
  61. xmlsec-1.3.16/src/xmlsec.egg-info/top_level.txt +0 -1
  62. xmlsec-1.3.16/tests/conftest.py +0 -11
  63. xmlsec-1.3.16/tests/test_xmlsec.py +0 -14
  64. {xmlsec-1.3.16 → xmlsec-1.3.18}/LICENSE +0 -0
  65. {xmlsec-1.3.16 → xmlsec-1.3.18}/MANIFEST.in +0 -0
  66. {xmlsec-1.3.16/tests → xmlsec-1.3.18/build_support}/__init__.py +0 -0
  67. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/common.h +0 -0
  68. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/constants.h +0 -0
  69. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/debug.h +0 -0
  70. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/exception.c +0 -0
  71. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/exception.h +0 -0
  72. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/keys.c +0 -0
  73. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/keys.h +0 -0
  74. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/lxml.c +0 -0
  75. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/lxml.h +0 -0
  76. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/platform.h +0 -0
  77. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/tree.c +0 -0
  78. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/utils.c +0 -0
  79. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/utils.h +0 -0
  80. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/xmlsec/py.typed +0 -0
  81. {xmlsec-1.3.16 → xmlsec-1.3.18}/src/xmlsec/tree.pyi +0 -0
  82. {xmlsec-1.3.16/src/python_xmlsec1.egg-info → xmlsec-1.3.18/src/xmlsec.egg-info}/dependency_links.txt +0 -0
  83. {xmlsec-1.3.16/src/python_xmlsec1.egg-info → xmlsec-1.3.18/src/xmlsec.egg-info}/not-zip-safe +0 -0
  84. {xmlsec-1.3.16/src/python_xmlsec1.egg-info → xmlsec-1.3.18/src/xmlsec.egg-info}/requires.txt +0 -0
  85. {xmlsec-1.3.16/src/python_xmlsec1.egg-info → xmlsec-1.3.18/src/xmlsec.egg-info}/top_level.txt +0 -0
  86. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/deskey.bin +0 -0
  87. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/doc.xml +0 -0
  88. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/dsacert.der +0 -0
  89. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/dsakey.der +0 -0
  90. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/enc1-in.xml +0 -0
  91. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/enc1-out.xml +0 -0
  92. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/enc2-in.xml +0 -0
  93. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/enc2-out.xml +0 -0
  94. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/enc3-in.xml +0 -0
  95. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/enc3-out.xml +0 -0
  96. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/enc_template.xml +0 -0
  97. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/rsacert.pem +0 -0
  98. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/rsakey.pem +0 -0
  99. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/rsapub.pem +0 -0
  100. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign1-in.xml +0 -0
  101. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign1-out.xml +0 -0
  102. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign2-in.xml +0 -0
  103. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign2-out.xml +0 -0
  104. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign3-in.xml +0 -0
  105. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign3-out.xml +0 -0
  106. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign4-in.xml +0 -0
  107. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign4-out.xml +0 -0
  108. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign5-in.xml +0 -0
  109. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign5-out-xmlsec_1_2_36_to_37.xml +0 -0
  110. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign5-out.xml +0 -0
  111. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign6-in.bin +0 -0
  112. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign6-out.bin +0 -0
  113. {xmlsec-1.3.16 → xmlsec-1.3.18}/tests/data/sign_template.xml +0 -0
@@ -0,0 +1,42 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/astral-sh/ruff-pre-commit
5
+ rev: v0.17.1
6
+ hooks:
7
+ - id: ruff
8
+ args: ["--fix"]
9
+ types: [python]
10
+ - id: ruff-format
11
+ types: [python]
12
+
13
+ - repo: https://github.com/pre-commit/pre-commit-hooks
14
+ rev: v6.0.0
15
+ hooks:
16
+ - id: no-commit-to-branch
17
+ - id: trailing-whitespace
18
+ - id: end-of-file-fixer
19
+ - id: check-yaml
20
+ - id: check-added-large-files
21
+ - id: check-ast
22
+ - id: check-merge-conflict
23
+ - id: check-json
24
+ - id: detect-private-key
25
+ exclude: ^.*/rsakey.pem$
26
+ - id: mixed-line-ending
27
+ - id: pretty-format-json
28
+ args: [--autofix]
29
+
30
+ - repo: https://github.com/pre-commit/mirrors-mypy
31
+ rev: v2.4.0
32
+ hooks:
33
+ - id: mypy
34
+ exclude: (setup.py|tests|build_support/.*.py|doc/.*)
35
+ types: []
36
+ files: ^.*.pyi?$
37
+ additional_dependencies: [lxml-stubs, types-docutils]
38
+
39
+ - repo: https://github.com/pre-commit/pygrep-hooks
40
+ rev: v1.10.0
41
+ hooks:
42
+ - id: rst-backticks
@@ -1,9 +1,9 @@
1
1
  version: 2
2
2
 
3
3
  build:
4
- os: ubuntu-20.04
4
+ os: ubuntu-24.04
5
5
  tools:
6
- python: '3.9'
6
+ python: '3.14'
7
7
 
8
8
  sphinx:
9
9
  configuration: doc/source/conf.py
xmlsec-1.3.18/PKG-INFO ADDED
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: xmlsec
3
+ Version: 1.3.18
4
+ Summary: Python bindings for the XML Security Library
5
+ Author-email: Bulat Gaifullin <support@mehcode.com>
6
+ Maintainer-email: Oleg Hoefling <oleg.hoefling@gmail.com>, Amin Solhizadeh <amin.solhizadeh@gmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: Documentation, https://xmlsec.readthedocs.io
9
+ Project-URL: Source, https://github.com/xmlsec/python-xmlsec
10
+ Project-URL: Changelog, https://github.com/xmlsec/python-xmlsec/releases
11
+ Keywords: xmlsec
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: C
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Programming Language :: Python :: 3.15
24
+ Classifier: Topic :: Text Processing :: Markup :: XML
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: lxml>=3.8
30
+ Dynamic: license-file
31
+
32
+ # python-xmlsec
33
+
34
+ [![image](https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white)](https://pypi.python.org/pypi/xmlsec)
35
+ [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/xmlsec/python-xmlsec/master.svg)](https://results.pre-commit.ci/latest/github/xmlsec/python-xmlsec/master)
36
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml)
37
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml)
38
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml)
39
+ [![image](https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg)](https://codecov.io/gh/xmlsec/python-xmlsec)
40
+ [![Documentation Status](https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs)](https://xmlsec.readthedocs.io/en/latest/?badge=latest)
41
+
42
+ Python bindings for the [XML Security
43
+ Library](https://www.aleksey.com/xmlsec/).
44
+
45
+ ## Documentation
46
+
47
+ Documentation for `xmlsec` can be found at
48
+ [xmlsec.readthedocs.io](https://xmlsec.readthedocs.io/).
49
+
50
+ ## Usage
51
+
52
+ Check the
53
+ [examples](https://xmlsec.readthedocs.io/en/latest/examples.html)
54
+ section in the documentation to see various examples of signing and
55
+ verifying using the library.
56
+
57
+ ## Requirements
58
+
59
+ - `libxml2 >= 2.9.1`
60
+ - `libxmlsec1 >= 1.2.33`
61
+
62
+ ## Install
63
+
64
+ `xmlsec` is available on PyPI:
65
+
66
+ ``` bash
67
+ pip install xmlsec
68
+ ```
69
+
70
+ Depending on your OS, you may need to install the required native
71
+ libraries first:
72
+
73
+ ### Linux (Debian)
74
+
75
+ ``` bash
76
+ apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
77
+ ```
78
+
79
+ Note: There is no required version of LibXML2 for Ubuntu Precise, so you
80
+ need to download and install it manually.
81
+
82
+ ``` bash
83
+ wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz
84
+ tar -xvf libxml2-2.9.1.tar.gz
85
+ cd libxml2-2.9.1
86
+ ./configure && make && make install
87
+ ```
88
+
89
+ ### Linux (CentOS)
90
+
91
+ ``` bash
92
+ yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
93
+ ```
94
+
95
+ ### Linux (Fedora)
96
+
97
+ ``` bash
98
+ dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
99
+ ```
100
+
101
+ ### Mac
102
+
103
+ ``` bash
104
+ brew install libxml2 libxmlsec1 pkg-config
105
+ ```
106
+
107
+ or
108
+
109
+ ``` bash
110
+ port install libxml2 xmlsec pkgconfig
111
+ ```
112
+
113
+ ### Alpine
114
+
115
+ ``` bash
116
+ apk add build-base openssl libffi-dev openssl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec
117
+ ```
118
+
119
+ ## Troubleshooting
120
+
121
+ ### `lxml & xmlsec libxml2 library version mismatch`
122
+
123
+ `xmlsec` passes `lxml` XML nodes to the underlying `xmlsec1` library. Both
124
+ libraries use `libxml2`, so they must use compatible `libxml2` versions at
125
+ runtime. If `lxml` is installed from a wheel that bundles one `libxml2`
126
+ version while `xmlsec` is built against another system `libxml2`, importing
127
+ or using `xmlsec` can fail with:
128
+
129
+ ``` text
130
+ xmlsec.InternalError: (-1, 'lxml & xmlsec libxml2 library version mismatch')
131
+ ```
132
+
133
+ The most reliable fixes are:
134
+
135
+ - Use prebuilt wheels for both `lxml` and `xmlsec` when wheels are available
136
+ for your platform:
137
+
138
+ ``` bash
139
+ pip install --only-binary=lxml,xmlsec lxml xmlsec
140
+ ```
141
+
142
+ - If you need to build from source, build both packages against the same
143
+ locally installed `libxml2`:
144
+
145
+ ``` bash
146
+ pip install --no-binary=lxml,xmlsec lxml xmlsec
147
+ ```
148
+
149
+ Do not mix a wheel-built `lxml` with a locally built `xmlsec`, or the other
150
+ way around, unless you know they use the same `libxml2` version.
151
+
152
+ An `lxml` release upgrade does not by itself mean `xmlsec` is incompatible;
153
+ this error is about the `libxml2` libraries loaded in that environment.
154
+
155
+ If the error appears only under uWSGI, uWSGI may have loaded the system
156
+ `libxml2` before Python imports `lxml` or `xmlsec`. In that case, make sure
157
+ uWSGI and the Python packages resolve to the same `libxml2`, or rebuild the
158
+ Python packages from source in that environment. If you use `uv`, clear any
159
+ cached mixed builds before reinstalling. For example, to reinstall from
160
+ wheels:
161
+
162
+ ``` bash
163
+ uv pip uninstall lxml xmlsec
164
+ uv cache clean
165
+ uv pip install --only-binary lxml --only-binary xmlsec lxml xmlsec
166
+ ```
167
+
168
+ For background, see
169
+ [issue #356](https://github.com/xmlsec/python-xmlsec/issues/356) and the
170
+ uWSGI edge case in
171
+ [issue #415](https://github.com/xmlsec/python-xmlsec/issues/415).
172
+
173
+ ### Mac
174
+
175
+ If you get any fatal errors about missing `.h` files, update your
176
+ `C_INCLUDE_PATH` environment variable to include the appropriate files
177
+ from the `libxml2` and `libxmlsec1` libraries.
178
+
179
+ ### Windows
180
+
181
+ Starting with 1.3.7, prebuilt wheels are available for Windows, so
182
+ running `pip install xmlsec` should suffice. If you want to build from
183
+ source:
184
+
185
+ 1. Configure build environment, see
186
+ [wiki.python.org](https://wiki.python.org/moin/WindowsCompilers) for
187
+ more details.
188
+
189
+ 2. Install from source dist:
190
+
191
+ ``` bash
192
+ pip install xmlsec --no-binary=xmlsec
193
+ ```
194
+
195
+ ## Building from source
196
+
197
+ 1. Clone the `xmlsec` source code repository to your local computer.
198
+
199
+ ``` bash
200
+ git clone https://github.com/xmlsec/python-xmlsec.git
201
+ ```
202
+
203
+ 2. Change into the `python-xmlsec` root directory.
204
+
205
+ ``` bash
206
+ cd /path/to/xmlsec
207
+ ```
208
+
209
+ 3. Install the project and all its dependencies using `pip`.
210
+
211
+ ``` bash
212
+ pip install .
213
+ ```
214
+
215
+ ## Contributing
216
+
217
+ ### Setting up your environment
218
+
219
+ 1. Follow steps 1 and 2 of the [manual installation
220
+ instructions](#building-from-source).
221
+
222
+ 2. Initialize a virtual environment to develop in. This is done so as
223
+ to ensure every contributor is working with close-to-identical
224
+ versions of packages.
225
+
226
+ ``` bash
227
+ mkvirtualenv xmlsec
228
+ ```
229
+
230
+ The `mkvirtualenv` command is available from `virtualenvwrapper`
231
+ package which can be installed by following
232
+ [link](http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation).
233
+
234
+ 3. Activate the created virtual environment:
235
+
236
+ ``` bash
237
+ workon xmlsec
238
+ ```
239
+
240
+ 4. Install `xmlsec` in development mode with testing enabled. This will
241
+ download all dependencies required for running the unit tests.
242
+
243
+ ``` bash
244
+ pip install -r requirements-test.txt
245
+ pip install -e "."
246
+ ```
247
+
248
+ ### Running the test suite
249
+
250
+ 1. [Set up your environment](#setting-up-your-environment).
251
+
252
+ 2. Run the unit tests.
253
+
254
+ ``` bash
255
+ pytest tests
256
+ ```
257
+
258
+ 3. Tests configuration
259
+
260
+ Env variable `PYXMLSEC_TEST_ITERATIONS` specifies number of test
261
+ iterations to detect memory leaks.
262
+
263
+ ### Reporting an issue
264
+
265
+ Please attach the output of following information:
266
+
267
+ - version of `xmlsec`
268
+ - version of `libxmlsec1`
269
+ - version of `libxml2`
270
+ - output from the command
271
+
272
+ ``` bash
273
+ pkg-config --cflags xmlsec1
274
+ ```
275
+
276
+ ## License
277
+
278
+ Unless otherwise noted, all files contained within this project are
279
+ licensed under the MIT open source license. See the included `LICENSE`
280
+ file or visit [opensource.org](http://opensource.org/licenses/MIT) for
281
+ more information.
@@ -0,0 +1,250 @@
1
+ # python-xmlsec
2
+
3
+ [![image](https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white)](https://pypi.python.org/pypi/xmlsec)
4
+ [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/xmlsec/python-xmlsec/master.svg)](https://results.pre-commit.ci/latest/github/xmlsec/python-xmlsec/master)
5
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/manylinux.yml)
6
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/macosx.yml)
7
+ [![image](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml/badge.svg)](https://github.com/xmlsec/python-xmlsec/actions/workflows/linuxbrew.yml)
8
+ [![image](https://codecov.io/gh/xmlsec/python-xmlsec/branch/master/graph/badge.svg)](https://codecov.io/gh/xmlsec/python-xmlsec)
9
+ [![Documentation Status](https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs)](https://xmlsec.readthedocs.io/en/latest/?badge=latest)
10
+
11
+ Python bindings for the [XML Security
12
+ Library](https://www.aleksey.com/xmlsec/).
13
+
14
+ ## Documentation
15
+
16
+ Documentation for `xmlsec` can be found at
17
+ [xmlsec.readthedocs.io](https://xmlsec.readthedocs.io/).
18
+
19
+ ## Usage
20
+
21
+ Check the
22
+ [examples](https://xmlsec.readthedocs.io/en/latest/examples.html)
23
+ section in the documentation to see various examples of signing and
24
+ verifying using the library.
25
+
26
+ ## Requirements
27
+
28
+ - `libxml2 >= 2.9.1`
29
+ - `libxmlsec1 >= 1.2.33`
30
+
31
+ ## Install
32
+
33
+ `xmlsec` is available on PyPI:
34
+
35
+ ``` bash
36
+ pip install xmlsec
37
+ ```
38
+
39
+ Depending on your OS, you may need to install the required native
40
+ libraries first:
41
+
42
+ ### Linux (Debian)
43
+
44
+ ``` bash
45
+ apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
46
+ ```
47
+
48
+ Note: There is no required version of LibXML2 for Ubuntu Precise, so you
49
+ need to download and install it manually.
50
+
51
+ ``` bash
52
+ wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz
53
+ tar -xvf libxml2-2.9.1.tar.gz
54
+ cd libxml2-2.9.1
55
+ ./configure && make && make install
56
+ ```
57
+
58
+ ### Linux (CentOS)
59
+
60
+ ``` bash
61
+ yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
62
+ ```
63
+
64
+ ### Linux (Fedora)
65
+
66
+ ``` bash
67
+ dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
68
+ ```
69
+
70
+ ### Mac
71
+
72
+ ``` bash
73
+ brew install libxml2 libxmlsec1 pkg-config
74
+ ```
75
+
76
+ or
77
+
78
+ ``` bash
79
+ port install libxml2 xmlsec pkgconfig
80
+ ```
81
+
82
+ ### Alpine
83
+
84
+ ``` bash
85
+ apk add build-base openssl libffi-dev openssl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec
86
+ ```
87
+
88
+ ## Troubleshooting
89
+
90
+ ### `lxml & xmlsec libxml2 library version mismatch`
91
+
92
+ `xmlsec` passes `lxml` XML nodes to the underlying `xmlsec1` library. Both
93
+ libraries use `libxml2`, so they must use compatible `libxml2` versions at
94
+ runtime. If `lxml` is installed from a wheel that bundles one `libxml2`
95
+ version while `xmlsec` is built against another system `libxml2`, importing
96
+ or using `xmlsec` can fail with:
97
+
98
+ ``` text
99
+ xmlsec.InternalError: (-1, 'lxml & xmlsec libxml2 library version mismatch')
100
+ ```
101
+
102
+ The most reliable fixes are:
103
+
104
+ - Use prebuilt wheels for both `lxml` and `xmlsec` when wheels are available
105
+ for your platform:
106
+
107
+ ``` bash
108
+ pip install --only-binary=lxml,xmlsec lxml xmlsec
109
+ ```
110
+
111
+ - If you need to build from source, build both packages against the same
112
+ locally installed `libxml2`:
113
+
114
+ ``` bash
115
+ pip install --no-binary=lxml,xmlsec lxml xmlsec
116
+ ```
117
+
118
+ Do not mix a wheel-built `lxml` with a locally built `xmlsec`, or the other
119
+ way around, unless you know they use the same `libxml2` version.
120
+
121
+ An `lxml` release upgrade does not by itself mean `xmlsec` is incompatible;
122
+ this error is about the `libxml2` libraries loaded in that environment.
123
+
124
+ If the error appears only under uWSGI, uWSGI may have loaded the system
125
+ `libxml2` before Python imports `lxml` or `xmlsec`. In that case, make sure
126
+ uWSGI and the Python packages resolve to the same `libxml2`, or rebuild the
127
+ Python packages from source in that environment. If you use `uv`, clear any
128
+ cached mixed builds before reinstalling. For example, to reinstall from
129
+ wheels:
130
+
131
+ ``` bash
132
+ uv pip uninstall lxml xmlsec
133
+ uv cache clean
134
+ uv pip install --only-binary lxml --only-binary xmlsec lxml xmlsec
135
+ ```
136
+
137
+ For background, see
138
+ [issue #356](https://github.com/xmlsec/python-xmlsec/issues/356) and the
139
+ uWSGI edge case in
140
+ [issue #415](https://github.com/xmlsec/python-xmlsec/issues/415).
141
+
142
+ ### Mac
143
+
144
+ If you get any fatal errors about missing `.h` files, update your
145
+ `C_INCLUDE_PATH` environment variable to include the appropriate files
146
+ from the `libxml2` and `libxmlsec1` libraries.
147
+
148
+ ### Windows
149
+
150
+ Starting with 1.3.7, prebuilt wheels are available for Windows, so
151
+ running `pip install xmlsec` should suffice. If you want to build from
152
+ source:
153
+
154
+ 1. Configure build environment, see
155
+ [wiki.python.org](https://wiki.python.org/moin/WindowsCompilers) for
156
+ more details.
157
+
158
+ 2. Install from source dist:
159
+
160
+ ``` bash
161
+ pip install xmlsec --no-binary=xmlsec
162
+ ```
163
+
164
+ ## Building from source
165
+
166
+ 1. Clone the `xmlsec` source code repository to your local computer.
167
+
168
+ ``` bash
169
+ git clone https://github.com/xmlsec/python-xmlsec.git
170
+ ```
171
+
172
+ 2. Change into the `python-xmlsec` root directory.
173
+
174
+ ``` bash
175
+ cd /path/to/xmlsec
176
+ ```
177
+
178
+ 3. Install the project and all its dependencies using `pip`.
179
+
180
+ ``` bash
181
+ pip install .
182
+ ```
183
+
184
+ ## Contributing
185
+
186
+ ### Setting up your environment
187
+
188
+ 1. Follow steps 1 and 2 of the [manual installation
189
+ instructions](#building-from-source).
190
+
191
+ 2. Initialize a virtual environment to develop in. This is done so as
192
+ to ensure every contributor is working with close-to-identical
193
+ versions of packages.
194
+
195
+ ``` bash
196
+ mkvirtualenv xmlsec
197
+ ```
198
+
199
+ The `mkvirtualenv` command is available from `virtualenvwrapper`
200
+ package which can be installed by following
201
+ [link](http://virtualenvwrapper.readthedocs.org/en/latest/install.html#basic-installation).
202
+
203
+ 3. Activate the created virtual environment:
204
+
205
+ ``` bash
206
+ workon xmlsec
207
+ ```
208
+
209
+ 4. Install `xmlsec` in development mode with testing enabled. This will
210
+ download all dependencies required for running the unit tests.
211
+
212
+ ``` bash
213
+ pip install -r requirements-test.txt
214
+ pip install -e "."
215
+ ```
216
+
217
+ ### Running the test suite
218
+
219
+ 1. [Set up your environment](#setting-up-your-environment).
220
+
221
+ 2. Run the unit tests.
222
+
223
+ ``` bash
224
+ pytest tests
225
+ ```
226
+
227
+ 3. Tests configuration
228
+
229
+ Env variable `PYXMLSEC_TEST_ITERATIONS` specifies number of test
230
+ iterations to detect memory leaks.
231
+
232
+ ### Reporting an issue
233
+
234
+ Please attach the output of following information:
235
+
236
+ - version of `xmlsec`
237
+ - version of `libxmlsec1`
238
+ - version of `libxml2`
239
+ - output from the command
240
+
241
+ ``` bash
242
+ pkg-config --cflags xmlsec1
243
+ ```
244
+
245
+ ## License
246
+
247
+ Unless otherwise noted, all files contained within this project are
248
+ licensed under the MIT open source license. See the included `LICENSE`
249
+ file or visit [opensource.org](http://opensource.org/licenses/MIT) for
250
+ more information.
@@ -0,0 +1,55 @@
1
+ import argparse
2
+ import os
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ from build_support.lib_xmlsec_dependency_builder import LibXmlsecDependencyBuilder
7
+
8
+
9
+ def _console_info(message):
10
+ print(message)
11
+
12
+
13
+ def main(argv=None):
14
+ parser = argparse.ArgumentParser(description='Download and build static dependency libraries for python-xmlsec.')
15
+ parser.add_argument(
16
+ '--platform',
17
+ default=sys.platform,
18
+ help='Target platform (default: current interpreter platform).',
19
+ )
20
+ parser.add_argument(
21
+ '--plat-name',
22
+ default=os.environ.get('PYXMLSEC_PLAT_NAME'),
23
+ help='Target platform tag for cross-compiling (for example macosx-11.0-arm64).',
24
+ )
25
+ parser.add_argument(
26
+ '--libs-dir',
27
+ default=os.environ.get('PYXMLSEC_LIBS_DIR', 'libs'),
28
+ help='Directory where source/binary archives are stored.',
29
+ )
30
+ parser.add_argument(
31
+ '--buildroot',
32
+ default=Path('build', 'tmp'),
33
+ type=Path,
34
+ help='Build root for extracted/build artifacts.',
35
+ )
36
+ parser.add_argument(
37
+ '--download-only',
38
+ action='store_true',
39
+ help='Only download dependency archives; do not extract/build.',
40
+ )
41
+
42
+ args = parser.parse_args(argv)
43
+ builder = LibXmlsecDependencyBuilder(
44
+ platform_name=args.platform,
45
+ info=_console_info,
46
+ libs_dir=Path(args.libs_dir),
47
+ buildroot=args.buildroot,
48
+ plat_name=args.plat_name,
49
+ )
50
+ builder.prepare(download_only=args.download_only)
51
+ return 0
52
+
53
+
54
+ if __name__ == '__main__':
55
+ raise SystemExit(main())