relenv 0.22.0__py3-none-any.whl → 0.22.2__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.
Files changed (46) hide show
  1. relenv/__init__.py +1 -1
  2. relenv/__main__.py +1 -1
  3. relenv/build/__init__.py +21 -25
  4. relenv/build/common/__init__.py +1 -1
  5. relenv/build/common/_sysconfigdata_template.py +1 -1
  6. relenv/build/common/builder.py +1 -1
  7. relenv/build/common/builders.py +1 -1
  8. relenv/build/common/download.py +1 -1
  9. relenv/build/common/install.py +6 -2
  10. relenv/build/common/ui.py +1 -1
  11. relenv/build/darwin.py +1 -1
  12. relenv/build/linux.py +1 -1
  13. relenv/build/windows.py +1 -1
  14. relenv/buildenv.py +1 -1
  15. relenv/check.py +1 -1
  16. relenv/common.py +5 -4
  17. relenv/create.py +19 -27
  18. relenv/fetch.py +7 -5
  19. relenv/manifest.py +1 -1
  20. relenv/python-versions.json +347 -326
  21. relenv/pyversions.py +49 -1
  22. relenv/relocate.py +34 -2
  23. relenv/runtime.py +6 -1
  24. relenv/toolchain.py +1 -1
  25. {relenv-0.22.0.dist-info → relenv-0.22.2.dist-info}/METADATA +1 -1
  26. relenv-0.22.2.dist-info/RECORD +48 -0
  27. tests/__init__.py +1 -1
  28. tests/_pytest_typing.py +1 -1
  29. tests/conftest.py +1 -1
  30. tests/test_build.py +1 -1
  31. tests/test_common.py +64 -2
  32. tests/test_create.py +1 -1
  33. tests/test_downloads.py +1 -1
  34. tests/test_fips_photon.py +1 -1
  35. tests/test_module_imports.py +1 -1
  36. tests/test_pyversions_runtime.py +78 -1
  37. tests/test_relocate.py +86 -1
  38. tests/test_relocate_module.py +1 -1
  39. tests/test_runtime.py +167 -1
  40. tests/test_verify_build.py +7 -5
  41. relenv-0.22.0.dist-info/RECORD +0 -48
  42. {relenv-0.22.0.dist-info → relenv-0.22.2.dist-info}/WHEEL +0 -0
  43. {relenv-0.22.0.dist-info → relenv-0.22.2.dist-info}/entry_points.txt +0 -0
  44. {relenv-0.22.0.dist-info → relenv-0.22.2.dist-info}/licenses/LICENSE.md +0 -0
  45. {relenv-0.22.0.dist-info → relenv-0.22.2.dist-info}/licenses/NOTICE +0 -0
  46. {relenv-0.22.0.dist-info → relenv-0.22.2.dist-info}/top_level.txt +0 -0
tests/test_runtime.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2022-2025 Broadcom.
1
+ # Copyright 2022-2026 Broadcom.
2
2
  # SPDX-License-Identifier: Apache-2.0
3
3
  #
4
4
  from __future__ import annotations
@@ -1821,3 +1821,169 @@ def test_load_openssl_provider_linux(monkeypatch: pytest.MonkeyPatch) -> None:
1821
1821
  )
1822
1822
  monkeypatch.setattr(relenv.runtime.sys, "platform", "linux", raising=False)
1823
1823
  assert relenv.runtime.load_openssl_provider("default") == 456
1824
+
1825
+
1826
+ def test_sysconfig_wrapper_applied_for_python_313_plus(
1827
+ monkeypatch: pytest.MonkeyPatch,
1828
+ ) -> None:
1829
+ """
1830
+ Test that sysconfig wrapper is applied for Python 3.13+.
1831
+
1832
+ This is a regression test for Python 3.13 where sysconfig changed from
1833
+ a single module to a package. The RelenvImporter no longer intercepts
1834
+ the import automatically, so we must manually apply the wrapper.
1835
+
1836
+ Without this fix, Python 3.13+ would use the toolchain gcc with full path
1837
+ even when RELENV_BUILDENV is not set, causing build failures with packages
1838
+ like mysqlclient that compile native extensions.
1839
+ """
1840
+ # Simulate Python 3.13+
1841
+ fake_version = (3, 13, 0, "final", 0)
1842
+ monkeypatch.setattr(relenv.runtime.sys, "version_info", fake_version)
1843
+
1844
+ # Track whether wrap_sysconfig was called
1845
+ wrap_called = {"count": 0, "module_name": None}
1846
+
1847
+ def fake_wrap_sysconfig(name: str) -> ModuleType:
1848
+ wrap_called["count"] += 1
1849
+ wrap_called["module_name"] = name
1850
+ return ModuleType("sysconfig")
1851
+
1852
+ monkeypatch.setattr(relenv.runtime, "wrap_sysconfig", fake_wrap_sysconfig)
1853
+
1854
+ # Mock other dependencies to avoid side effects
1855
+ monkeypatch.setattr(relenv.runtime, "relenv_root", lambda: pathlib.Path("/root"))
1856
+ monkeypatch.setattr(relenv.runtime, "setup_openssl", lambda: None)
1857
+ monkeypatch.setattr(relenv.runtime, "setup_crossroot", lambda: None)
1858
+ monkeypatch.setattr(relenv.runtime, "install_cargo_config", lambda: None)
1859
+ monkeypatch.setattr(
1860
+ relenv.runtime.site, "execsitecustomize", lambda: None, raising=False
1861
+ )
1862
+ monkeypatch.setattr(
1863
+ relenv.runtime, "wrapsitecustomize", lambda func: func, raising=False
1864
+ )
1865
+
1866
+ # Mock importer
1867
+ fake_importer = SimpleNamespace()
1868
+ monkeypatch.setattr(relenv.runtime, "importer", fake_importer, raising=False)
1869
+
1870
+ # Clear sys.meta_path to avoid side effects
1871
+ original_meta_path = sys.meta_path.copy()
1872
+ monkeypatch.setattr(sys, "meta_path", [])
1873
+
1874
+ try:
1875
+ # Execute the module initialization code at the end of runtime.py
1876
+ # This simulates what happens when the runtime module is imported
1877
+ exec(
1878
+ """
1879
+ import sys
1880
+ sys.RELENV = relenv_root()
1881
+ setup_openssl()
1882
+ site.execsitecustomize = wrapsitecustomize(site.execsitecustomize)
1883
+ setup_crossroot()
1884
+ install_cargo_config()
1885
+ sys.meta_path = [importer] + sys.meta_path
1886
+
1887
+ # For Python 3.13+, sysconfig became a package so the importer doesn't
1888
+ # intercept it. Manually wrap it here.
1889
+ if sys.version_info >= (3, 13):
1890
+ wrap_sysconfig("sysconfig")
1891
+ """,
1892
+ {
1893
+ "sys": relenv.runtime.sys,
1894
+ "relenv_root": relenv.runtime.relenv_root,
1895
+ "setup_openssl": relenv.runtime.setup_openssl,
1896
+ "site": relenv.runtime.site,
1897
+ "wrapsitecustomize": relenv.runtime.wrapsitecustomize,
1898
+ "setup_crossroot": relenv.runtime.setup_crossroot,
1899
+ "install_cargo_config": relenv.runtime.install_cargo_config,
1900
+ "importer": fake_importer,
1901
+ "wrap_sysconfig": fake_wrap_sysconfig,
1902
+ },
1903
+ )
1904
+
1905
+ # Verify wrap_sysconfig was called for Python 3.13+
1906
+ assert wrap_called["count"] == 1
1907
+ assert wrap_called["module_name"] == "sysconfig"
1908
+
1909
+ finally:
1910
+ # Restore original meta_path
1911
+ monkeypatch.setattr(sys, "meta_path", original_meta_path)
1912
+
1913
+
1914
+ def test_sysconfig_wrapper_not_applied_for_python_312(
1915
+ monkeypatch: pytest.MonkeyPatch,
1916
+ ) -> None:
1917
+ """
1918
+ Test that sysconfig wrapper is NOT applied for Python 3.12 and earlier.
1919
+
1920
+ For Python 3.12 and earlier, sysconfig is a single module file and the
1921
+ RelenvImporter intercepts it automatically. We should not manually wrap
1922
+ it to avoid double-wrapping.
1923
+ """
1924
+ # Simulate Python 3.12
1925
+ fake_version = (3, 12, 0, "final", 0)
1926
+ monkeypatch.setattr(relenv.runtime.sys, "version_info", fake_version)
1927
+
1928
+ # Track whether wrap_sysconfig was called
1929
+ wrap_called = {"count": 0}
1930
+
1931
+ def fake_wrap_sysconfig(name: str) -> ModuleType:
1932
+ wrap_called["count"] += 1
1933
+ return ModuleType("sysconfig")
1934
+
1935
+ monkeypatch.setattr(relenv.runtime, "wrap_sysconfig", fake_wrap_sysconfig)
1936
+
1937
+ # Mock other dependencies
1938
+ monkeypatch.setattr(relenv.runtime, "relenv_root", lambda: pathlib.Path("/root"))
1939
+ monkeypatch.setattr(relenv.runtime, "setup_openssl", lambda: None)
1940
+ monkeypatch.setattr(relenv.runtime, "setup_crossroot", lambda: None)
1941
+ monkeypatch.setattr(relenv.runtime, "install_cargo_config", lambda: None)
1942
+ monkeypatch.setattr(
1943
+ relenv.runtime.site, "execsitecustomize", lambda: None, raising=False
1944
+ )
1945
+ monkeypatch.setattr(
1946
+ relenv.runtime, "wrapsitecustomize", lambda func: func, raising=False
1947
+ )
1948
+
1949
+ fake_importer = SimpleNamespace()
1950
+ monkeypatch.setattr(relenv.runtime, "importer", fake_importer, raising=False)
1951
+
1952
+ original_meta_path = sys.meta_path.copy()
1953
+ monkeypatch.setattr(sys, "meta_path", [])
1954
+
1955
+ try:
1956
+ # Execute the module initialization code
1957
+ exec(
1958
+ """
1959
+ import sys
1960
+ sys.RELENV = relenv_root()
1961
+ setup_openssl()
1962
+ site.execsitecustomize = wrapsitecustomize(site.execsitecustomize)
1963
+ setup_crossroot()
1964
+ install_cargo_config()
1965
+ sys.meta_path = [importer] + sys.meta_path
1966
+
1967
+ # For Python 3.13+, sysconfig became a package so the importer doesn't
1968
+ # intercept it. Manually wrap it here.
1969
+ if sys.version_info >= (3, 13):
1970
+ wrap_sysconfig("sysconfig")
1971
+ """,
1972
+ {
1973
+ "sys": relenv.runtime.sys,
1974
+ "relenv_root": relenv.runtime.relenv_root,
1975
+ "setup_openssl": relenv.runtime.setup_openssl,
1976
+ "site": relenv.runtime.site,
1977
+ "wrapsitecustomize": relenv.runtime.wrapsitecustomize,
1978
+ "setup_crossroot": relenv.runtime.setup_crossroot,
1979
+ "install_cargo_config": relenv.runtime.install_cargo_config,
1980
+ "importer": fake_importer,
1981
+ "wrap_sysconfig": fake_wrap_sysconfig,
1982
+ },
1983
+ )
1984
+
1985
+ # Verify wrap_sysconfig was NOT called for Python 3.12
1986
+ assert wrap_called["count"] == 0
1987
+
1988
+ finally:
1989
+ monkeypatch.setattr(sys, "meta_path", original_meta_path)
@@ -1,4 +1,4 @@
1
- # Copyright 2022-2025 Broadcom.
1
+ # Copyright 2022-2026 Broadcom.
2
2
  # SPDX-License-Identifier: Apache-2.0
3
3
  # mypy: ignore-errors
4
4
  """
@@ -180,13 +180,15 @@ def test_imports(pyexec):
180
180
 
181
181
 
182
182
  def test_pip_install_salt_git(pipexec, build, build_dir, pyexec, build_version):
183
- if (
184
- sys.platform == "win32"
185
- and "3.11" in build_version
183
+ if sys.platform == "win32" and (
184
+ "3.10" in build_version
185
+ or "3.11" in build_version
186
186
  or "3.12" in build_version
187
187
  or "3.13" in build_version
188
188
  ):
189
- pytest.xfail("Salt does not work with 3.11 or 3.12 on windows yet")
189
+ pytest.xfail(
190
+ "Salt git install fails on Windows (setup.py tries to install missing man pages)"
191
+ )
190
192
  if sys.platform == "darwin" and "3.12" in build_version:
191
193
  pytest.xfail("Salt does not work with 3.12 on macos yet")
192
194
  if sys.platform == "darwin" and "3.13" in build_version:
@@ -1,48 +0,0 @@
1
- relenv/__init__.py,sha256=JGbn7yb2-o9LBupMRzj1RYcvMWC6eB8yJv76NHCM0-w,325
2
- relenv/__main__.py,sha256=6N3x5KYX02c2xLWvvtmmLjpcG5Oi2yt9DvP0UW4srM8,1538
3
- relenv/buildenv.py,sha256=MioqMak_bjA5lhKUU8NDyJOFvjv7MoGY2S7PJld-vyA,4120
4
- relenv/check.py,sha256=KnYu60lKud9bwAyUKEzSn5MNBHpA6e3D_pGe_Toml70,1133
5
- relenv/common.py,sha256=vmQjI3g99hqdZ-9zpzWl_xn7L7V5W1FkgA3aQysbVgk,35731
6
- relenv/create.py,sha256=8Pxqc5rrOER8iWiOMFwA6b0oG7il6fICyjhGh4h2uw0,8383
7
- relenv/fetch.py,sha256=6kIla7zOV43r-1NAXzOg4TFGH6z0vPOcF99SkneGSPA,2567
8
- relenv/manifest.py,sha256=W2QTjPsDHlm4OLUpL1bwIGvlNpJijhh1LDYidqCm538,1057
9
- relenv/python-versions.json,sha256=ZuNUnq1uEYH7c-KYivsQAIeK1l1Z7dZTcVoBD-N9BV0,14694
10
- relenv/pyversions.py,sha256=8SnFqHdtb0Lrp4JH7Ri6h-YHJngroh8SOL1chHn3GjY,41276
11
- relenv/relocate.py,sha256=Xfmr1lTMu7DwB8SdMIYQFFfC5La5je8Z33G4md557ew,13182
12
- relenv/runtime.py,sha256=9lrQ2MZqSe2UE0oSsLfyPpMwtubcKbdVwdzOhmVOZsc,39844
13
- relenv/toolchain.py,sha256=wRRtgDfkOsvY6N1wQQWf7cc7SRXaFBsO_gxIK8mfjOM,929
14
- relenv/_resources/xz/config.h,sha256=2IofvMqyAa8xBaQb6QGStiUugMmjyUCq_Of5drh7fro,4117
15
- relenv/_resources/xz/readme.md,sha256=aOs7hz9RhTnTwHUt6gbO-2Sl0xLKIJp8-w6Du4VIFgY,258
16
- relenv/_scripts/install_vc_build.ps1,sha256=ir1bcz7rNOuFw4E5_AqBidiKS0SpPViXW7zaanRPCoM,7629
17
- relenv/build/__init__.py,sha256=Wfs38kXJTKJodtWLAvAUeEOrVnu0ss-krzv2ICM7XnI,6341
18
- relenv/build/darwin.py,sha256=OvsTmpKq87WILxkmjP0aDdUv8lh3DadJ5MwRqPyXXK0,7131
19
- relenv/build/linux.py,sha256=S5v4jp4_nCYN3H5h_fel-VbjQcuY_XfZqBeFWdS6qjo,26156
20
- relenv/build/windows.py,sha256=b1hxd8NmmbvblB8W7-qu_b1_TdMQBNl3Vee-C-edUHc,16102
21
- relenv/build/common/__init__.py,sha256=YzSyjBpW6StrbiQ4Q0CCT4Iaj-wok2ZtuaHW4cCheDE,1004
22
- relenv/build/common/_sysconfigdata_template.py,sha256=six70jAkN_4eBP4aKrJhABu9hXMxudUE6ccNQbQT-J8,1955
23
- relenv/build/common/builder.py,sha256=RaRlWMeShYRcTvT47ry135cpeqhEJ_lMwHZeMtZCuGM,31000
24
- relenv/build/common/builders.py,sha256=sEwJu9HApcPwp2nSrDHvX42Jc8W3dqRqo4Kt9D2mNdo,4772
25
- relenv/build/common/download.py,sha256=jHuIrc5jhDGoa4lWGMYdrO6FsYxJvmiuTVhjDzs7ogc,10479
26
- relenv/build/common/install.py,sha256=1s8cl2GV8yauGAIyAqsOvAWZEorWPPI_hrHkk3Oy9_4,19201
27
- relenv/build/common/ui.py,sha256=j14BE0uFqa5u8XoSBfphSW38XSwboi4StMJ81gLgkkQ,14192
28
- relenv-0.22.0.dist-info/licenses/LICENSE.md,sha256=T0SRk3vJM1YcAJjDz9vsX9gsCRatAVSBS7LeU0tklRM,9919
29
- relenv-0.22.0.dist-info/licenses/NOTICE,sha256=Ns0AybPHBsgJKJJfjE6YnGgWEQQ9F7lQ6QNlYLlQT3E,548
30
- tests/__init__.py,sha256=PFmZ0Etkh3YyYMcTEuVClZE9LTIC_7LYZQ-U6TpFO-g,70
31
- tests/_pytest_typing.py,sha256=aTeDhNtOJCKhwkZ-BP560Zi4Jkac_Ylv1RimBpNGtMA,1204
32
- tests/conftest.py,sha256=inPHwb4duz33BzIxfPoH3z3PK_dbMCbtytUZU785NPk,2628
33
- tests/test_build.py,sha256=48-4ZWdDk8oCHiWcGhhWoPwyqOhZNrSfXrEsXZuhfmw,14992
34
- tests/test_common.py,sha256=n2JDIvJWvu_EjFt-S7kN-zv7hVfpPAc2jnP97TyUm4E,15824
35
- tests/test_create.py,sha256=rjJ7mvInJXqn0r3a5D_q6zzftR4pkzI7M-ipkR5qD9U,6849
36
- tests/test_downloads.py,sha256=OJViW_atWbQiAUhHImIp4dU7U4hNoJQVDEFD-0hSHx8,3528
37
- tests/test_fips_photon.py,sha256=LD6a3jUmMmNrERoDPYgW63ts1Dy48aMr4eZpzkGcixE,1397
38
- tests/test_module_imports.py,sha256=RhwPeUvdKLvuFcZSxCt2WCu81SKTjykaunrrN1sORpw,1354
39
- tests/test_pyversions_runtime.py,sha256=utmG3CLP061AIbAqRE0n6mVqsQ2DCZDc54LUz3SOQts,5980
40
- tests/test_relocate.py,sha256=TAYARIL5VRCEPwz1HL1BJpvUSS6RQkk4D0DqGag7rv4,9694
41
- tests/test_relocate_module.py,sha256=G_KQqR5d7y7WCru_c2fPZKplhtzKgAJX9QONEQmzUAI,7802
42
- tests/test_runtime.py,sha256=Ih7KquGZjWjBHot21kbYqQaaeRYHId-qwdNKVp_9bgo,65809
43
- tests/test_verify_build.py,sha256=G4HsBbtHCYgBGX1KFKbm3_cskJZcQT6m4hBfZOeltig,67750
44
- relenv-0.22.0.dist-info/METADATA,sha256=E8RjqcMC4CJDuvwPiLVWoY1-xi9Vq_xQ_4CGSjxrXfk,1360
45
- relenv-0.22.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
- relenv-0.22.0.dist-info/entry_points.txt,sha256=dO66nWPPWl8ALWWnZFlHKAo6mfPFuQid7purYWL2ddc,48
47
- relenv-0.22.0.dist-info/top_level.txt,sha256=P4Ro6JLZE53ZdsQ76o2OzBcpb0MaVJmbfr0HAn9WF8M,13
48
- relenv-0.22.0.dist-info/RECORD,,