Skip to content

Commit 93458a1

Browse files
committed
Use correct versions for windows and refactor the download script
1 parent 7f51a66 commit 93458a1

File tree

5 files changed

+67
-63
lines changed

5 files changed

+67
-63
lines changed

.github/workflows/cache_libs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ on:
2828
required: false
2929
type: string
3030
WIN_LIBICONV_VERSION:
31-
default: "1.18"
31+
default: "1.18-1"
3232
required: false
3333
type: string
3434
WIN_LIBXML2_VERSION:
35-
default: "2.14.6"
35+
default: "2.11.9-3"
3636
required: false
3737
type: string
3838
WIN_LIBXSLT_VERSION:
39-
default: "1.1.43"
39+
default: "1.1.39"
4040
required: false
4141
type: string
4242
WIN_OPENSSL_VERSION:
43-
default: "3.6.0"
43+
default: "3.0.16.pl1"
4444
required: false
4545
type: string
4646
WIN_XMLSEC1_VERSION:
47-
default: "1.3.9"
47+
default: "1.3.7"
4848
required: false
4949
type: string
5050
WIN_ZLIB_VERSION:
@@ -122,7 +122,7 @@ jobs:
122122
- name: Download latest libraries
123123
env:
124124
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125-
run: python buildlibxmlsec.py --download-only
125+
run: python build_libs_xmlsec.py --download-only
126126

127127
- name: Check Windows library versions
128128
if: ${{ contains(matrix.os, 'windows-') }}

build_libs_xmlsec.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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())

build_support/buildlibxmlsec.py renamed to build_support/lib_xmlsec_dependency_builder.py

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import argparse
21
import multiprocessing
32
import os
3+
from pathlib import Path
44
import platform
55
import subprocess
66
import sys
77
import tarfile
88
import zipfile
99
from dataclasses import dataclass
1010
from distutils.errors import DistutilsError
11-
from pathlib import Path
1211
from urllib.parse import urljoin
1312
from urllib.request import urlcleanup
1413

@@ -34,7 +33,7 @@ def triplet(self) -> str:
3433
return f'{self.host}-{self.arch}-{self.compiler}'
3534

3635

37-
class LibXmlSecDependencyBuilder:
36+
class LibXmlsecDependencyBuilder:
3837
WINDOWS_LIBS_DOWNLOAD_RELEASE_URL = 'https://github.com/mxamin/python-xmlsec-win-binaries/releases/download/2025.07.10/'
3938
LIB_VERSION_ENV_VARS = {
4039
'openssl_version': 'PYXMLSEC_OPENSSL_VERSION',
@@ -362,7 +361,7 @@ def _build_libxslt(self, env, prefix_arg, host_arg):
362361
subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}'], cwd=str(libxslt_dir), env=env)
363362
subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}', 'install'], cwd=str(libxslt_dir), env=env)
364363

365-
def _build_xmlsec1(self, env, prefix_arg, host_arg):
364+
def _build_xmlsec1(self, env, prefix_arg, host_arg):
366365
self.info('Building xmlsec1')
367366
xmlsec1_dir = next(self.build_libs_dir.glob('xmlsec1-*'))
368367
subprocess.check_call(
@@ -398,50 +397,4 @@ def _build_xmlsec1(self, env, prefix_arg, host_arg):
398397
subprocess.check_call(['make', f'-j{multiprocessing.cpu_count() + 1}', 'install'], cwd=str(xmlsec1_dir), env=env)
399398

400399

401-
def _console_info(message):
402-
print(message)
403-
404-
405-
def main(argv=None):
406-
parser = argparse.ArgumentParser(description='Download and build static dependency libraries for python-xmlsec.')
407-
parser.add_argument(
408-
'--platform',
409-
default=sys.platform,
410-
help='Target platform (default: current interpreter platform).',
411-
)
412-
parser.add_argument(
413-
'--plat-name',
414-
default=os.environ.get('PYXMLSEC_PLAT_NAME'),
415-
help='Target platform tag for cross-compiling (for example macosx-11.0-arm64).',
416-
)
417-
parser.add_argument(
418-
'--libs-dir',
419-
default=os.environ.get('PYXMLSEC_LIBS_DIR', 'libs'),
420-
help='Directory where source/binary archives are stored.',
421-
)
422-
parser.add_argument(
423-
'--buildroot',
424-
default=Path('build', 'tmp'),
425-
type=Path,
426-
help='Build root for extracted/build artifacts.',
427-
)
428-
parser.add_argument(
429-
'--download-only',
430-
action='store_true',
431-
help='Only download dependency archives; do not extract/build.',
432-
)
433-
434-
args = parser.parse_args(argv)
435-
builder = LibXmlSecDependencyBuilder(
436-
platform_name=args.platform,
437-
info=_console_info,
438-
libs_dir=Path(args.libs_dir),
439-
buildroot=args.buildroot,
440-
plat_name=args.plat_name,
441-
)
442-
builder.prepare(download_only=args.download_only)
443-
return 0
444-
445-
446-
if __name__ == '__main__':
447-
raise SystemExit(main())
400+
__all__ = ('CrossCompileInfo', 'LibXmlsecDependencyBuilder')

build_support/static_build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
from distutils.errors import DistutilsError
33

4-
from .buildlibxmlsec import CrossCompileInfo, LibXmlSecDependencyBuilder
4+
from .lib_xmlsec_dependency_builder import CrossCompileInfo, LibXmlsecDependencyBuilder
55

66

77
class StaticBuildHelper:
@@ -12,7 +12,7 @@ def __init__(self, builder):
1212

1313
def prepare(self, platform_name):
1414
self.info(f'starting static build on {sys.platform}')
15-
deps_builder = LibXmlSecDependencyBuilder(
15+
deps_builder = LibXmlsecDependencyBuilder(
1616
platform_name=platform_name,
1717
info=self.info,
1818
plat_name=getattr(self.builder, 'plat_name', None),

buildlibxmlsec.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)