relenv 0.21.1__tar.gz → 0.22.0__tar.gz

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.
Files changed (69) hide show
  1. relenv-0.22.0/MANIFEST.in +3 -0
  2. {relenv-0.21.1/relenv.egg-info → relenv-0.22.0}/PKG-INFO +1 -1
  3. {relenv-0.21.1 → relenv-0.22.0}/pyproject.toml +8 -0
  4. relenv-0.22.0/relenv/__init__.py +15 -0
  5. {relenv-0.21.1 → relenv-0.22.0}/relenv/__main__.py +12 -6
  6. relenv-0.22.0/relenv/_resources/xz/config.h +148 -0
  7. relenv-0.22.0/relenv/_resources/xz/readme.md +4 -0
  8. {relenv-0.21.1 → relenv-0.22.0}/relenv/build/__init__.py +28 -30
  9. relenv-0.22.0/relenv/build/common/__init__.py +50 -0
  10. relenv-0.22.0/relenv/build/common/_sysconfigdata_template.py +72 -0
  11. relenv-0.22.0/relenv/build/common/builder.py +907 -0
  12. relenv-0.22.0/relenv/build/common/builders.py +163 -0
  13. relenv-0.22.0/relenv/build/common/download.py +324 -0
  14. relenv-0.22.0/relenv/build/common/install.py +609 -0
  15. relenv-0.22.0/relenv/build/common/ui.py +432 -0
  16. relenv-0.22.0/relenv/build/darwin.py +243 -0
  17. {relenv-0.21.1 → relenv-0.22.0}/relenv/build/linux.py +296 -78
  18. relenv-0.22.0/relenv/build/windows.py +473 -0
  19. {relenv-0.21.1 → relenv-0.22.0}/relenv/buildenv.py +48 -17
  20. {relenv-0.21.1 → relenv-0.22.0}/relenv/check.py +10 -5
  21. relenv-0.22.0/relenv/common.py +1169 -0
  22. relenv-0.22.0/relenv/create.py +283 -0
  23. {relenv-0.21.1 → relenv-0.22.0}/relenv/fetch.py +16 -4
  24. {relenv-0.21.1 → relenv-0.22.0}/relenv/manifest.py +15 -7
  25. relenv-0.22.0/relenv/python-versions.json +329 -0
  26. relenv-0.22.0/relenv/pyversions.py +1136 -0
  27. {relenv-0.21.1 → relenv-0.22.0}/relenv/relocate.py +101 -55
  28. {relenv-0.21.1 → relenv-0.22.0}/relenv/runtime.py +452 -253
  29. {relenv-0.21.1 → relenv-0.22.0}/relenv/toolchain.py +9 -3
  30. {relenv-0.21.1 → relenv-0.22.0/relenv.egg-info}/PKG-INFO +1 -1
  31. {relenv-0.21.1 → relenv-0.22.0}/relenv.egg-info/SOURCES.txt +14 -1
  32. {relenv-0.21.1 → relenv-0.22.0}/setup.cfg +2 -1
  33. relenv-0.22.0/tests/__init__.py +2 -0
  34. relenv-0.22.0/tests/_pytest_typing.py +45 -0
  35. relenv-0.22.0/tests/conftest.py +95 -0
  36. relenv-0.22.0/tests/test_build.py +460 -0
  37. relenv-0.22.0/tests/test_common.py +502 -0
  38. relenv-0.22.0/tests/test_create.py +197 -0
  39. {relenv-0.21.1 → relenv-0.22.0}/tests/test_downloads.py +19 -15
  40. {relenv-0.21.1 → relenv-0.22.0}/tests/test_fips_photon.py +6 -3
  41. relenv-0.22.0/tests/test_module_imports.py +44 -0
  42. relenv-0.22.0/tests/test_pyversions_runtime.py +177 -0
  43. {relenv-0.21.1 → relenv-0.22.0}/tests/test_relocate.py +45 -39
  44. relenv-0.22.0/tests/test_relocate_module.py +257 -0
  45. relenv-0.22.0/tests/test_runtime.py +1823 -0
  46. {relenv-0.21.1 → relenv-0.22.0}/tests/test_verify_build.py +500 -34
  47. relenv-0.21.1/MANIFEST.in +0 -2
  48. relenv-0.21.1/relenv/__init__.py +0 -3
  49. relenv-0.21.1/relenv/build/common.py +0 -1609
  50. relenv-0.21.1/relenv/build/darwin.py +0 -129
  51. relenv-0.21.1/relenv/build/windows.py +0 -258
  52. relenv-0.21.1/relenv/common.py +0 -833
  53. relenv-0.21.1/relenv/create.py +0 -143
  54. relenv-0.21.1/relenv/pyversions.py +0 -349
  55. relenv-0.21.1/tests/__init__.py +0 -0
  56. relenv-0.21.1/tests/conftest.py +0 -89
  57. relenv-0.21.1/tests/test_build.py +0 -43
  58. relenv-0.21.1/tests/test_common.py +0 -239
  59. relenv-0.21.1/tests/test_create.py +0 -54
  60. relenv-0.21.1/tests/test_runtime.py +0 -27
  61. {relenv-0.21.1 → relenv-0.22.0}/LICENSE.md +0 -0
  62. {relenv-0.21.1 → relenv-0.22.0}/NOTICE +0 -0
  63. {relenv-0.21.1 → relenv-0.22.0}/README.md +0 -0
  64. {relenv-0.21.1 → relenv-0.22.0}/relenv/_scripts/install_vc_build.ps1 +0 -0
  65. {relenv-0.21.1 → relenv-0.22.0}/relenv.egg-info/dependency_links.txt +0 -0
  66. {relenv-0.21.1 → relenv-0.22.0}/relenv.egg-info/entry_points.txt +0 -0
  67. {relenv-0.21.1 → relenv-0.22.0}/relenv.egg-info/requires.txt +0 -0
  68. {relenv-0.21.1 → relenv-0.22.0}/relenv.egg-info/top_level.txt +0 -0
  69. {relenv-0.21.1 → relenv-0.22.0}/setup.py +0 -0
@@ -0,0 +1,3 @@
1
+ recursive-include relenv/_scripts *
2
+ recursive-include relenv/_resources *
3
+ include relenv/python-versions.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: relenv
3
- Version: 0.21.1
3
+ Version: 0.22.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
@@ -21,3 +21,11 @@ ensure_newline_before_comments=true
21
21
 
22
22
  [tool.pylint]
23
23
  max-line-length=120
24
+
25
+ [tool.mypy]
26
+ python_version = "3.10"
27
+ explicit_package_bases = true
28
+ ignore_missing_imports = true
29
+ namespace_packages = true
30
+ mypy_path = "."
31
+ exclude = "relenv/__main__\\.py"
@@ -0,0 +1,15 @@
1
+ # Copyright 2022-2025 Broadcom.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ from relenv.common import __version__
8
+
9
+ MIN_SUPPORTED_PYTHON = (3, 10)
10
+
11
+ if sys.version_info < MIN_SUPPORTED_PYTHON:
12
+ raise RuntimeError("Relenv requires Python 3.10 or newer.")
13
+
14
+
15
+ __all__ = ["__version__"]
@@ -1,16 +1,20 @@
1
- # Copyright 2023-2025 Broadcom.
2
- # SPDX-License-Identifier: Apache-2
1
+ # Copyright 2022-2025 Broadcom.
2
+ # SPDX-License-Identifier: Apache-2.0
3
3
  """
4
4
  The entrypoint into relenv.
5
5
  """
6
6
 
7
+ from __future__ import annotations
8
+
9
+ import argparse
7
10
  from argparse import ArgumentParser
11
+ from types import ModuleType
8
12
 
9
13
  from . import build, buildenv, check, create, fetch, pyversions, toolchain
10
14
  from .common import __version__
11
15
 
12
16
 
13
- def setup_cli():
17
+ def setup_cli() -> ArgumentParser:
14
18
  """
15
19
  Build the argparser with its subparsers.
16
20
 
@@ -25,9 +29,11 @@ def setup_cli():
25
29
  description="Relenv",
26
30
  )
27
31
  argparser.add_argument("--version", action="version", version=__version__)
28
- subparsers = argparser.add_subparsers()
32
+ subparsers: argparse._SubParsersAction[
33
+ argparse.ArgumentParser
34
+ ] = argparser.add_subparsers()
29
35
 
30
- modules_to_setup = [
36
+ modules_to_setup: list[ModuleType] = [
31
37
  build,
32
38
  toolchain,
33
39
  create,
@@ -42,7 +48,7 @@ def setup_cli():
42
48
  return argparser
43
49
 
44
50
 
45
- def main():
51
+ def main() -> None:
46
52
  """
47
53
  Run the relenv cli and disbatch to subcommands.
48
54
  """
@@ -0,0 +1,148 @@
1
+ /* config.h for compiling liblzma (*not* the whole XZ Utils) with MSVC 2019 */
2
+
3
+ /* Prefix for symbols exported by tuklib_*.c files */
4
+ #define TUKLIB_SYMBOL_PREFIX lzma_
5
+
6
+ /* How many MiB of RAM to assume if the real amount cannot be determined. */
7
+ #define ASSUME_RAM 128
8
+
9
+ /* Define to 1 if crc32 integrity check is enabled. */
10
+ #define HAVE_CHECK_CRC32 1
11
+
12
+ /* Define to 1 if crc64 integrity check is enabled. */
13
+ #define HAVE_CHECK_CRC64 1
14
+
15
+ /* Define to 1 if sha256 integrity check is enabled. */
16
+ #define HAVE_CHECK_SHA256 1
17
+
18
+ /* Define to 1 if any of HAVE_DECODER_foo have been defined. */
19
+ #define HAVE_DECODERS 1
20
+
21
+ /* Define to 1 if arm decoder is enabled. */
22
+ #define HAVE_DECODER_ARM 1
23
+
24
+ /* Define to 1 if armthumb decoder is enabled. */
25
+ #define HAVE_DECODER_ARMTHUMB 1
26
+
27
+ /* Define to 1 if delta decoder is enabled. */
28
+ #define HAVE_DECODER_DELTA 1
29
+
30
+ /* Define to 1 if ia64 decoder is enabled. */
31
+ #define HAVE_DECODER_IA64 1
32
+
33
+ /* Define to 1 if lzma1 decoder is enabled. */
34
+ #define HAVE_DECODER_LZMA1 1
35
+
36
+ /* Define to 1 if lzma2 decoder is enabled. */
37
+ #define HAVE_DECODER_LZMA2 1
38
+
39
+ /* Define to 1 if powerpc decoder is enabled. */
40
+ #define HAVE_DECODER_POWERPC 1
41
+
42
+ /* Define to 1 if sparc decoder is enabled. */
43
+ #define HAVE_DECODER_SPARC 1
44
+
45
+ /* Define to 1 if x86 decoder is enabled. */
46
+ #define HAVE_DECODER_X86 1
47
+
48
+ /* Define to 1 if any of HAVE_ENCODER_foo have been defined. */
49
+ #define HAVE_ENCODERS 1
50
+
51
+ /* Define to 1 if arm encoder is enabled. */
52
+ #define HAVE_ENCODER_ARM 1
53
+
54
+ /* Define to 1 if armthumb encoder is enabled. */
55
+ #define HAVE_ENCODER_ARMTHUMB 1
56
+
57
+ /* Define to 1 if delta encoder is enabled. */
58
+ #define HAVE_ENCODER_DELTA 1
59
+
60
+ /* Define to 1 if ia64 encoder is enabled. */
61
+ #define HAVE_ENCODER_IA64 1
62
+
63
+ /* Define to 1 if lzma1 encoder is enabled. */
64
+ #define HAVE_ENCODER_LZMA1 1
65
+
66
+ /* Define to 1 if lzma2 encoder is enabled. */
67
+ #define HAVE_ENCODER_LZMA2 1
68
+
69
+ /* Define to 1 if powerpc encoder is enabled. */
70
+ #define HAVE_ENCODER_POWERPC 1
71
+
72
+ /* Define to 1 if sparc encoder is enabled. */
73
+ #define HAVE_ENCODER_SPARC 1
74
+
75
+ /* Define to 1 if x86 encoder is enabled. */
76
+ #define HAVE_ENCODER_X86 1
77
+
78
+ /* Define to 1 if you have the <inttypes.h> header file. */
79
+ #define HAVE_INTTYPES_H 1
80
+
81
+ /* Define to 1 if you have the <limits.h> header file. */
82
+ #define HAVE_LIMITS_H 1
83
+
84
+ /* Define to 1 to enable bt2 match finder. */
85
+ #define HAVE_MF_BT2 1
86
+
87
+ /* Define to 1 to enable bt3 match finder. */
88
+ #define HAVE_MF_BT3 1
89
+
90
+ /* Define to 1 to enable bt4 match finder. */
91
+ #define HAVE_MF_BT4 1
92
+
93
+ /* Define to 1 to enable hc3 match finder. */
94
+ #define HAVE_MF_HC3 1
95
+
96
+ /* Define to 1 to enable hc4 match finder. */
97
+ #define HAVE_MF_HC4 1
98
+
99
+ /* Define to 1 if stdbool.h conforms to C99. */
100
+ #define HAVE_STDBOOL_H 1
101
+
102
+ /* Define to 1 if you have the <stdint.h> header file. */
103
+ #define HAVE_STDINT_H 1
104
+
105
+ /* Define to 1 if you have the <stdlib.h> header file. */
106
+ #define HAVE_STDLIB_H 1
107
+
108
+ /* Define to 1 if you have the <string.h> header file. */
109
+ #define HAVE_STRING_H 1
110
+
111
+ /* Define to 1 or 0, depending whether the compiler supports simple visibility
112
+ declarations. */
113
+ #define HAVE_VISIBILITY 0
114
+
115
+ /* Define to 1 if the system has the type `_Bool'. */
116
+ #define HAVE__BOOL 1
117
+
118
+ #ifdef _M_IX86
119
+ /* Define to 1 when using Windows 95 (and thus XP) compatible threads. This
120
+ avoids use of features that were added in Windows Vista.
121
+ This is used for 32-bit x86 builds for compatibility reasons since it
122
+ makes no measurable difference in performance compared to Vista threads. */
123
+ #define MYTHREAD_WIN95 1
124
+ #else
125
+ /* Define to 1 when using Windows Vista compatible threads. This uses features
126
+ that are not available on Windows XP. */
127
+ #define MYTHREAD_VISTA 1
128
+ #endif
129
+
130
+ /* Define to 1 to disable debugging code. */
131
+ #define NDEBUG 1
132
+
133
+ /* Define to the full name of this package. */
134
+ #define PACKAGE_NAME "XZ Utils"
135
+
136
+ /* Define to the home page for this package. */
137
+ #define PACKAGE_URL "https://tukaani.org/xz/"
138
+
139
+ /* The size of `size_t', as computed by sizeof. */
140
+ #ifdef _WIN64
141
+ #define SIZEOF_SIZE_T 8
142
+ #else
143
+ #define SIZEOF_SIZE_T 4
144
+ #endif
145
+
146
+ /* Define to 1 if the system supports fast unaligned access to 16-bit and
147
+ 32-bit integers. */
148
+ #define TUKLIB_FAST_UNALIGNED_ACCESS 1
@@ -0,0 +1,4 @@
1
+ The config.h file was removed from XZ-Utils tarting with version 5.5.0.
2
+ XZ-Utils seems to build just fine with the config.h file from 5.4.7, so we're
3
+ including it here. This will be copied into the src/windows directory in the
4
+ extracted source for XZ-Utils.
@@ -1,22 +1,25 @@
1
1
  # Copyright 2022-2025 Broadcom.
2
- # SPDX-License-Identifier: Apache-2
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # mypy: ignore-errors
3
4
  """
4
- The ``relenv build`` command.
5
+ Entry points for the ``relenv build`` CLI command.
5
6
  """
6
- import sys
7
- import random
7
+ from __future__ import annotations
8
+
9
+ import argparse
8
10
  import codecs
11
+ import random
9
12
  import signal
13
+ import sys
14
+ from types import FrameType, ModuleType
10
15
 
11
- from . import linux, darwin, windows
12
- from .common import builds, CHECK_VERSIONS_SUPPORT
13
-
14
- from ..pyversions import python_versions, Version
15
-
16
- from ..common import build_arch, DEFAULT_PYTHON
16
+ from . import darwin, linux, windows
17
+ from .common import builds
18
+ from ..common import DEFAULT_PYTHON, build_arch
19
+ from ..pyversions import Version, python_versions
17
20
 
18
21
 
19
- def platform_module():
22
+ def platform_module() -> ModuleType:
20
23
  """
21
24
  Return the right module based on `sys.platform`.
22
25
  """
@@ -26,9 +29,12 @@ def platform_module():
26
29
  return linux
27
30
  elif sys.platform == "win32":
28
31
  return windows
32
+ raise RuntimeError(f"Unsupported platform: {sys.platform}")
29
33
 
30
34
 
31
- def setup_parser(subparsers):
35
+ def setup_parser(
36
+ subparsers: argparse._SubParsersAction[argparse.ArgumentParser],
37
+ ) -> None:
32
38
  """
33
39
  Setup the subparser for the ``build`` command.
34
40
 
@@ -100,16 +106,16 @@ def setup_parser(subparsers):
100
106
  ),
101
107
  )
102
108
  build_subparser.add_argument(
103
- "--check-versions",
109
+ "--no-pretty",
104
110
  default=False,
105
111
  action="store_true",
106
- help="Check for new version of python and it's depenencies, then exit.",
112
+ help="Log build output to stdout instead of displaying a simplified status.",
107
113
  )
108
114
  build_subparser.add_argument(
109
- "--no-pretty",
115
+ "--compact-pretty",
110
116
  default=False,
111
117
  action="store_true",
112
- help="Log build output to stdout instead of displaying a simplified status.",
118
+ help="Use compact UI without progress bars (simpler, less detailed).",
113
119
  )
114
120
  build_subparser.add_argument(
115
121
  "--log-level",
@@ -124,7 +130,7 @@ def setup_parser(subparsers):
124
130
  )
125
131
 
126
132
 
127
- def main(args):
133
+ def main(args: argparse.Namespace) -> None:
128
134
  """
129
135
  The entrypoint to the ``build`` command.
130
136
 
@@ -170,18 +176,6 @@ def main(args):
170
176
  build.recipies["python"]["download"].version = str(build_version)
171
177
  build.recipies["python"]["download"].checksum = pyversions[build_version]
172
178
 
173
- if args.check_versions:
174
- if not CHECK_VERSIONS_SUPPORT:
175
- print(
176
- "Check versions not supported. Please install the "
177
- "packaging and looseversion python packages."
178
- )
179
- sys.exit(2)
180
- if not build.check_versions():
181
- sys.exit(1)
182
- else:
183
- sys.exit(0)
184
-
185
179
  build.set_arch(args.arch)
186
180
  if build.build_arch != build.arch:
187
181
  print(
@@ -192,10 +186,13 @@ def main(args):
192
186
  steps = [_.strip() for _ in args.steps]
193
187
  if args.no_pretty:
194
188
  show_ui = False
189
+ expanded_ui = False
195
190
  else:
196
191
  show_ui = True
192
+ # Expanded UI is default, --compact-pretty disables it
193
+ expanded_ui = not args.compact_pretty
197
194
 
198
- def signal_handler(signal, frame):
195
+ def signal_handler(_signal: int, frame: FrameType | None) -> None:
199
196
  sys.exit(1)
200
197
 
201
198
  signal.signal(signal.SIGINT, signal_handler)
@@ -209,4 +206,5 @@ def main(args):
209
206
  download_only=args.download_only,
210
207
  show_ui=show_ui,
211
208
  log_level=args.log_level.upper(),
209
+ expanded_ui=expanded_ui,
212
210
  )
@@ -0,0 +1,50 @@
1
+ # Copyright 2022-2025 Broadcom.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """
4
+ Build process common methods.
5
+
6
+ This module has been split into focused submodules for better organization.
7
+ All public APIs are re-exported here for backward compatibility.
8
+ """
9
+ from __future__ import annotations
10
+
11
+ from .builders import (
12
+ build_openssl,
13
+ build_openssl_fips,
14
+ build_sqlite,
15
+ )
16
+
17
+ from .install import (
18
+ update_ensurepip,
19
+ install_runtime,
20
+ finalize,
21
+ create_archive,
22
+ patch_file,
23
+ update_sbom_checksums,
24
+ )
25
+
26
+ from .builder import (
27
+ Dirs,
28
+ builds,
29
+ get_dependency_version,
30
+ )
31
+
32
+
33
+ __all__ = [
34
+ # Builder classes and instances
35
+ "Dirs",
36
+ "builds",
37
+ # Dependency version management
38
+ "get_dependency_version",
39
+ # Install functions
40
+ "finalize",
41
+ "install_runtime",
42
+ "create_archive",
43
+ "update_ensurepip",
44
+ "patch_file",
45
+ "update_sbom_checksums",
46
+ # Builders (specific build functions)
47
+ "build_openssl",
48
+ "build_openssl_fips",
49
+ "build_sqlite",
50
+ ]
@@ -0,0 +1,72 @@
1
+ # Copyright 2022-2025 Broadcom.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # mypy: ignore-errors
4
+ # flake8: noqa
5
+ """
6
+ Template for sysconfigdata module generated at build time.
7
+
8
+ This file is used as a template to generate the _sysconfigdata module
9
+ that CPython uses at runtime. It is copied verbatim (after the header comments)
10
+ into the generated sysconfigdata file.
11
+
12
+ The _build_time_vars dictionary is written before this content.
13
+
14
+ Note: mypy and flake8 errors are ignored for this template file as it contains
15
+ code that is valid only in the context of the generated sysconfigdata module
16
+ (e.g., _build_time_vars is injected, RelenvException is in generated context).
17
+ """
18
+
19
+ import pathlib
20
+ import sys
21
+ import platform
22
+ import os
23
+ import logging
24
+
25
+ log = logging.getLogger(__name__)
26
+
27
+
28
+ def build_arch():
29
+ machine = platform.machine()
30
+ return machine.lower()
31
+
32
+
33
+ def get_triplet(machine=None, plat=None):
34
+ if not plat:
35
+ plat = sys.platform
36
+ if not machine:
37
+ machine = build_arch()
38
+ if plat == "darwin":
39
+ return f"{machine}-macos"
40
+ elif plat == "win32":
41
+ return f"{machine}-win"
42
+ elif plat == "linux":
43
+ return f"{machine}-linux-gnu"
44
+ else:
45
+ raise RelenvException("Unknown platform {}".format(platform))
46
+
47
+
48
+ pydir = pathlib.Path(__file__).resolve().parent
49
+ if sys.platform == "win32":
50
+ DEFAULT_DATA_DIR = pathlib.Path.home() / "AppData" / "Local" / "relenv"
51
+ else:
52
+ DEFAULT_DATA_DIR = pathlib.Path.home() / ".local" / "relenv"
53
+
54
+ if "RELENV_DATA" in os.environ:
55
+ DATA_DIR = pathlib.Path(os.environ["RELENV_DATA"]).resolve()
56
+ else:
57
+ DATA_DIR = DEFAULT_DATA_DIR
58
+
59
+ buildroot = pydir.parent.parent
60
+
61
+ toolchain = DATA_DIR / "toolchain" / get_triplet()
62
+
63
+ build_time_vars = {}
64
+ for key in _build_time_vars:
65
+ val = _build_time_vars[key]
66
+ orig = val
67
+ if isinstance(val, str):
68
+ val = val.format(
69
+ BUILDROOT=buildroot,
70
+ TOOLCHAIN=toolchain,
71
+ )
72
+ build_time_vars[key] = val