1- import argparse
21import multiprocessing
32import os
43import platform
87import zipfile
98from dataclasses import dataclass
109from distutils .errors import DistutilsError
11- from pathlib import Path
1210from urllib .parse import urljoin
1311from urllib .request import urlcleanup
1412
@@ -34,7 +32,7 @@ def triplet(self) -> str:
3432 return f'{ self .host } -{ self .arch } -{ self .compiler } '
3533
3634
37- class LibXmlSecDependencyBuilder :
35+ class LibXmlsecDependencyBuilder :
3836 WINDOWS_LIBS_DOWNLOAD_RELEASE_URL = 'https://github.com/mxamin/python-xmlsec-win-binaries/releases/download/2025.07.10/'
3937 LIB_VERSION_ENV_VARS = {
4038 'openssl_version' : 'PYXMLSEC_OPENSSL_VERSION' ,
@@ -362,7 +360,7 @@ def _build_libxslt(self, env, prefix_arg, host_arg):
362360 subprocess .check_call (['make' , f'-j{ multiprocessing .cpu_count () + 1 } ' ], cwd = str (libxslt_dir ), env = env )
363361 subprocess .check_call (['make' , f'-j{ multiprocessing .cpu_count () + 1 } ' , 'install' ], cwd = str (libxslt_dir ), env = env )
364362
365- def _build_xmlsec1 (self , env , prefix_arg , host_arg ):
363+ def _build_xmlsec1 (self , env , prefix_arg , host_arg ):
366364 self .info ('Building xmlsec1' )
367365 xmlsec1_dir = next (self .build_libs_dir .glob ('xmlsec1-*' ))
368366 subprocess .check_call (
@@ -398,50 +396,4 @@ def _build_xmlsec1(self, env, prefix_arg, host_arg):
398396 subprocess .check_call (['make' , f'-j{ multiprocessing .cpu_count () + 1 } ' , 'install' ], cwd = str (xmlsec1_dir ), env = env )
399397
400398
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 ())
399+ __all__ = ('CrossCompileInfo' , 'LibXmlsecDependencyBuilder' )
0 commit comments