Skip to content

Commit 70815c2

Browse files
authored
Merge pull request #2141 from getsentry/chore/xmlsec-1.3.17
chore: xmlsec==1.3.17
2 parents 93feab2 + f839840 commit 70815c2

4 files changed

Lines changed: 131 additions & 3 deletions

File tree

packages.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4011,6 +4011,11 @@ apt_requires = pkg-config
40114011
brew_requires = pkg-config
40124012
custom_prebuild = prebuild/xmlsec-1-3-14-deps
40134013
python_versions = <3.14
4014+
[xmlsec==1.3.17]
4015+
apt_requires = pkg-config
4016+
brew_requires = pkg-config
4017+
custom_prebuild = prebuild/xmlsec-1-3-17-deps
4018+
python_versions = <3.14
40144019

40154020
[yamlfix==1.3.0]
40164021

prebuild/xmlsec-1-3-14-deps

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ def main() -> int:
4545
)
4646
os.environ["CPPFLAGS"] = _join_env(
4747
name="CPPFLAGS",
48-
value=f'-I{os.path.join(args.prefix, "include")}',
48+
value=f"-I{os.path.join(args.prefix, 'include')}",
4949
sep=" ",
5050
)
5151
os.environ["LDFLAGS"] = _join_env(
5252
name="LDFLAGS",
53-
value=f'-L{os.path.join(args.prefix, "lib")}',
53+
value=f"-L{os.path.join(args.prefix, 'lib')}",
5454
sep=" ",
5555
)
5656
os.environ["LD_LIBRARY_PATH"] = _join_env(
@@ -73,7 +73,6 @@ def main() -> int:
7373

7474
with tarfile.open(fileobj=io.BytesIO(bts)) as tarf:
7575
tarf.extractall(tmpdir)
76-
h = hashlib.sha256(bts).hexdigest()
7776

7877
srcroot = os.path.join(tmpdir, "libxml2-2.12.9")
7978
subprocess.check_call(

prebuild/xmlsec-1-3-17-deps

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/usr/bin/env python3
2+
from __future__ import annotations
3+
4+
import argparse
5+
import hashlib
6+
import io
7+
import os.path
8+
import secrets
9+
import subprocess
10+
import tarfile
11+
import tempfile
12+
import urllib.request
13+
14+
# matches libxml2 from lxml==6.1.0
15+
XML2_URL = "https://download.gnome.org/sources/libxml2/2.14/libxml2-2.14.6.tar.xz"
16+
XML2_SHA256 = "7ce458a0affeb83f0b55f1f4f9e0e55735dbfc1a9de124ee86fb4a66b597203a"
17+
# matches xmlsec from xmlsec==1.3.17
18+
XMLSEC_URL = (
19+
"https://github.com/lsh123/xmlsec/releases/download/1.3.9/xmlsec1-1.3.9.tar.gz"
20+
)
21+
XMLSEC_SHA256 = "a631c8cd7a6b86e6adb9f5b935d45a9cf9768b3cb090d461e8eb9d043cf9b62f"
22+
23+
24+
def _join_env(
25+
*,
26+
name: str,
27+
value: str,
28+
sep: str,
29+
) -> str:
30+
if name in os.environ:
31+
return f"{value}{sep}{os.environ[name]}"
32+
else:
33+
return value
34+
35+
36+
def main() -> int:
37+
parser = argparse.ArgumentParser()
38+
parser.add_argument("prefix")
39+
args = parser.parse_args()
40+
41+
os.environ["PATH"] = _join_env(
42+
name="PATH",
43+
value=os.path.join(args.prefix, "bin"),
44+
sep=os.pathsep,
45+
)
46+
os.environ["CPPFLAGS"] = _join_env(
47+
name="CPPFLAGS",
48+
value=f"-I{os.path.join(args.prefix, 'include')}",
49+
sep=" ",
50+
)
51+
os.environ["LDFLAGS"] = _join_env(
52+
name="LDFLAGS",
53+
value=f"-L{os.path.join(args.prefix, 'lib')}",
54+
sep=" ",
55+
)
56+
os.environ["LD_LIBRARY_PATH"] = _join_env(
57+
name="LD_LIBRARY_PATH",
58+
value=os.path.join(args.prefix, "lib"),
59+
sep=os.pathsep,
60+
)
61+
os.environ["PKG_CONFIG_PATH"] = _join_env(
62+
name="PKG_CONFIG_PATH",
63+
value=os.path.join(args.prefix, "lib", "pkgconfig"),
64+
sep=os.pathsep,
65+
)
66+
67+
with tempfile.TemporaryDirectory() as tmpdir:
68+
resp = urllib.request.urlopen(XML2_URL)
69+
bts = resp.read()
70+
h = hashlib.sha256(bts).hexdigest()
71+
if not secrets.compare_digest(h, XML2_SHA256):
72+
raise SystemExit(f"checksum mismatch: {(XML2_SHA256, h)=}")
73+
74+
with tarfile.open(fileobj=io.BytesIO(bts)) as tarf:
75+
tarf.extractall(tmpdir)
76+
77+
srcroot = os.path.join(tmpdir, "libxml2-2.14.6")
78+
subprocess.check_call(
79+
(
80+
"./configure",
81+
f"--prefix={args.prefix}",
82+
"--disable-silent-rules",
83+
"--with-history",
84+
"--with-icu",
85+
"--without-python",
86+
"--without-lzma",
87+
),
88+
cwd=srcroot,
89+
)
90+
subprocess.check_call(("make", "install"), cwd=srcroot)
91+
92+
with tempfile.TemporaryDirectory() as tmpdir:
93+
resp = urllib.request.urlopen(XMLSEC_URL)
94+
bts = resp.read()
95+
h = hashlib.sha256(bts).hexdigest()
96+
if not secrets.compare_digest(h, XMLSEC_SHA256):
97+
raise SystemExit(f"checksum mismatch: {(XMLSEC_SHA256, h)=}")
98+
99+
with tarfile.open(fileobj=io.BytesIO(bts)) as tarf:
100+
tarf.extractall(tmpdir)
101+
102+
srcroot = os.path.join(tmpdir, "xmlsec1-1.3.9")
103+
subprocess.check_call(
104+
(
105+
"./configure",
106+
"--disable-dependency-tracking",
107+
f"--prefix={args.prefix}",
108+
"--disable-crypto-dl",
109+
"--disable-apps-crypto-dl",
110+
"--with-nss=no",
111+
"--with-nspr=no",
112+
"--enable-mscrypto=no",
113+
"--enable-mscng=no",
114+
),
115+
cwd=srcroot,
116+
)
117+
subprocess.check_call(("make", "install"), cwd=srcroot)
118+
119+
return 0
120+
121+
122+
if __name__ == "__main__":
123+
raise SystemExit(main())

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ disallow_any_generics = true
3838
disallow_incomplete_defs = true
3939
disallow_untyped_defs = true
4040
no_implicit_optional = true
41+
scripts_are_modules = true
4142
warn_redundant_casts = true
4243
warn_unused_ignores = true
4344

0 commit comments

Comments
 (0)