relenv 0.19.3__py3-none-any.whl → 0.20.0__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 +43 -21
- relenv/build/darwin.py +3 -18
- relenv/build/linux.py +5 -20
- 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 +56 -8
- relenv/toolchain.py +8 -183
- {relenv-0.19.3.dist-info → relenv-0.20.0.dist-info}/METADATA +1 -1
- relenv-0.20.0.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 +222 -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.3.dist-info/RECORD +0 -38
- tests/test_toolchain.py +0 -107
- {relenv-0.19.3.dist-info → relenv-0.20.0.dist-info}/WHEEL +0 -0
- {relenv-0.19.3.dist-info → relenv-0.20.0.dist-info}/entry_points.txt +0 -0
- {relenv-0.19.3.dist-info → relenv-0.20.0.dist-info}/licenses/LICENSE.md +0 -0
- {relenv-0.19.3.dist-info → relenv-0.20.0.dist-info}/licenses/NOTICE +0 -0
- {relenv-0.19.3.dist-info → relenv-0.20.0.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.0
|
|
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=dQR-0iraFTVwQYpp-NzBi2GJVuMTzQt2YJvrTWihAdI,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=nH7HRKZU4b2533eghzkD_6Etb8jU1XMYS89786RgRIs,49173
|
|
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.0.dist-info/licenses/LICENSE.md,sha256=T0SRk3vJM1YcAJjDz9vsX9gsCRatAVSBS7LeU0tklRM,9919
|
|
20
|
+
relenv-0.20.0.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.0.dist-info/METADATA,sha256=Jd0Z2KQxBmlZhgzUHTn5smarHGyUwMkWhtqjdZXDEPA,1360
|
|
32
|
+
relenv-0.20.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
33
|
+
relenv-0.20.0.dist-info/entry_points.txt,sha256=dO66nWPPWl8ALWWnZFlHKAo6mfPFuQid7purYWL2ddc,48
|
|
34
|
+
relenv-0.20.0.dist-info/top_level.txt,sha256=P4Ro6JLZE53ZdsQ76o2OzBcpb0MaVJmbfr0HAn9WF8M,13
|
|
35
|
+
relenv-0.20.0.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
|
[
|