Skip to content

Commit f6a574f

Browse files
authored
Merge pull request #173 from hoefling/no-xslt-support
Support building without XSLT support
2 parents 4a91bbc + 95ed6fd commit f6a574f

File tree

7 files changed

+48
-3
lines changed

7 files changed

+48
-3
lines changed

.github/workflows/linuxbrew.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: linuxbrew
2+
on: [push, pull_request]
3+
jobs:
4+
linuxbrew:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v1
8+
- name: Setup Python
9+
uses: actions/setup-python@v2
10+
with:
11+
python-version: ${{ matrix.python }}
12+
- name: Install build dependencies
13+
run: |
14+
sudo apt install -y build-essential procps curl file git
15+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
16+
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
17+
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
18+
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
19+
brew update
20+
brew install python gcc libxml2 libxmlsec1 pkg-config
21+
pip3 install --upgrade setuptools wheel
22+
ln -s $(brew --prefix)/bin/gcc-11 $(brew --prefix)/bin/gcc-5
23+
- name: Build linux_x86_64 wheel
24+
run: |
25+
python3 setup.py bdist_wheel
26+
rm -rf build/
27+
- name: Install test dependencies
28+
run: |
29+
pip3 install --upgrade -r requirements-test.txt
30+
pip3 install xmlsec --only-binary=xmlsec --no-index --find-links=dist/
31+
- name: Run tests
32+
run: |
33+
pytest -v --color=yes

.github/workflows/manylinux2010.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
container: quay.io/pypa/manylinux2010_x86_64
77
strategy:
88
matrix:
9-
python-abi: [cp35-cp35m, cp36-cp36m, cp37-cp37m, cp38-cp38, cp39-cp39]
9+
python-abi: [cp36-cp36m, cp37-cp37m, cp38-cp38, cp39-cp39]
1010
steps:
1111
- uses: actions/checkout@v1
1212
- name: Install build dependencies
@@ -19,6 +19,8 @@ jobs:
1919
- name: Build linux_x86_64 wheel
2020
env:
2121
PYXMLSEC_STATIC_DEPS: true
22+
# disable libxml2-2.9.12 because of https://gitlab.gnome.org/GNOME/libxslt/-/issues/52
23+
PYXMLSEC_LIBXML2_VERSION: 2.9.10
2224
run: |
2325
/opt/python/${{ matrix.python-abi }}/bin/python setup.py bdist_wheel
2426
- name: Label manylinux2010_x86_64 wheel
@@ -27,7 +29,7 @@ jobs:
2729
auditwheel show dist/xmlsec-${{ env.PKGVER }}-${{ matrix.python-abi }}-linux_x86_64.whl
2830
auditwheel repair dist/xmlsec-${{ env.PKGVER }}-${{ matrix.python-abi }}-linux_x86_64.whl
2931
ls -l wheelhouse/
30-
auditwheel show wheelhouse/xmlsec-${{ env.PKGVER }}-${{ matrix.python-abi }}-manylinux2010_x86_64.whl
32+
auditwheel show wheelhouse/xmlsec-${{ env.PKGVER }}-${{ matrix.python-abi }}-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
3133
- name: Install test dependencies
3234
run: |
3335
/opt/python/${{ matrix.python-abi }}/bin/pip install --upgrade -r requirements-test.txt

.github/workflows/sdist.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
- name: Install test dependencies
1919
env:
2020
PYXMLSEC_STATIC_DEPS: true
21+
# disable libxml2-2.9.12 because of https://gitlab.gnome.org/GNOME/libxslt/-/issues/52
22+
PYXMLSEC_LIBXML2_VERSION: 2.9.10
2123
run: |
2224
pip install --upgrade -r requirements-test.txt
2325
pip install dist/xmlsec-$(python setup.py --version).tar.gz

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ python-xmlsec
1111
:target: https://github.com/mehcode/python-xmlsec/actions?query=workflow%3A%22manylinux2010%22
1212
.. image:: https://github.com/mehcode/python-xmlsec/workflows/MacOS/badge.svg
1313
:target: https://github.com/mehcode/python-xmlsec/actions?query=workflow%3A%22MacOS%22
14+
.. image:: https://github.com/mehcode/python-xmlsec/workflows/linuxbrew/badge.svg
15+
:target: https://github.com/mehcode/python-xmlsec/actions?query=workflow%3A%22linuxbrew%22
1416
.. image:: https://codecov.io/gh/mehcode/python-xmlsec/branch/master/graph/badge.svg
1517
:target: https://codecov.io/gh/mehcode/python-xmlsec
1618
.. image:: https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs

src/constants.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
485485
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXPath, "XPATH");
486486
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXPath2, "XPATH2");
487487
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXPointer, "XPOINTER");
488-
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXslt, "XSLT");
489488
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRemoveXmlTagsC14N, "REMOVE_XML_TAGS_C14N");
490489
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformVisa3DHack, "VISA3D_HACK");
491490

@@ -502,6 +501,9 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
502501
#ifndef XMLSEC_NO_DSA
503502
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformDsaSha1, "DSA_SHA1");
504503
#endif
504+
#ifndef XMLSEC_NO_XSLT
505+
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformXslt, "XSLT");
506+
#endif
505507

506508
#if XMLSEC_VERSION_HEX > 0x10212
507509
// from version 1.2.19

tests/test_ds.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import unittest
12
import xmlsec
23
from tests import base
34

@@ -194,6 +195,7 @@ def test_sign_binary_no_key(self):
194195
with self.assertRaisesRegex(xmlsec.Error, 'Sign key is not specified.'):
195196
ctx.sign_binary(bytes=b'', transform=consts.TransformRsaSha1)
196197

198+
@unittest.skipIf(not hasattr(consts, 'TransformXslt'), reason='XSLT transformations not enabled')
197199
def test_sign_binary_invalid_signature_method(self):
198200
ctx = xmlsec.SignatureContext()
199201
ctx.key = xmlsec.Key.from_file(self.path("rsakey.pem"), format=consts.KeyDataFormatPem)

tests/test_templates.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import unittest
12
from lxml import etree
23

34
import xmlsec
@@ -195,6 +196,7 @@ def test_encrypted_data_ensure_key_info_bad_args(self):
195196
with self.assertRaises(TypeError):
196197
xmlsec.template.encrypted_data_ensure_key_info('')
197198

199+
@unittest.skipIf(not hasattr(consts, 'TransformXslt'), reason='XSLT transformations not enabled')
198200
def test_transform_add_c14n_inclusive_namespaces(self):
199201
root = self.load_xml("doc.xml")
200202
sign = xmlsec.template.create(root, c14n_method=consts.TransformExclC14N, sign_method=consts.TransformRsaSha1)

0 commit comments

Comments
 (0)