Skip to content

Commit 3f1dfe5

Browse files
authored
Merge pull request #353 from TomiBelan/fixci
Update to lxml 6.0.0 and fix GitHub Actions
2 parents 3480dd3 + 8f04791 commit 3f1dfe5

File tree

8 files changed

+56
-55
lines changed

8 files changed

+56
-55
lines changed

.github/workflows/linuxbrew.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ jobs:
66
strategy:
77
matrix:
88
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
9+
env:
10+
# For some unknown reason, linuxbrew tries to use "gcc-11" by default, which doesn't exist.
11+
CC: gcc
912
steps:
1013
- uses: actions/checkout@v3
1114
- name: Install brew

.github/workflows/macosx.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2727
run: |
2828
export PKG_CONFIG_PATH="$(brew --prefix)/opt/libxml2/lib/pkgconfig"
29+
export PYXMLSEC_LIBXML2_VERSION="$(pkg-config --modversion libxml-2.0)"
2930
python -m build
3031
rm -rf build/
3132
- name: Set environment variables

.github/workflows/manylinux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
python-abi: [cp36-cp36m, cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311]
8+
python-abi: [cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312, cp313-cp313]
99
image:
1010
- manylinux2014_x86_64
1111
- manylinux_2_28_x86_64
12-
- musllinux_1_1_x86_64
12+
- musllinux_1_2_x86_64
1313
container: quay.io/pypa/${{ matrix.image }}
1414
steps:
1515
- uses: actions/checkout@v1

.github/workflows/sdist.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: sdist
22
on: [push, pull_request]
33
jobs:
44
sdist:
5-
runs-on: ubuntu-latest
5+
# Avoid Ubuntu 24.04 in sdist workflows, because it contains libxmlsec1-dev
6+
# v1.2.39, which has a bug that causes tests/test_pkcs11.py to fail.
7+
# (It thinks the softhsm engine has a public key instead of a private key.)
8+
# libxmlsec1 <=1.2.33 or >=1.2.42 works. TODO: Try 26.04 when available.
9+
runs-on: ubuntu-22.04
610
strategy:
711
matrix:
812
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]

.github/workflows/wheels.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ permissions: {}
1919

2020
jobs:
2121
sdist:
22-
runs-on: ubuntu-latest
22+
# Avoid Ubuntu 24.04 in sdist workflows, because it contains libxmlsec1-dev
23+
# v1.2.39, which has a bug that causes tests/test_pkcs11.py to fail.
24+
# (It thinks the softhsm engine has a public key instead of a private key.)
25+
# libxmlsec1 <=1.2.33 or >=1.2.42 works. TODO: Try 26.04 when available.
26+
runs-on: ubuntu-22.04
2327

2428
permissions:
2529
contents: write
@@ -100,8 +104,8 @@ jobs:
100104
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
101105

102106
env:
103-
PYXMLSEC_LIBXML2_VERSION: 2.13.5
104-
PYXMLSEC_LIBXSLT_VERSION: 1.1.42
107+
PYXMLSEC_LIBXML2_VERSION: 2.14.4
108+
PYXMLSEC_LIBXSLT_VERSION: 1.1.43
105109

106110
steps:
107111
- name: Check out the repo

pyproject.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ skip = [
5454
"*-musllinux_i686",
5555
# LXML doesn't publish wheels for these platforms, which makes it
5656
# difficult for us to build wheels, so we exclude them.
57-
"cp36-manylinux_aarch64",
58-
"cp37-manylinux_aarch64",
59-
"cp36-musllinux_aarch64",
60-
"cp37-musllinux_aarch64",
61-
"cp36-macosx*",
62-
"cp37-macosx*",
57+
"cp36-*",
58+
"cp37-*",
59+
"cp38-manylinux_aarch64",
60+
"cp38-musllinux_aarch64",
6361
"cp38-macosx*",
6462
]
6563
test-command = "pytest -v --color=yes {package}/tests"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lxml >= 3.8.0, !=4.7.0 --no-binary=lxml
1+
lxml >= 3.8.0, !=4.7.0

setup.py

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,18 @@ def latest_release_from_gnome_org_cache(url, lib_name):
7070
return '{}/{}'.format(url, latest_source)
7171

7272

73-
def latest_release_from_github_api(repo):
74-
api_url = 'https://api.github.com/repos/{}/releases'.format(repo)
73+
def latest_release_json_from_github_api(repo):
74+
api_url = 'https://api.github.com/repos/{}/releases/latest'.format(repo)
7575

7676
# if we are running in CI, pass along the GH_TOKEN, so we don't get rate limited
7777
token = os.environ.get("GH_TOKEN")
7878
if token:
7979
log.info("Using GitHub token to avoid rate limiting")
80-
api_releases = make_request(api_url, token, json_response=True)
81-
releases = [r['tarball_url'] for r in api_releases if r['prerelease'] is False and r['draft'] is False]
82-
if not releases:
83-
raise DistutilsError('No release found for {}'.format(repo))
84-
return releases[0]
80+
return make_request(api_url, token, json_response=True)
8581

8682

8783
def latest_openssl_release():
88-
return latest_release_from_github_api('openssl/openssl')
84+
return latest_release_json_from_github_api('openssl/openssl')['tarball_url']
8985

9086

9187
def latest_zlib_release():
@@ -105,7 +101,9 @@ def latest_libxslt_release():
105101

106102

107103
def latest_xmlsec_release():
108-
return latest_release_from_html('https://www.aleksey.com/xmlsec/download/', re.compile('xmlsec1-(?P<version>.*).tar.gz'))
104+
assets = latest_release_json_from_github_api('lsh123/xmlsec')['assets']
105+
(tar_gz,) = [asset for asset in assets if asset['name'].endswith('.tar.gz')]
106+
return tar_gz['browser_download_url']
109107

110108

111109
class CrossCompileInfo:
@@ -381,7 +379,7 @@ def prepare_static_build(self, build_platform):
381379
url = latest_xmlsec_release()
382380
self.info('{:10}: {}'.format('xmlsec1', 'PYXMLSEC_XMLSEC1_VERSION unset, downloading latest from {}'.format(url)))
383381
else:
384-
url = 'https://www.aleksey.com/xmlsec/download/xmlsec1-{}.tar.gz'.format(self.xmlsec1_version)
382+
url = 'https://github.com/lsh123/xmlsec/releases/download/{v}/xmlsec1-{v}.tar.gz'.format(v=self.xmlsec1_version)
385383
self.info(
386384
'{:10}: {}'.format(
387385
'xmlsec1', 'PYXMLSEC_XMLSEC1_VERSION={}, downloading from {}'.format(self.xmlsec1_version, url)
@@ -435,43 +433,41 @@ def prepare_static_build(self, build_platform):
435433
openssl_config_cmd.append(cross_compiling.triplet)
436434
else:
437435
openssl_config_cmd.insert(0, './config')
438-
subprocess.check_output(openssl_config_cmd, cwd=str(openssl_dir), env=env)
439-
subprocess.check_output(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(openssl_dir), env=env)
440-
subprocess.check_output(
436+
subprocess.check_call(openssl_config_cmd, cwd=str(openssl_dir), env=env)
437+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(openssl_dir), env=env)
438+
subprocess.check_call(
441439
['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install_sw'], cwd=str(openssl_dir), env=env
442440
)
443441

444442
self.info('Building zlib')
445443
zlib_dir = next(self.build_libs_dir.glob('zlib-*'))
446-
subprocess.check_output(['./configure', prefix_arg], cwd=str(zlib_dir), env=env)
447-
subprocess.check_output(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(zlib_dir), env=env)
448-
subprocess.check_output(['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(zlib_dir), env=env)
444+
subprocess.check_call(['./configure', prefix_arg], cwd=str(zlib_dir), env=env)
445+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(zlib_dir), env=env)
446+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(zlib_dir), env=env)
449447

450-
host_arg = ""
448+
host_arg = []
451449
if cross_compiling:
452-
host_arg = '--host={}'.format(cross_compiling.arch)
450+
host_arg = ['--host={}'.format(cross_compiling.arch)]
453451

454452
self.info('Building libiconv')
455453
libiconv_dir = next(self.build_libs_dir.glob('libiconv-*'))
456-
subprocess.check_output(
454+
subprocess.check_call(
457455
[
458456
'./configure',
459457
prefix_arg,
460458
'--disable-dependency-tracking',
461459
'--disable-shared',
462-
host_arg,
460+
*host_arg,
463461
],
464462
cwd=str(libiconv_dir),
465463
env=env,
466464
)
467-
subprocess.check_output(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(libiconv_dir), env=env)
468-
subprocess.check_output(
469-
['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(libiconv_dir), env=env
470-
)
465+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(libiconv_dir), env=env)
466+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(libiconv_dir), env=env)
471467

472468
self.info('Building LibXML2')
473469
libxml2_dir = next(self.build_libs_dir.glob('libxml2-*'))
474-
subprocess.check_output(
470+
subprocess.check_call(
475471
[
476472
'./configure',
477473
prefix_arg,
@@ -481,19 +477,17 @@ def prepare_static_build(self, build_platform):
481477
'--without-python',
482478
'--with-iconv={}'.format(self.prefix_dir),
483479
'--with-zlib={}'.format(self.prefix_dir),
484-
host_arg,
480+
*host_arg,
485481
],
486482
cwd=str(libxml2_dir),
487483
env=env,
488484
)
489-
subprocess.check_output(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(libxml2_dir), env=env)
490-
subprocess.check_output(
491-
['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(libxml2_dir), env=env
492-
)
485+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(libxml2_dir), env=env)
486+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(libxml2_dir), env=env)
493487

494488
self.info('Building libxslt')
495489
libxslt_dir = next(self.build_libs_dir.glob('libxslt-*'))
496-
subprocess.check_output(
490+
subprocess.check_call(
497491
[
498492
'./configure',
499493
prefix_arg,
@@ -502,27 +496,26 @@ def prepare_static_build(self, build_platform):
502496
'--without-python',
503497
'--without-crypto',
504498
'--with-libxml-prefix={}'.format(self.prefix_dir),
505-
host_arg,
499+
*host_arg,
506500
],
507501
cwd=str(libxslt_dir),
508502
env=env,
509503
)
510-
subprocess.check_output(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(libxslt_dir), env=env)
511-
subprocess.check_output(
512-
['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(libxslt_dir), env=env
513-
)
504+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1)], cwd=str(libxslt_dir), env=env)
505+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(libxslt_dir), env=env)
514506

515507
self.info('Building xmlsec1')
516508
ldflags.append('-lpthread')
517509
env['LDFLAGS'] = ' '.join(ldflags)
518510
xmlsec1_dir = next(self.build_libs_dir.glob('xmlsec1-*'))
519-
subprocess.check_output(
511+
subprocess.check_call(
520512
[
521513
'./configure',
522514
prefix_arg,
523515
'--disable-shared',
524516
'--disable-gost',
525517
'--enable-md5',
518+
'--enable-ripemd160',
526519
'--disable-crypto-dl',
527520
'--enable-static=yes',
528521
'--enable-shared=no',
@@ -531,20 +524,18 @@ def prepare_static_build(self, build_platform):
531524
'--with-openssl={}'.format(self.prefix_dir),
532525
'--with-libxml={}'.format(self.prefix_dir),
533526
'--with-libxslt={}'.format(self.prefix_dir),
534-
host_arg,
527+
*host_arg,
535528
],
536529
cwd=str(xmlsec1_dir),
537530
env=env,
538531
)
539-
subprocess.check_output(
532+
subprocess.check_call(
540533
['make', '-j{}'.format(multiprocessing.cpu_count() + 1)]
541534
+ ['-I{}'.format(str(self.prefix_dir / 'include')), '-I{}'.format(str(self.prefix_dir / 'include' / 'libxml'))],
542535
cwd=str(xmlsec1_dir),
543536
env=env,
544537
)
545-
subprocess.check_output(
546-
['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(xmlsec1_dir), env=env
547-
)
538+
subprocess.check_call(['make', '-j{}'.format(multiprocessing.cpu_count() + 1), 'install'], cwd=str(xmlsec1_dir), env=env)
548539

549540
ext = self.ext_map['xmlsec']
550541
ext.define_macros = [

0 commit comments

Comments
 (0)