relenv 0.19.4__py3-none-any.whl → 0.20.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- relenv/__main__.py +4 -4
- relenv/build/__init__.py +30 -10
- relenv/build/common.py +41 -21
- relenv/build/darwin.py +1 -16
- relenv/build/linux.py +1 -16
- relenv/build/windows.py +1 -16
- relenv/buildenv.py +21 -6
- relenv/common.py +88 -8
- relenv/create.py +2 -4
- relenv/fetch.py +2 -4
- relenv/manifest.py +34 -0
- relenv/pyversions.py +411 -0
- relenv/runtime.py +49 -8
- relenv/toolchain.py +8 -183
- {relenv-0.19.4.dist-info → relenv-0.20.1.dist-info}/METADATA +1 -1
- relenv-0.20.1.dist-info/RECORD +35 -0
- tests/conftest.py +3 -1
- tests/test_build.py +2 -2
- tests/test_common.py +8 -2
- tests/test_fips_photon.py +3 -0
- tests/test_verify_build.py +137 -25
- relenv/_toolchain/aarch64/aarch64-linux-gnu-ct-ng.config +0 -798
- relenv/_toolchain/aarch64/x86_64-linux-gnu-ct-ng.config +0 -800
- relenv/_toolchain/x86_64/aarch64-linux-gnu-ct-ng.config +0 -799
- relenv/_toolchain/x86_64/x86_64-linux-gnu-ct-ng.config +0 -801
- relenv-0.19.4.dist-info/RECORD +0 -38
- tests/test_toolchain.py +0 -107
- {relenv-0.19.4.dist-info → relenv-0.20.1.dist-info}/WHEEL +0 -0
- {relenv-0.19.4.dist-info → relenv-0.20.1.dist-info}/entry_points.txt +0 -0
- {relenv-0.19.4.dist-info → relenv-0.20.1.dist-info}/licenses/LICENSE.md +0 -0
- {relenv-0.19.4.dist-info → relenv-0.20.1.dist-info}/licenses/NOTICE +0 -0
- {relenv-0.19.4.dist-info → relenv-0.20.1.dist-info}/top_level.txt +0 -0
relenv/toolchain.py
CHANGED
|
@@ -3,35 +3,8 @@
|
|
|
3
3
|
"""
|
|
4
4
|
The ``relenv toolchain`` command.
|
|
5
5
|
"""
|
|
6
|
-
|
|
7
|
-
import os
|
|
8
|
-
import pathlib
|
|
9
|
-
import platform
|
|
10
|
-
import shutil
|
|
11
6
|
import sys
|
|
12
7
|
|
|
13
|
-
from .common import (
|
|
14
|
-
CHECK_HOSTS,
|
|
15
|
-
DATA_DIR,
|
|
16
|
-
__version__,
|
|
17
|
-
arches,
|
|
18
|
-
build_arch,
|
|
19
|
-
check_url,
|
|
20
|
-
download_url,
|
|
21
|
-
extract_archive,
|
|
22
|
-
get_toolchain,
|
|
23
|
-
get_triplet,
|
|
24
|
-
runcmd,
|
|
25
|
-
work_dirs,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
CT_NG_VER = "1.25.0"
|
|
29
|
-
CT_URL = "http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-{version}.tar.bz2"
|
|
30
|
-
TC_URL = "https://{hostname}/relenv/{version}/toolchain/{host}/{triplet}.tar.xz"
|
|
31
|
-
CICD = "CI" in os.environ
|
|
32
|
-
|
|
33
|
-
LAST_RELENV_W_TOOLCHAIN = "0.17.4"
|
|
34
|
-
|
|
35
8
|
|
|
36
9
|
def setup_parser(subparsers):
|
|
37
10
|
"""
|
|
@@ -43,165 +16,17 @@ def setup_parser(subparsers):
|
|
|
43
16
|
subparser = subparsers.add_parser("toolchain", description="Build Linux Toolchains")
|
|
44
17
|
subparser.set_defaults(func=main)
|
|
45
18
|
|
|
46
|
-
subparser.add_argument(
|
|
47
|
-
"command",
|
|
48
|
-
default="fetch",
|
|
49
|
-
choices=["build", "fetch"],
|
|
50
|
-
help="What type of toolchain operation to perform: build or fetch",
|
|
51
|
-
)
|
|
52
|
-
subparser.add_argument(
|
|
53
|
-
"--arch",
|
|
54
|
-
default=build_arch(),
|
|
55
|
-
choices=arches[sys.platform],
|
|
56
|
-
help="Architecture to build or fetch",
|
|
57
|
-
)
|
|
58
|
-
subparser.add_argument(
|
|
59
|
-
"--clean",
|
|
60
|
-
default=False,
|
|
61
|
-
action="store_true",
|
|
62
|
-
help="Whether or not to clean the toolchain directories",
|
|
63
|
-
)
|
|
64
|
-
subparser.add_argument(
|
|
65
|
-
"--crosstool-only",
|
|
66
|
-
default=False,
|
|
67
|
-
action="store_true",
|
|
68
|
-
help="When building only build Crosstool NG. Do not build toolchains",
|
|
69
|
-
)
|
|
70
19
|
|
|
71
|
-
|
|
72
|
-
def fetch(arch, toolchain, clean=False, version=__version__):
|
|
73
|
-
"""
|
|
74
|
-
Fetch a toolchain and extract it to the filesystem.
|
|
75
|
-
|
|
76
|
-
:param arch: The architecture of the toolchain
|
|
77
|
-
:type arch: str
|
|
78
|
-
:param toolchain: Where to extract the toolchain
|
|
79
|
-
:type toolchain: str
|
|
80
|
-
:param clean: If true, clean the toolchain directories first
|
|
81
|
-
:type clean: bool
|
|
20
|
+
def main(*args, **kwargs):
|
|
82
21
|
"""
|
|
83
|
-
|
|
84
|
-
archdir = get_toolchain(root=pathlib.Path(DATA_DIR) / "toolchain", arch=arch)
|
|
85
|
-
if clean:
|
|
86
|
-
shutil.rmtree(archdir)
|
|
87
|
-
if archdir.exists():
|
|
88
|
-
print(f"Toolchain directory exists, skipping {arch}")
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
check_hosts = CHECK_HOSTS
|
|
92
|
-
if os.environ.get("RELENV_FETCH_HOST", ""):
|
|
93
|
-
check_hosts = [os.environ["RELENV_FETCH_HOST"]]
|
|
94
|
-
for host in check_hosts:
|
|
95
|
-
url = TC_URL.format(
|
|
96
|
-
hostname=host,
|
|
97
|
-
version=LAST_RELENV_W_TOOLCHAIN,
|
|
98
|
-
host=platform.machine(),
|
|
99
|
-
triplet=triplet,
|
|
100
|
-
)
|
|
101
|
-
if check_url(url, timeout=5):
|
|
102
|
-
break
|
|
103
|
-
else:
|
|
104
|
-
print(f"Unable to find file on an hosts {' '.join(check_hosts)}")
|
|
105
|
-
sys.exit(1)
|
|
106
|
-
|
|
107
|
-
archive = download_url(url, toolchain)
|
|
108
|
-
extract_archive(toolchain, archive)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def _configure_ctng(ctngdir, dirs):
|
|
22
|
+
Notify users of toolchain command deprecation.
|
|
112
23
|
"""
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
:type dirs: ``relenv.common.WorkDirs``
|
|
119
|
-
"""
|
|
120
|
-
if not ctngdir.exists():
|
|
121
|
-
url = CT_URL.format(version=CT_NG_VER)
|
|
122
|
-
archive = download_url(url, dirs.toolchain)
|
|
123
|
-
extract_archive(dirs.toolchain, archive)
|
|
124
|
-
os.chdir(ctngdir)
|
|
125
|
-
ctng = ctngdir / "ct-ng"
|
|
126
|
-
if not ctng.exists():
|
|
127
|
-
runcmd(["./configure", "--enable-local"])
|
|
128
|
-
runcmd(["make"])
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def build(arch, dirs, machine, ctngdir):
|
|
132
|
-
"""
|
|
133
|
-
Build a toolchaing for the given arch.
|
|
134
|
-
|
|
135
|
-
:param arch: The architecture to build for
|
|
136
|
-
:type arch: str
|
|
137
|
-
:param dirs: The working directories
|
|
138
|
-
:type dirs: ``relenv.common.WorkDirs``
|
|
139
|
-
:param machine: The machine to build for
|
|
140
|
-
:type machine: str
|
|
141
|
-
:param ctngdir: The directory holding crosstool-ng
|
|
142
|
-
:type ctngdir: ``pathlib.Path``
|
|
143
|
-
"""
|
|
144
|
-
os.chdir(dirs.toolchain)
|
|
145
|
-
ctng = ctngdir / "ct-ng"
|
|
146
|
-
triplet = get_triplet(arch)
|
|
147
|
-
archdir = dirs.toolchain / triplet
|
|
148
|
-
if archdir.exists():
|
|
149
|
-
print("Toolchain directory exists: {}".format(archdir))
|
|
150
|
-
else:
|
|
151
|
-
config = dirs.toolchain_config / machine / "{}-ct-ng.config".format(triplet)
|
|
152
|
-
if not config.exists():
|
|
153
|
-
print("Toolchain config missing: {}".format(config))
|
|
154
|
-
sys.exit(1)
|
|
155
|
-
with open(config, "r") as rfp:
|
|
156
|
-
with open(".config", "w") as wfp:
|
|
157
|
-
wfp.write(rfp.read())
|
|
158
|
-
env = os.environ.copy()
|
|
159
|
-
env["CT_PREFIX"] = dirs.toolchain
|
|
160
|
-
env["CT_ALLOW_BUILD_AS_ROOT"] = "y"
|
|
161
|
-
env["CT_ALLOW_BUILD_AS_ROOT_SURE"] = "y"
|
|
162
|
-
if CICD:
|
|
163
|
-
env["CT_LOG_PROGRESS"] = "n"
|
|
164
|
-
runcmd(
|
|
165
|
-
[
|
|
166
|
-
str(ctng),
|
|
167
|
-
"source",
|
|
168
|
-
],
|
|
169
|
-
env=env,
|
|
170
|
-
)
|
|
171
|
-
runcmd(
|
|
172
|
-
[
|
|
173
|
-
str(ctng),
|
|
174
|
-
"build",
|
|
175
|
-
],
|
|
176
|
-
env=env,
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
def main(args):
|
|
181
|
-
"""
|
|
182
|
-
The entrypoint into the ``relenv toolchain`` command.
|
|
183
|
-
|
|
184
|
-
:param args: The arguments for the command
|
|
185
|
-
:type args: ``argparse.Namespace``
|
|
186
|
-
"""
|
|
187
|
-
version = os.environ.get("RELENV_FETCH_VERSION", __version__)
|
|
188
|
-
machine = platform.machine()
|
|
189
|
-
dirs = work_dirs()
|
|
190
|
-
print(f"Toolchain directory: {dirs.toolchain}")
|
|
191
|
-
if not dirs.toolchain.exists():
|
|
192
|
-
os.makedirs(dirs.toolchain)
|
|
193
|
-
if args.command == "fetch":
|
|
194
|
-
fetch(args.arch, dirs.toolchain, args.clean, version)
|
|
195
|
-
sys.exit(0)
|
|
196
|
-
elif args.command == "build":
|
|
197
|
-
ctngdir = dirs.toolchain / "crosstool-ng-{}".format(CT_NG_VER)
|
|
198
|
-
_configure_ctng(ctngdir, dirs)
|
|
199
|
-
if args.crosstool_only:
|
|
200
|
-
sys.exit(0)
|
|
201
|
-
build(args.arch, dirs, machine, ctngdir)
|
|
24
|
+
sys.stderr.write(
|
|
25
|
+
"The relenv toolchain command has been deprecated. Please pip install relenv[toolchain].\n"
|
|
26
|
+
)
|
|
27
|
+
sys.stderr.flush()
|
|
28
|
+
sys.exit(1)
|
|
202
29
|
|
|
203
30
|
|
|
204
31
|
if __name__ == "__main__":
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
main(ArgumentParser())
|
|
32
|
+
main()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: relenv
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.20.1
|
|
4
4
|
Project-URL: Source Code, https://github.com/saltstack/relative-environment-for-python
|
|
5
5
|
Project-URL: Documentation, https://relenv.readthedocs.io/en/latest/
|
|
6
6
|
Project-URL: Changelog, https://relenv.readthedocs.io/en/latest/changelog.html
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
relenv/__init__.py,sha256=NyZyghiBF5up_Uq6iJhmBr5HUKzfDtP-yZlU1OS6lQM,101
|
|
2
|
+
relenv/__main__.py,sha256=73VLBFMCXA8ccJiHYJ2KmctJRira-I_MnDKFIdv9JVI,1344
|
|
3
|
+
relenv/buildenv.py,sha256=TVpvA6qZ5zNca1YvEJwxpUps7gHtuETPxGIiA2zFAqI,3197
|
|
4
|
+
relenv/check.py,sha256=AIGxq_2ZBVVIBO8QiJZHknGILyjmxLgN00TTHlFjNsY,951
|
|
5
|
+
relenv/common.py,sha256=pcgtZuwQlp9XxSXU24UDk2K6FnRQewbm2rXre-jd3dk,19637
|
|
6
|
+
relenv/create.py,sha256=Uwoz7c07V0gZBRUM_gPPyENBdKlQqy32ABYiAM5A6XQ,3830
|
|
7
|
+
relenv/fetch.py,sha256=CJSMJsrAinfReEdwPJGORbLV2DHauIIVcUxozxqr1ug,2274
|
|
8
|
+
relenv/manifest.py,sha256=jm3hySI4tWnvfGspf9Q416mugZJc-rlwvLIoaxxlFQc,840
|
|
9
|
+
relenv/pyversions.py,sha256=BIJeTb_iwvmuCOd7_MGZ5GgCcoF2AdwbeWsmbVRPdVo,11967
|
|
10
|
+
relenv/relocate.py,sha256=P5l4s5H4bR8cYm1PEtwp9yJyVfZ5km44jLe0LvL8CL0,11797
|
|
11
|
+
relenv/runtime.py,sha256=F9fplL6U8oOuPL7uy5CAZpXFg0ikp4zcADg-lmsXKHE,32905
|
|
12
|
+
relenv/toolchain.py,sha256=EpwfR8Xno2hpGFZ1r0dkCdIp6vARfcGD8X6cntjy3Bs,782
|
|
13
|
+
relenv/_scripts/install_vc_build.ps1,sha256=LwzqinKppwht2tacu2jl_gY6gcGWaSq-5Lr1aKduzhs,6423
|
|
14
|
+
relenv/build/__init__.py,sha256=qrbrNjT3t1SYmUIOIcQJP6raKUkgTYXxlLzDtgGuvhg,6091
|
|
15
|
+
relenv/build/common.py,sha256=7FmlA3SFTxSlwKVB7TP9zgtX9JNehZ1qxnqEF-kshV4,49119
|
|
16
|
+
relenv/build/darwin.py,sha256=705vbaTzv3RGPs7sD2WkNZfO8FYWyXOmUv77JXsP4ag,3501
|
|
17
|
+
relenv/build/linux.py,sha256=zYJ8G8aTzYRqGXuAnaIfErlCZ_-J8-OPcZDGH6i4gTg,18777
|
|
18
|
+
relenv/build/windows.py,sha256=BPeLh1JDbyDaSMKwNFPww8BvvKSuMXIEQTR19_VqWUs,5753
|
|
19
|
+
relenv-0.20.1.dist-info/licenses/LICENSE.md,sha256=T0SRk3vJM1YcAJjDz9vsX9gsCRatAVSBS7LeU0tklRM,9919
|
|
20
|
+
relenv-0.20.1.dist-info/licenses/NOTICE,sha256=Ns0AybPHBsgJKJJfjE6YnGgWEQQ9F7lQ6QNlYLlQT3E,548
|
|
21
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
tests/conftest.py,sha256=mNDDGxe-EG8KLNVhRVt0M_Em0T1xo1ibgrx-Q5N4pT8,2154
|
|
23
|
+
tests/test_build.py,sha256=_D54xl4rrp9pnh5VGw46LO5K7MYsFAbDBCV4H9P5v3M,1369
|
|
24
|
+
tests/test_common.py,sha256=u-nMVgurUc_Ub7U15JRsI-yzy9Oyq34kQUhoWknpaa8,6754
|
|
25
|
+
tests/test_create.py,sha256=gnwNukmYJR02CunQBH6JJ3ClUYgjzBWlOm0SJ_rtJkI,1584
|
|
26
|
+
tests/test_downloads.py,sha256=zdULspcHcepOVkEQKOMr0pw02t9GRiBCcIP72So0EYc,3302
|
|
27
|
+
tests/test_fips_photon.py,sha256=fx5EKzRgJ5HbVLZ49M1YN_x2FYSxHahzPwwMaTcVQsA,1325
|
|
28
|
+
tests/test_relocate.py,sha256=_3Eb22qhzWvMnLIgPCqO-t_WZ-hklSMfy8GBTrdjCf0,8854
|
|
29
|
+
tests/test_runtime.py,sha256=n_gTiQqAgO_Vqk6Xf_2Hi3gIkBn_lhDqoovOiQ5fxG8,626
|
|
30
|
+
tests/test_verify_build.py,sha256=ZZ8a_PsSon1aPHzXC2BBx4A1l6MJllol91Tm7Bms9lk,48289
|
|
31
|
+
relenv-0.20.1.dist-info/METADATA,sha256=Jq-kY1527j-jcB1fhmyg2XtyZ29xqT36syAHdEIsl0A,1360
|
|
32
|
+
relenv-0.20.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
33
|
+
relenv-0.20.1.dist-info/entry_points.txt,sha256=dO66nWPPWl8ALWWnZFlHKAo6mfPFuQid7purYWL2ddc,48
|
|
34
|
+
relenv-0.20.1.dist-info/top_level.txt,sha256=P4Ro6JLZE53ZdsQ76o2OzBcpb0MaVJmbfr0HAn9WF8M,13
|
|
35
|
+
relenv-0.20.1.dist-info/RECORD,,
|
tests/conftest.py
CHANGED
|
@@ -25,7 +25,9 @@ def get_build_version():
|
|
|
25
25
|
if sysplat == sys.platform and arch == platform.machine().lower():
|
|
26
26
|
versions.append(version)
|
|
27
27
|
if versions:
|
|
28
|
-
|
|
28
|
+
version = versions[0]
|
|
29
|
+
log.warn("Environment RELENV_PY_VERSION not set, detected version %s", version)
|
|
30
|
+
return version
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
def pytest_report_header(config):
|
tests/test_build.py
CHANGED
|
@@ -29,8 +29,8 @@ def test_builder_defaults_linux():
|
|
|
29
29
|
assert builder.prefix == DATA_DIR / "build" / "3.10.10-x86_64-linux-gnu"
|
|
30
30
|
assert builder.sources == DATA_DIR / "src"
|
|
31
31
|
assert builder.downloads == DATA_DIR / "download"
|
|
32
|
-
assert builder.
|
|
33
|
-
assert
|
|
32
|
+
assert "ppbt" in str(builder.toolchain)
|
|
33
|
+
assert "_toolchain" in str(builder.toolchain)
|
|
34
34
|
assert callable(builder.build_default)
|
|
35
35
|
assert callable(builder.populate_env)
|
|
36
36
|
assert builder.recipies == {}
|
tests/test_common.py
CHANGED
|
@@ -124,14 +124,20 @@ def test_get_toolchain(tmp_path):
|
|
|
124
124
|
data_dir = tmp_path / "data"
|
|
125
125
|
with patch("relenv.common.DATA_DIR", data_dir):
|
|
126
126
|
ret = get_toolchain(arch="aarch64")
|
|
127
|
-
|
|
127
|
+
if sys.platform in ["darwin", "win32"]:
|
|
128
|
+
assert "data" in str(ret)
|
|
129
|
+
else:
|
|
130
|
+
assert "ppbt" in str(ret)
|
|
128
131
|
|
|
129
132
|
|
|
130
133
|
def test_get_toolchain_no_arch(tmp_path):
|
|
131
134
|
data_dir = tmp_path / "data"
|
|
132
135
|
with patch("relenv.common.DATA_DIR", data_dir):
|
|
133
136
|
ret = get_toolchain()
|
|
134
|
-
|
|
137
|
+
if sys.platform in ["darwin", "win32"]:
|
|
138
|
+
assert "data" in str(ret)
|
|
139
|
+
else:
|
|
140
|
+
assert "ppbt" in str(ret)
|
|
135
141
|
|
|
136
142
|
|
|
137
143
|
@pytest.mark.parametrize("open_arg", (":gz", ":xz", ":bz2", ""))
|
tests/test_fips_photon.py
CHANGED
|
@@ -7,6 +7,8 @@ import subprocess
|
|
|
7
7
|
|
|
8
8
|
import pytest
|
|
9
9
|
|
|
10
|
+
from tests.test_verify_build import _install_ppbt
|
|
11
|
+
|
|
10
12
|
from .conftest import get_build_version
|
|
11
13
|
|
|
12
14
|
|
|
@@ -27,6 +29,7 @@ pytestmark = [
|
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
def test_fips_mode(pyexec, build):
|
|
32
|
+
_install_ppbt(pyexec)
|
|
30
33
|
env = os.environ.copy()
|
|
31
34
|
proc = subprocess.run(
|
|
32
35
|
[
|
tests/test_verify_build.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
# Copyright 2025 Broadcom.
|
|
2
|
-
# Copyright 2022-2024 VMware, Inc.
|
|
1
|
+
# Copyright 2022-2025 Broadcom.
|
|
3
2
|
# SPDX-License-Identifier: Apache-2
|
|
4
3
|
"""
|
|
5
4
|
Verify relenv builds.
|
|
6
5
|
"""
|
|
6
|
+
import json
|
|
7
7
|
import os
|
|
8
8
|
import pathlib
|
|
9
|
-
import platform
|
|
10
9
|
import shutil
|
|
11
10
|
import subprocess
|
|
12
11
|
import sys
|
|
@@ -16,7 +15,7 @@ import time
|
|
|
16
15
|
import packaging
|
|
17
16
|
import pytest
|
|
18
17
|
|
|
19
|
-
from relenv.common import
|
|
18
|
+
from relenv.common import build_arch, get_triplet
|
|
20
19
|
|
|
21
20
|
from .conftest import get_build_version
|
|
22
21
|
|
|
@@ -47,6 +46,31 @@ def setup(pth_file_path):
|
|
|
47
46
|
"""
|
|
48
47
|
|
|
49
48
|
|
|
49
|
+
def _install_ppbt(pexec):
|
|
50
|
+
if sys.platform in ["win32", "darwin"]:
|
|
51
|
+
return
|
|
52
|
+
if "pip" in str(pexec):
|
|
53
|
+
p = subprocess.run(
|
|
54
|
+
[
|
|
55
|
+
str(pexec),
|
|
56
|
+
"install",
|
|
57
|
+
"ppbt",
|
|
58
|
+
]
|
|
59
|
+
)
|
|
60
|
+
else:
|
|
61
|
+
p = subprocess.run(
|
|
62
|
+
[
|
|
63
|
+
str(pexec),
|
|
64
|
+
"-m",
|
|
65
|
+
"pip",
|
|
66
|
+
"install",
|
|
67
|
+
"ppbt",
|
|
68
|
+
]
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
assert p.returncode == 0, "Failed to install ppbt"
|
|
72
|
+
|
|
73
|
+
|
|
50
74
|
@pytest.fixture(scope="module")
|
|
51
75
|
def arch():
|
|
52
76
|
return build_arch()
|
|
@@ -129,10 +153,7 @@ def test_pip_install_salt_git(pipexec, build, build_dir, pyexec, build_version):
|
|
|
129
153
|
if sys.platform == "darwin" and "3.13" in build_version:
|
|
130
154
|
pytest.xfail("Salt does not work with 3.13 on macos yet")
|
|
131
155
|
|
|
132
|
-
|
|
133
|
-
# subprocess.run(
|
|
134
|
-
# [pipexec, "--upgrade", "install", "setuptools>=72.2.0"], check=True
|
|
135
|
-
# )
|
|
156
|
+
_install_ppbt(pipexec)
|
|
136
157
|
|
|
137
158
|
env = os.environ.copy()
|
|
138
159
|
env["RELENV_BUILDENV"] = "yes"
|
|
@@ -173,6 +194,9 @@ def test_pip_install_salt_git(pipexec, build, build_dir, pyexec, build_version):
|
|
|
173
194
|
reason="3.11.7 and greater will not work with 3005.x",
|
|
174
195
|
)
|
|
175
196
|
def test_pip_install_salt(pipexec, build, tmp_path, pyexec):
|
|
197
|
+
|
|
198
|
+
_install_ppbt(pipexec)
|
|
199
|
+
|
|
176
200
|
packages = [
|
|
177
201
|
"salt==3005",
|
|
178
202
|
]
|
|
@@ -198,6 +222,8 @@ def test_pip_install_salt(pipexec, build, tmp_path, pyexec):
|
|
|
198
222
|
|
|
199
223
|
@pytest.mark.skip_on_windows
|
|
200
224
|
def test_symlinked_scripts(pipexec, tmp_path, build):
|
|
225
|
+
_install_ppbt(pipexec)
|
|
226
|
+
|
|
201
227
|
name = "chardet==5.1.0"
|
|
202
228
|
env = os.environ.copy()
|
|
203
229
|
env["RELENV_DEBUG"] = "yes"
|
|
@@ -237,6 +263,8 @@ def test_pip_install_salt_w_static_requirements(
|
|
|
237
263
|
if salt_branch == "3006.x" and sys.platform == "win32":
|
|
238
264
|
pytest.xfail("Known failure")
|
|
239
265
|
|
|
266
|
+
_install_ppbt(pipexec)
|
|
267
|
+
|
|
240
268
|
env = os.environ.copy()
|
|
241
269
|
env["RELENV_BUILDENV"] = "yes"
|
|
242
270
|
env["USE_STATIC_REQUIREMENTS"] = "1"
|
|
@@ -296,6 +324,8 @@ def test_pip_install_salt_w_package_requirements(
|
|
|
296
324
|
if sys.platform == "darwin" and salt_branch == "3006.x":
|
|
297
325
|
pytest.xfail("Known failure")
|
|
298
326
|
|
|
327
|
+
_install_ppbt(pipexec)
|
|
328
|
+
|
|
299
329
|
env = os.environ.copy()
|
|
300
330
|
env["RELENV_BUILDENV"] = "yes"
|
|
301
331
|
env["USE_STATIC_REQUIREMENTS"] = "1"
|
|
@@ -395,6 +425,8 @@ def test_pip_install_pyzmq(pipexec, pyzmq_version, build_version, arch, build):
|
|
|
395
425
|
if pyzmq_version == "26.4.0" and sys.platform == "win32":
|
|
396
426
|
pytest.xfail("Needs troubleshooting 4/12/25")
|
|
397
427
|
|
|
428
|
+
_install_ppbt(pipexec)
|
|
429
|
+
|
|
398
430
|
env = os.environ.copy()
|
|
399
431
|
|
|
400
432
|
p = subprocess.run(
|
|
@@ -407,11 +439,7 @@ def test_pip_install_pyzmq(pipexec, pyzmq_version, build_version, arch, build):
|
|
|
407
439
|
],
|
|
408
440
|
env=env,
|
|
409
441
|
)
|
|
410
|
-
if
|
|
411
|
-
pyzmq_version == "26.2.0"
|
|
412
|
-
and sys.platform == "darwin"
|
|
413
|
-
and platform.processor() == "arm"
|
|
414
|
-
):
|
|
442
|
+
if pyzmq_version == "26.2.0" and sys.platform == "darwin":
|
|
415
443
|
pytest.xfail(f"{pyzmq_version} does not install on m1 mac")
|
|
416
444
|
if pyzmq_version == "26.2.0" and sys.platform == "darwin":
|
|
417
445
|
env[
|
|
@@ -452,6 +480,7 @@ def test_pip_install_pyzmq(pipexec, pyzmq_version, build_version, arch, build):
|
|
|
452
480
|
|
|
453
481
|
|
|
454
482
|
def test_pip_install_cryptography(pipexec):
|
|
483
|
+
_install_ppbt(pipexec)
|
|
455
484
|
packages = [
|
|
456
485
|
"cryptography",
|
|
457
486
|
]
|
|
@@ -463,6 +492,7 @@ def test_pip_install_cryptography(pipexec):
|
|
|
463
492
|
|
|
464
493
|
|
|
465
494
|
def test_pip_install_idem(pipexec):
|
|
495
|
+
_install_ppbt(pipexec)
|
|
466
496
|
packages = [
|
|
467
497
|
"idem",
|
|
468
498
|
]
|
|
@@ -474,6 +504,7 @@ def test_pip_install_idem(pipexec):
|
|
|
474
504
|
|
|
475
505
|
|
|
476
506
|
def test_pip_install_and_import_libcloud(pipexec, pyexec):
|
|
507
|
+
_install_ppbt(pipexec)
|
|
477
508
|
name = "apache-libcloud"
|
|
478
509
|
env = os.environ.copy()
|
|
479
510
|
env["RELENV_BUILDENV"] = "yes"
|
|
@@ -500,6 +531,7 @@ def test_pip_install_salt_pip_dir(pipexec, build, build_version, arch):
|
|
|
500
531
|
if sys.platform == "darwin" and "3.13" in build_version:
|
|
501
532
|
pytest.xfail("Salt does not work with 3.13 on macos yet")
|
|
502
533
|
|
|
534
|
+
_install_ppbt(pipexec)
|
|
503
535
|
env = os.environ.copy()
|
|
504
536
|
env["RELENV_BUILDENV"] = "yes"
|
|
505
537
|
env["RELENV_DEBUG"] = "yes"
|
|
@@ -517,6 +549,7 @@ def test_pip_install_salt_pip_dir(pipexec, build, build_version, arch):
|
|
|
517
549
|
|
|
518
550
|
|
|
519
551
|
def test_nox_virtualenvs(pipexec, build, tmp_path):
|
|
552
|
+
_install_ppbt(pipexec)
|
|
520
553
|
env = os.environ.copy()
|
|
521
554
|
env["RELENV_BUILDENV"] = "yes"
|
|
522
555
|
env["RELENV_DEBUG"] = "yes"
|
|
@@ -611,6 +644,20 @@ def test_pip_install_m2crypto_relenv_ssl(
|
|
|
611
644
|
):
|
|
612
645
|
if m2crypto_version == "0.38.0" and minor_version in ["3.12", "3.13"]:
|
|
613
646
|
pytest.xfail("Fails due to no distutils")
|
|
647
|
+
|
|
648
|
+
_install_ppbt(pipexec)
|
|
649
|
+
|
|
650
|
+
p = subprocess.run(
|
|
651
|
+
[
|
|
652
|
+
pyexec,
|
|
653
|
+
"-m",
|
|
654
|
+
"relenv",
|
|
655
|
+
"buildenv",
|
|
656
|
+
"--json",
|
|
657
|
+
],
|
|
658
|
+
capture_output=True,
|
|
659
|
+
)
|
|
660
|
+
buildenv = json.loads(p.stdout)
|
|
614
661
|
env = os.environ.copy()
|
|
615
662
|
env["RELENV_BUILDENV"] = "yes"
|
|
616
663
|
env["RELENV_DEBUG"] = "yes"
|
|
@@ -632,13 +679,7 @@ def test_pip_install_m2crypto_relenv_ssl(
|
|
|
632
679
|
stderr=subprocess.PIPE,
|
|
633
680
|
)
|
|
634
681
|
assert p.returncode == 0, "Failed to pip install m2crypto"
|
|
635
|
-
gcc = str(
|
|
636
|
-
pathlib.Path(DATA_DIR)
|
|
637
|
-
/ "toolchain"
|
|
638
|
-
/ f"{get_triplet()}"
|
|
639
|
-
/ "bin"
|
|
640
|
-
/ f"{get_triplet()}-gcc"
|
|
641
|
-
)
|
|
682
|
+
gcc = str(pathlib.Path(buildenv["TOOLCHAIN_PATH"]) / "bin" / f"{get_triplet()}-gcc")
|
|
642
683
|
include = str(pathlib.Path(build) / "include")
|
|
643
684
|
found_include = False
|
|
644
685
|
for _ in p.stderr.splitlines():
|
|
@@ -647,7 +688,7 @@ def test_pip_install_m2crypto_relenv_ssl(
|
|
|
647
688
|
for arg in line.split():
|
|
648
689
|
if arg == f"-I{include}":
|
|
649
690
|
found_include = True
|
|
650
|
-
assert found_include
|
|
691
|
+
assert found_include, f"{include}\n{p.stderr.decode()}"
|
|
651
692
|
p = subprocess.run(
|
|
652
693
|
[str(pyexec), "-c", "import M2Crypto"],
|
|
653
694
|
env=env,
|
|
@@ -685,6 +726,7 @@ def test_shebangs(pipexec, build, minor_version):
|
|
|
685
726
|
# XXX Mac support
|
|
686
727
|
@pytest.mark.skip_unless_on_linux
|
|
687
728
|
def test_moving_pip_installed_c_extentions(pipexec, build, minor_version):
|
|
729
|
+
_install_ppbt(pipexec)
|
|
688
730
|
env = os.environ.copy()
|
|
689
731
|
env["RELENV_DEBUG"] = "yes"
|
|
690
732
|
env["RELENV_BUILDENV"] = "yes"
|
|
@@ -713,7 +755,16 @@ def test_moving_pip_installed_c_extentions(pipexec, build, minor_version):
|
|
|
713
755
|
|
|
714
756
|
@pytest.mark.skip_unless_on_linux
|
|
715
757
|
@pytest.mark.parametrize("cryptography_version", ["40.0.1", "39.0.2"])
|
|
716
|
-
def test_cryptography_rpath(
|
|
758
|
+
def test_cryptography_rpath(
|
|
759
|
+
pyexec, pipexec, build, minor_version, cryptography_version
|
|
760
|
+
):
|
|
761
|
+
_install_ppbt(pipexec)
|
|
762
|
+
# log.warn("Extract ppbt")
|
|
763
|
+
# p = subprocess.run(
|
|
764
|
+
# [pyexec, "-c", "import ppbt; ppbt.extract()"],
|
|
765
|
+
# )
|
|
766
|
+
# assert p.returncode == 0
|
|
767
|
+
|
|
717
768
|
def find_library(path, search):
|
|
718
769
|
for root, dirs, files in os.walk(path):
|
|
719
770
|
for fname in files:
|
|
@@ -726,6 +777,7 @@ def test_cryptography_rpath(pipexec, build, minor_version, cryptography_version)
|
|
|
726
777
|
[
|
|
727
778
|
str(pipexec),
|
|
728
779
|
"install",
|
|
780
|
+
"-v",
|
|
729
781
|
f"cryptography=={cryptography_version}",
|
|
730
782
|
"--no-cache-dir",
|
|
731
783
|
"--no-binary=cryptography",
|
|
@@ -775,11 +827,50 @@ def test_cryptography_rpath(pipexec, build, minor_version, cryptography_version)
|
|
|
775
827
|
if "GLIBC_2.33" in line:
|
|
776
828
|
valid = False
|
|
777
829
|
break
|
|
778
|
-
assert valid
|
|
830
|
+
assert valid, p.stdout.decode()
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
@pytest.mark.skip_unless_on_darwin
|
|
834
|
+
@pytest.mark.parametrize("cryptography_version", ["42.0.5", "40.0.1"])
|
|
835
|
+
def test_cryptography_rpath_darwin(pipexec, build, minor_version, cryptography_version):
|
|
836
|
+
# def find_library(path, search):
|
|
837
|
+
# for root, dirs, files in os.walk(path):
|
|
838
|
+
# for fname in files:
|
|
839
|
+
# if fname.startswith(search) and fname.endswith(".so"):
|
|
840
|
+
# return fname
|
|
841
|
+
|
|
842
|
+
env = os.environ.copy()
|
|
843
|
+
env["RELENV_BUILDENV"] = "yes"
|
|
844
|
+
env["OPENSSL_DIR"] = f"{build}"
|
|
845
|
+
|
|
846
|
+
if minor_version == "3.13":
|
|
847
|
+
env["PYO3_USE_ABI3_FORWARD_COMPATIBILITY"] = "1"
|
|
848
|
+
|
|
849
|
+
p = subprocess.run(
|
|
850
|
+
[
|
|
851
|
+
str(pipexec),
|
|
852
|
+
"install",
|
|
853
|
+
f"cryptography=={cryptography_version}",
|
|
854
|
+
"--no-cache-dir",
|
|
855
|
+
"--no-binary=cryptography",
|
|
856
|
+
],
|
|
857
|
+
env=env,
|
|
858
|
+
)
|
|
859
|
+
assert p.returncode != 1, "Failed to pip install cryptography"
|
|
860
|
+
p = subprocess.run(
|
|
861
|
+
[
|
|
862
|
+
"otool",
|
|
863
|
+
"-L",
|
|
864
|
+
f"{build}/lib/python{minor_version}/site-packages/cryptography/hazmat/bindings/_rust.abi3.so",
|
|
865
|
+
],
|
|
866
|
+
capture_output=True,
|
|
867
|
+
)
|
|
868
|
+
assert "/usr/local" not in p.stdout.decode(), p.stdout.decode()
|
|
779
869
|
|
|
780
870
|
|
|
781
871
|
@pytest.mark.skip_unless_on_linux
|
|
782
872
|
def test_install_pycurl(pipexec, build):
|
|
873
|
+
_install_ppbt(pipexec)
|
|
783
874
|
curlver = "8.0.1"
|
|
784
875
|
|
|
785
876
|
# Build curl and install it into the relenv environment
|
|
@@ -876,7 +967,6 @@ def build_dir(tmp_path):
|
|
|
876
967
|
],
|
|
877
968
|
)
|
|
878
969
|
def test_install_libgit2(pipexec, build, minor_version, build_dir, versions):
|
|
879
|
-
|
|
880
970
|
buildscript = textwrap.dedent(
|
|
881
971
|
"""\
|
|
882
972
|
set -e
|
|
@@ -952,6 +1042,7 @@ def test_install_libgit2(pipexec, build, minor_version, build_dir, versions):
|
|
|
952
1042
|
|
|
953
1043
|
@pytest.mark.skip_unless_on_linux
|
|
954
1044
|
def test_install_python_ldap(pipexec, build):
|
|
1045
|
+
_install_ppbt(pipexec)
|
|
955
1046
|
saslver = "2.1.28"
|
|
956
1047
|
ldapver = "2.5.14"
|
|
957
1048
|
|
|
@@ -1365,9 +1456,12 @@ def test_install_with_target_namespaces(pipexec, build, minor_version, build_ver
|
|
|
1365
1456
|
|
|
1366
1457
|
|
|
1367
1458
|
@pytest.mark.skip_unless_on_linux
|
|
1368
|
-
def test_debugpy(pipexec, build, minor_version):
|
|
1459
|
+
def test_debugpy(pipexec, build, arch, minor_version):
|
|
1369
1460
|
if "3.13" in minor_version:
|
|
1370
1461
|
pytest.xfail("Failes on python 3.13.0")
|
|
1462
|
+
if arch == "arm64":
|
|
1463
|
+
pytest.xfail("Failes on arm64")
|
|
1464
|
+
|
|
1371
1465
|
p = subprocess.run(
|
|
1372
1466
|
[
|
|
1373
1467
|
str(pipexec),
|
|
@@ -1480,6 +1574,7 @@ def test_install_pyinotify_w_latest_pip(pipexec, build, minor_version):
|
|
|
1480
1574
|
|
|
1481
1575
|
@pytest.mark.skip_unless_on_linux
|
|
1482
1576
|
def test_install_editable_package(pipexec, pyexec, build, minor_version, tmp_path):
|
|
1577
|
+
_install_ppbt(pipexec)
|
|
1483
1578
|
os.chdir(tmp_path)
|
|
1484
1579
|
env = os.environ.copy()
|
|
1485
1580
|
env["RELENV_BUILDENV"] = "yes"
|
|
@@ -1504,6 +1599,7 @@ def test_install_editable_package(pipexec, pyexec, build, minor_version, tmp_pat
|
|
|
1504
1599
|
def test_install_editable_package_in_extras(
|
|
1505
1600
|
pipexec, pyexec, build, minor_version, tmp_path
|
|
1506
1601
|
):
|
|
1602
|
+
_install_ppbt(pipexec)
|
|
1507
1603
|
sitepkgs = pathlib.Path(build) / "lib" / f"python{minor_version}" / "site-packages"
|
|
1508
1604
|
|
|
1509
1605
|
(sitepkgs / "_extras.pth").write_text("import _extras; _extras.setup(__file__)")
|
|
@@ -1588,6 +1684,7 @@ def rockycontainer(build):
|
|
|
1588
1684
|
|
|
1589
1685
|
@pytest.mark.skip_on_windows
|
|
1590
1686
|
def test_no_openssl_binary(rockycontainer, pipexec):
|
|
1687
|
+
_install_ppbt(pipexec)
|
|
1591
1688
|
env = os.environ.copy()
|
|
1592
1689
|
env["RELENV_BUILDENV"] = "yes"
|
|
1593
1690
|
proc = subprocess.run(
|
|
@@ -1615,3 +1712,18 @@ def test_no_openssl_binary(rockycontainer, pipexec):
|
|
|
1615
1712
|
|
|
1616
1713
|
errors = proc.stderr.decode()
|
|
1617
1714
|
assert "legacy provider failed to load" not in errors
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
@pytest.mark.skip_unless_on_darwin
|
|
1718
|
+
def test_darwin_python_linking(pipexec, pyexec, build, minor_version):
|
|
1719
|
+
proc = subprocess.run(["otool", "-L", str(pyexec)], capture_output=True, check=True)
|
|
1720
|
+
assert "/usr/local/opt" not in proc.stdout.decode()
|
|
1721
|
+
|
|
1722
|
+
|
|
1723
|
+
def test_import_ssl_module(pyexec):
|
|
1724
|
+
proc = subprocess.run(
|
|
1725
|
+
[pyexec, "-c", "import ssl"], capture_output=True, check=False
|
|
1726
|
+
)
|
|
1727
|
+
assert proc.returncode == 0
|
|
1728
|
+
assert proc.stdout.decode() == ""
|
|
1729
|
+
assert proc.stderr.decode() == ""
|