portable-python 2.1.0__tar.gz → 2.2.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 (99) hide show
  1. {portable_python-2.1.0 → portable_python-2.2.0}/.github/workflows/release.yml +1 -1
  2. {portable_python-2.1.0 → portable_python-2.2.0}/.github/workflows/tests.yml +2 -2
  3. {portable_python-2.1.0 → portable_python-2.2.0}/CHANGELOG.md +26 -0
  4. {portable_python-2.1.0 → portable_python-2.2.0}/PKG-INFO +1 -1
  5. {portable_python-2.1.0 → portable_python-2.2.0}/docs/architecture/cpython.md +6 -1
  6. {portable_python-2.1.0 → portable_python-2.2.0}/docs/log.md +4 -0
  7. {portable_python-2.1.0 → portable_python-2.2.0}/requirements.txt +12 -10
  8. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/__init__.py +10 -10
  9. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/cpython.py +50 -2
  10. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/external/xcpython.py +16 -9
  11. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python.egg-info/PKG-INFO +1 -1
  12. portable_python-2.2.0/src/portable_python.egg-info/scm_version.json +8 -0
  13. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_build.py +49 -1
  14. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_failed.py +1 -1
  15. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_report.py +1 -1
  16. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_setup.py +1 -1
  17. portable_python-2.1.0/src/portable_python.egg-info/scm_version.json +0 -8
  18. {portable_python-2.1.0 → portable_python-2.2.0}/.dockerignore +0 -0
  19. {portable_python-2.1.0 → portable_python-2.2.0}/.gitignore +0 -0
  20. {portable_python-2.1.0 → portable_python-2.2.0}/CLAUDE.md +0 -0
  21. {portable_python-2.1.0 → portable_python-2.2.0}/Dockerfile +0 -0
  22. {portable_python-2.1.0 → portable_python-2.2.0}/LICENSE +0 -0
  23. {portable_python-2.1.0 → portable_python-2.2.0}/MANIFEST.in +0 -0
  24. {portable_python-2.1.0 → portable_python-2.2.0}/README.rst +0 -0
  25. {portable_python-2.1.0 → portable_python-2.2.0}/docs/architecture/build-setup.md +0 -0
  26. {portable_python-2.1.0 → portable_python-2.2.0}/docs/architecture/config.md +0 -0
  27. {portable_python-2.1.0 → portable_python-2.2.0}/docs/architecture/index.md +0 -0
  28. {portable_python-2.1.0 → portable_python-2.2.0}/docs/architecture/module-builder.md +0 -0
  29. {portable_python-2.1.0 → portable_python-2.2.0}/docs/architecture/ppg.md +0 -0
  30. {portable_python-2.1.0 → portable_python-2.2.0}/docs/architecture/python-builder.md +0 -0
  31. {portable_python-2.1.0 → portable_python-2.2.0}/docs/architecture/python-inspector.md +0 -0
  32. {portable_python-2.1.0 → portable_python-2.2.0}/docs/cli/build-report.md +0 -0
  33. {portable_python-2.1.0 → portable_python-2.2.0}/docs/cli/build.md +0 -0
  34. {portable_python-2.1.0 → portable_python-2.2.0}/docs/cli/diagnostics.md +0 -0
  35. {portable_python-2.1.0 → portable_python-2.2.0}/docs/cli/index.md +0 -0
  36. {portable_python-2.1.0 → portable_python-2.2.0}/docs/cli/inspect.md +0 -0
  37. {portable_python-2.1.0 → portable_python-2.2.0}/docs/cli/lib-auto-correct.md +0 -0
  38. {portable_python-2.1.0 → portable_python-2.2.0}/docs/cli/list.md +0 -0
  39. {portable_python-2.1.0 → portable_python-2.2.0}/docs/cli/recompress.md +0 -0
  40. {portable_python-2.1.0 → portable_python-2.2.0}/docs/concepts/build-layout.md +0 -0
  41. {portable_python-2.1.0 → portable_python-2.2.0}/docs/concepts/folder-masking.md +0 -0
  42. {portable_python-2.1.0 → portable_python-2.2.0}/docs/concepts/index.md +0 -0
  43. {portable_python-2.1.0 → portable_python-2.2.0}/docs/concepts/portability.md +0 -0
  44. {portable_python-2.1.0 → portable_python-2.2.0}/docs/concepts/ppp-marker.md +0 -0
  45. {portable_python-2.1.0 → portable_python-2.2.0}/docs/concepts/static-linking.md +0 -0
  46. {portable_python-2.1.0 → portable_python-2.2.0}/docs/concepts/telltale-detection.md +0 -0
  47. {portable_python-2.1.0 → portable_python-2.2.0}/docs/configuration/index.md +0 -0
  48. {portable_python-2.1.0 → portable_python-2.2.0}/docs/configuration/portable-python-yml.md +0 -0
  49. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/add-a-config-option.md +0 -0
  50. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/add-an-external-module.md +0 -0
  51. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/build-a-portable-python.md +0 -0
  52. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/bump-components.md +0 -0
  53. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/bump-python-support.md +0 -0
  54. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/ci-cd.md +0 -0
  55. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/fix-a-portability-issue.md +0 -0
  56. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/index.md +0 -0
  57. {portable_python-2.1.0 → portable_python-2.2.0}/docs/guides/local-development.md +0 -0
  58. {portable_python-2.1.0 → portable_python-2.2.0}/docs/index.md +0 -0
  59. {portable_python-2.1.0 → portable_python-2.2.0}/docs/modules/external-modules.md +0 -0
  60. {portable_python-2.1.0 → portable_python-2.2.0}/docs/modules/index.md +0 -0
  61. {portable_python-2.1.0 → portable_python-2.2.0}/docs/overview.md +0 -0
  62. {portable_python-2.1.0 → portable_python-2.2.0}/docs/release.md +0 -0
  63. {portable_python-2.1.0 → portable_python-2.2.0}/docs/typecheck-findings.md +0 -0
  64. {portable_python-2.1.0 → portable_python-2.2.0}/lock-deps.sh +0 -0
  65. {portable_python-2.1.0 → portable_python-2.2.0}/portable-python.yml +0 -0
  66. {portable_python-2.1.0 → portable_python-2.2.0}/pyproject.toml +0 -0
  67. {portable_python-2.1.0 → portable_python-2.2.0}/retired/README.md +0 -0
  68. {portable_python-2.1.0 → portable_python-2.2.0}/retired/toolchain.py +0 -0
  69. {portable_python-2.1.0 → portable_python-2.2.0}/scripts/bashrc.sh +0 -0
  70. {portable_python-2.1.0 → portable_python-2.2.0}/scripts/check_okf.py +0 -0
  71. {portable_python-2.1.0 → portable_python-2.2.0}/scripts/portable-python.sh +0 -0
  72. {portable_python-2.1.0 → portable_python-2.2.0}/setup.cfg +0 -0
  73. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/__main__.py +0 -0
  74. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/cli.py +0 -0
  75. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/config.py +0 -0
  76. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/external/__init__.py +0 -0
  77. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/external/_inspect.py +0 -0
  78. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/external/xtkinter.py +0 -0
  79. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/inspector.py +0 -0
  80. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/tracking.py +0 -0
  81. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python/versions.py +0 -0
  82. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python.egg-info/SOURCES.txt +0 -0
  83. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python.egg-info/dependency_links.txt +0 -0
  84. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python.egg-info/entry_points.txt +0 -0
  85. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python.egg-info/requires.txt +0 -0
  86. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python.egg-info/scm_file_list.json +0 -0
  87. {portable_python-2.1.0 → portable_python-2.2.0}/src/portable_python.egg-info/top_level.txt +0 -0
  88. {portable_python-2.1.0 → portable_python-2.2.0}/tests/__init__.py +0 -0
  89. {portable_python-2.1.0 → portable_python-2.2.0}/tests/conftest.py +0 -0
  90. {portable_python-2.1.0 → portable_python-2.2.0}/tests/sample-config1.yml +0 -0
  91. {portable_python-2.1.0 → portable_python-2.2.0}/tests/sample-config2.yml +0 -0
  92. {portable_python-2.1.0 → portable_python-2.2.0}/tests/sample-incomplete.yml +0 -0
  93. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_cleanup.py +0 -0
  94. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_inspector.py +0 -0
  95. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_invoker.py +0 -0
  96. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_list.py +0 -0
  97. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_prefix.py +0 -0
  98. {portable_python-2.1.0 → portable_python-2.2.0}/tests/test_recompress.py +0 -0
  99. {portable_python-2.1.0 → portable_python-2.2.0}/tox.ini +0 -0
@@ -19,7 +19,7 @@ jobs:
19
19
  with:
20
20
  python-version: "3.14"
21
21
 
22
- - uses: astral-sh/setup-uv@v10.3.0
22
+ - uses: astral-sh/setup-uv@v10.4.2
23
23
  - run: uvx --with tox-uv tox -e py,style,ty,pyrefly,pyright,mypy,zuban
24
24
  - run: uv build
25
25
  - name: Publish to PyPI
@@ -26,7 +26,7 @@ jobs:
26
26
  with:
27
27
  python-version: ${{ matrix.python-version }}
28
28
 
29
- - uses: astral-sh/setup-uv@v10.3.0
29
+ - uses: astral-sh/setup-uv@v10.4.2
30
30
  - run: uvx --with tox-uv tox -e py
31
31
 
32
32
  - uses: coverallsapp/github-action@v2
@@ -55,5 +55,5 @@ jobs:
55
55
  with:
56
56
  python-version: "3.14"
57
57
 
58
- - uses: astral-sh/setup-uv@v10.3.0
58
+ - uses: astral-sh/setup-uv@v10.4.2
59
59
  - run: uvx --with tox-uv tox -e style,ty,pyrefly,pyright,mypy,zuban
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.2.0
4
+
5
+ ### Fixed
6
+
7
+ - `sysconfig` refers to the C++ compiler by name (`CXX`, `LDCXXSHARED`), as it does for the C compiler, instead of by the build host path where `./configure` found it. Since python 3.14.6, that path could be a build-host-only wrapper such as `/usr/lib/ccache/g++`, making C++ extension builds fail on hosts without it. A compiler wrapper (`ccache`, `sccache`, `distcc`) explicitly configured into `sysconfig` is reported with a warning.
8
+
9
+ ### Bundled components
10
+
11
+ | Component | Version | Why |
12
+ |-----------|---------|-----|
13
+ | OpenSSL | 3.5.9 → 3.5.10 | Security patch release, staying on the 3.5 LTS line |
14
+ | libffi | 3.8.0 → 3.8.2 | Patch releases with security fixes |
15
+ | xz | 5.8.4 → 5.8.5 | Security fixes |
16
+ | SQLite | 3.53.4 → 3.54.1 | New line, now past its `.0` |
17
+ | zlib | 1.3.2 → 1.4 | Several CVE fixes, breaking changes affect CMake/MSVC/Cygwin builds only |
18
+ | zstd | 1.5.7 → 1.6.0 | CVE fix release, "highly recommended" upstream |
19
+
20
+ These match [python-build-standalone](https://github.com/astral-sh/python-build-standalone)'s current choices, including the move to the zlib 1.4 and zstd 1.6.0 lines, except xz (5.8.5 is a security release newer than theirs).
21
+ Every other component was re-checked against upstream: already current, or deliberately held back (see the `version` property comments).
22
+
23
+ ### Changed
24
+
25
+ - Library use: `ModuleBuilder.version` is now always a `Version` (external modules used to report a `str`)
26
+
27
+ _Also: refreshed the dependency lock, bumped `astral-sh/setup-uv` in CI._
28
+
3
29
  ## v2.1.0
4
30
 
5
31
  - portable-python's code is now checked by multiple type checkers on every change
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: portable-python
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Portable python binaries
5
5
  Author-email: Zoran Simic <zoran@simicweb.com>
6
6
  License-Expression: MIT
@@ -3,7 +3,7 @@ type: Class
3
3
  title: Cpython
4
4
  description: The concrete PythonBuilder that compiles CPython — configure/make/install, optimization flags, and the finalize step that makes the install relocatable.
5
5
  tags: [class, cpython, build, finalize]
6
- timestamp: 2026-06-23T00:00:00Z
6
+ timestamp: 2026-12-03T00:00:00Z
7
7
  ---
8
8
 
9
9
  # Cpython
@@ -14,6 +14,11 @@ The concrete [`PythonBuilder`](/architecture/python-builder.md) that compiles CP
14
14
 
15
15
  CPython is configured purely through flags — never source patches (the [no-patches principle](/overview.md)). Defaults come from `cpython-configure` in [config](/configuration/portable-python-yml.md) (optimizations, LTO, ensurepip), plus computed flags that point the build at the statically-compiled [deps](/concepts/static-linking.md).
16
16
 
17
+ Right after `./configure`, the compiler commands it recorded in the generated `Makefile` (which become `sysconfig`'s `CC`, `CXX`, `LDSHARED`, `LDCXXSHARED`, used to build extensions on the user's machine) are groomed:
18
+
19
+ - `./configure` looks up the C++ compiler on `PATH`, so a missing one is noticed at configure time, and records it by the absolute path where it found it. That path is specific to the build host: for example `/usr/lib/ccache/g++` when a compiler cache masquerade folder is first on `PATH`. A portable python builds extensions on other hosts, so `CXX` refers to the compiler by name instead (as `CC` does), to be found on that host's `PATH`. The build is unchanged: on the build host, that name resolves to the same path, ccache included. A `CXX` set by the user is left alone.
20
+ - A compiler wrapper (`ccache`, `sccache`, `distcc`) that still ends up in `sysconfig`, for example via an explicit `CC="ccache gcc"`, is reported with a warning.
21
+
17
22
  ## Finalize — making it relocatable
18
23
 
19
24
  After `make install`, a portable build's interpreter still thinks it lives at the placeholder [`/ppp-marker/{version}`](/concepts/ppp-marker.md). Finalizing turns it into a [portable](/concepts/portability.md) install:
@@ -1,5 +1,9 @@
1
1
  # Knowledge Bundle Update Log
2
2
 
3
+ ## 2026-12-03
4
+
5
+ * **Update**: [Cpython](/architecture/cpython.md): `sysconfig` refers to the C++ compiler by name rather than by its build host path, and compiler wrappers recorded in `sysconfig` are reported with a warning.
6
+
3
7
  ## 2026-10-09
4
8
 
5
9
  * **Update**: [Configuration](/configuration/portable-python-yml.md): `{module}-configure` substitutes `$lib_dir` and `$lib64_dir` (not `$deps_lib`), and its value is split into separate args.
@@ -1,22 +1,24 @@
1
1
  # This file was autogenerated by uv via the following command:
2
2
  # uv pip compile pyproject.toml --universal -o requirements.txt --python-version 3.10 --group dev
3
- certifi==2026.10.19
3
+ certifi==2026.11.20
4
4
  # via requests
5
- charset-normalizer==3.5.2
5
+ charset-normalizer==3.5.3
6
6
  # via requests
7
- click==8.5.0
7
+ click==8.5.1
8
8
  # via portable-python (pyproject.toml)
9
9
  colorama==0.4.6 ; sys_platform == 'win32'
10
10
  # via pytest
11
- coverage==7.16.2
11
+ coverage==7.16.2 ; python_full_version < '3.11'
12
12
  # via pytest-cov
13
- exceptiongroup==1.3.1 ; python_full_version < '3.11'
13
+ coverage==7.18.0 ; python_full_version >= '3.11'
14
+ # via pytest-cov
15
+ exceptiongroup==1.3.2 ; python_full_version < '3.11'
14
16
  # via pytest
15
17
  idna==3.20
16
18
  # via requests
17
19
  iniconfig==2.3.1
18
20
  # via pytest
19
- packaging==26.3
21
+ packaging==26.4
20
22
  # via pytest
21
23
  pluggy==1.7.0
22
24
  # via
@@ -24,17 +26,17 @@ pluggy==1.7.0
24
26
  # pytest-cov
25
27
  pygments==2.21.0
26
28
  # via pytest
27
- pytest==9.1.1
29
+ pytest==9.2.0
28
30
  # via pytest-cov
29
31
  pytest-cov==7.1.0
30
32
  # via portable-python (pyproject.toml:dev)
31
- pyyaml==6.0.3
33
+ pyyaml==6.0.4
32
34
  # via portable-python (pyproject.toml)
33
35
  requests==2.34.2
34
36
  # via portable-python (pyproject.toml)
35
- runez==5.11.1
37
+ runez==5.11.3
36
38
  # via portable-python (pyproject.toml)
37
- tomli==2.5.0 ; python_full_version <= '3.11'
39
+ tomli==2.5.0 ; python_full_version < '3.11'
38
40
  # via
39
41
  # coverage
40
42
  # pytest
@@ -21,7 +21,7 @@ from string import Template
21
21
 
22
22
  import runez
23
23
  from runez.http import RestClient
24
- from runez.pyenv import PythonSpec
24
+ from runez.pyenv import PythonSpec, Version
25
25
  from runez.render import Header, PrettyTable
26
26
 
27
27
  from portable_python.versions import PPG
@@ -506,8 +506,9 @@ class ModuleBuilder:
506
506
  """Is module with name either selected or usable as a shared lib, as determined via its telltale"""
507
507
  return self.modules.is_usable_module(name)
508
508
 
509
- def cfg_version(self, default):
510
- return PPG.config.get_value("%s-version" % self.m_name) or default
509
+ def cfg_version(self, default: str) -> Version:
510
+ # str(): a version in yaml config may have been parsed as a float (eg: `gdbm-version: 1.26`)
511
+ return Version(str(PPG.config.get_value("%s-version" % self.m_name) or default))
511
512
 
512
513
  def cfg_http_headers(self):
513
514
  if config_http_headers := PPG.config.get_value("%s-http-headers" % self.m_name):
@@ -554,9 +555,12 @@ class ModuleBuilder:
554
555
  return self.cfg_src_suffix()
555
556
 
556
557
  @property
557
- def version(self):
558
- """Version to use"""
559
- return self.parent_module and self.parent_module.version
558
+ def version(self) -> Version:
559
+ """Version to use, sub-modules (such as tcl/tk/tix) share the version of their parent module by default"""
560
+ if self.parent_module is None:
561
+ return self.setup.python_spec.version # Top of the module tree: the python being built
562
+
563
+ return self.parent_module.version
560
564
 
561
565
  @property
562
566
  def deps(self):
@@ -822,10 +826,6 @@ class PythonBuilder(ModuleBuilder):
822
826
 
823
827
  return self._bin_python
824
828
 
825
- @property
826
- def version(self):
827
- return self.setup.python_spec.version
828
-
829
829
  def xenv_LDFLAGS(self):
830
830
  """Python builder does not reuse the common setting"""
831
831
  yield from ()
@@ -2,10 +2,10 @@ import configparser
2
2
  import datetime
3
3
  import os
4
4
  import re
5
+ import shutil
5
6
 
6
7
  import runez
7
8
  import yaml
8
- from runez.pyenv import Version
9
9
 
10
10
  from portable_python import LOG, patch_file, patch_folder, PPG, PythonBuilder
11
11
  from portable_python.external.xcpython import Bdb, Bzip2, Gdbm, LibFFI, Mpdec, Openssl, Readline, Sqlite, Uuid, Xz, Zlib, Zstd
@@ -20,6 +20,11 @@ test_hashlib test_io test_iter test_json test_long test_math test_memoryview tes
20
20
  test_struct test_threading test_time test_traceback test_unicode
21
21
  """
22
22
 
23
+ # Compiler commands that ./configure records in the Makefile end up in sysconfig, and are used to build C/C++ extensions
24
+ RX_MAKEFILE_COMPILER = re.compile(r"^(CC|CXX|LDSHARED|LDCXXSHARED)=[ \t]*(.*?)[ \t]*$", flags=re.MULTILINE)
25
+ # Compiler wrappers that may exist on the build host only, recording them in sysconfig is worth a warning
26
+ RX_COMPILER_WRAPPER = re.compile(r"\b(ccache|sccache|distcc)\b")
27
+
23
28
 
24
29
  def represented_yaml(key_value_pairs):
25
30
  """
@@ -164,7 +169,7 @@ class Cpython(PythonBuilder):
164
169
  tkinter = self.active_module(TkInter)
165
170
  if tkinter:
166
171
  # TODO: this doesn't seem to be enough, on macos cpython's ./configure still picks up the shared macos tcl/tk libs
167
- version = Version(tkinter.version)
172
+ version = tkinter.version
168
173
  yield f"--with-tcltk-includes=-I{self.deps}/include"
169
174
 
170
175
  lib_dir_flags = " ".join(f"-L{lib_dir}" for lib_dir in self.deps_lib_dirs)
@@ -246,6 +251,7 @@ class Cpython(PythonBuilder):
246
251
 
247
252
  def _do_linux_compile(self):
248
253
  self.run_configure("./configure", self.c_configure_args(), prefix=self.c_configure_prefix)
254
+ self.groom_makefile_compilers()
249
255
  make_args = []
250
256
  if self.version < "3.8":
251
257
  pgo_tests = runez.joined(runez.flattened(PGO_TESTS, split=True))
@@ -255,6 +261,48 @@ class Cpython(PythonBuilder):
255
261
  # Don't parallelize `make install`, see https://github.com/python/cpython/issues/109796
256
262
  self.run_make("install", f"DESTDIR={self.destdir}")
257
263
 
264
+ def groom_makefile_compilers(self):
265
+ """
266
+ Keep the compiler commands that end up in sysconfig usable on hosts other than the build host.
267
+
268
+ ./configure looks up the C++ compiler on PATH (so that a missing one is noticed at configure time),
269
+ and records it by the absolute path where it found it, a path that is specific to the build host.
270
+ For example `/usr/lib/ccache/g++`, when a compiler cache masquerade folder is first on PATH.
271
+ A portable python builds extensions on other hosts: refer to the compiler by name (as for the C compiler),
272
+ to be found on that host's PATH. The build is unchanged: on the build host, that name resolves to the same path.
273
+ A `CXX` explicitly provided by the user is left alone.
274
+ """
275
+ makefile = "Makefile"
276
+ if not os.path.exists(makefile):
277
+ return # Not configured (dryrun mode)
278
+
279
+ with open(makefile) as fh:
280
+ compilers = dict(RX_MAKEFILE_COMPILER.findall(fh.read()))
281
+
282
+ cxx = compilers.get("CXX")
283
+ if cxx and not self._is_cxx_preset():
284
+ program, _, flags = cxx.partition(" ")
285
+ bare_name = os.path.basename(program)
286
+ if program != bare_name and shutil.which(bare_name) == program:
287
+ # Makefile.pre first: Makefile is generated from it, and must not end up older than it
288
+ for path in ("Makefile.pre", makefile):
289
+ patch_file(path, rf"^(CXX=[ \t]*){re.escape(program)}(?=[ \t]|$)", rf"\g<1>{bare_name}")
290
+
291
+ compilers["CXX"] = runez.joined(bare_name, flags)
292
+
293
+ for name, command in sorted(compilers.items()):
294
+ if RX_COMPILER_WRAPPER.search(command):
295
+ LOG.warning(
296
+ "sysconfig will record compiler wrapper '%s=%s', extensions won't build on hosts without it"
297
+ " (a wrapper masquerade folder on PATH applies to the build only)",
298
+ name,
299
+ command,
300
+ )
301
+
302
+ def _is_cxx_preset(self):
303
+ """Did the user explicitly provide which C++ compiler to use? (via env var, or `CXX=` in `cpython-configure`)"""
304
+ return bool(os.environ.get("CXX")) or any(x.startswith("CXX=") for x in self.c_configure_args_from_config)
305
+
258
306
  def _finalize(self):
259
307
  is_shared = self.setup.prefix or self.has_configure_opt("--enable-shared", "yes")
260
308
  if is_shared:
@@ -136,8 +136,9 @@ class LibFFI(ModuleBuilder):
136
136
  @property
137
137
  def version(self):
138
138
  # python-build-standalone moved from 3.4.8 straight to 3.8.0 in Oct 2026 (their PR #1302), follow their lead
139
+ # 3.8.x patch releases carry security fixes (3.8.2: GHSA advisories), keep current within the line
139
140
  # Check https://github.com/libffi/libffi/releases
140
- return self.cfg_version("3.8.0")
141
+ return self.cfg_version("3.8.2")
141
142
 
142
143
  def c_configure_args(self):
143
144
  if config_args := self.cfg_configure(self.deps_lib_dir, self.deps_lib64_dir):
@@ -170,9 +171,9 @@ class Openssl(ModuleBuilder):
170
171
 
171
172
  @property
172
173
  def url(self):
173
- if self.version and self.version.startswith("1.1.1"):
174
+ if self.version.text.startswith("1.1.1"):
174
175
  # Not sure why URL suddenly changed for this on github...
175
- vfolder = self.version.replace(".", "_")
176
+ vfolder = self.version.text.replace(".", "_")
176
177
  return (
177
178
  self.cfg_url(self.version)
178
179
  or f"https://github.com/openssl/openssl/releases/download/OpenSSL_{vfolder}/openssl-{self.version}.tar.gz"
@@ -186,7 +187,7 @@ class Openssl(ModuleBuilder):
186
187
  # Stay on the 3.5 LTS line: 3.6.x and 4.0.x have shipped but are not verified for cpython builds
187
188
  # (python-build-standalone pins 3.5.x as well)
188
189
  # Check https://github.com/openssl/openssl/releases and https://endoflife.date/openssl
189
- return self.cfg_version("3.5.9")
190
+ return self.cfg_version("3.5.10")
190
191
 
191
192
  def c_configure_args(self):
192
193
  if config_args := self.cfg_configure(self.deps_lib_dir, self.deps_lib64_dir):
@@ -320,9 +321,10 @@ class Sqlite(ModuleBuilder):
320
321
 
321
322
  @property
322
323
  def version(self):
323
- # 3.53.x gets frequent fix-only releases, keep current within the line
324
+ # Fix-only releases are frequent within a line, keep current; move to a new line once its .1 is out
325
+ # (3.54.1, also used by python-build-standalone)
324
326
  # Check https://sqlite.org/changes.html (avoid withdrawn releases like 3.52.0)
325
- return self.cfg_version("3.53.4")
327
+ return self.cfg_version("3.54.1")
326
328
 
327
329
  def c_configure_args(self):
328
330
  if config_args := self.cfg_configure(self.deps_lib_dir, self.deps_lib64_dir):
@@ -389,8 +391,9 @@ class Xz(ModuleBuilder):
389
391
 
390
392
  @property
391
393
  def version(self):
394
+ # 5.8.x patch releases carry security fixes (5.8.5), keep current within the line
392
395
  # Check https://github.com/tukaani-project/xz/releases
393
- return self.cfg_version("5.8.4")
396
+ return self.cfg_version("5.8.5")
394
397
 
395
398
  def c_configure_args(self):
396
399
  if config_args := self.cfg_configure(self.deps_lib_dir, self.deps_lib64_dir):
@@ -433,8 +436,10 @@ class Zlib(ModuleBuilder):
433
436
 
434
437
  @property
435
438
  def version(self):
439
+ # 1.4 fixes several CVEs, its breaking changes are CMake/MSVC/Cygwin only (we use ./configure)
440
+ # python-build-standalone moved to 1.4 as well
436
441
  # Check https://zlib.net/ and https://github.com/madler/zlib/releases
437
- return self.cfg_version("1.3.2")
442
+ return self.cfg_version("1.4")
438
443
 
439
444
  def c_configure_args(self):
440
445
  if config_args := self.cfg_configure(self.deps_lib_dir, self.deps_lib64_dir):
@@ -474,8 +479,10 @@ class Zstd(ModuleBuilder):
474
479
 
475
480
  @property
476
481
  def version(self):
482
+ # 1.6.0 was released early as a CVE fix (CVE-2026-124851), upstream "highly recommends" it
483
+ # python-build-standalone moved to 1.6.0 as well
477
484
  # Check https://github.com/facebook/zstd/releases
478
- return self.cfg_version("1.5.7")
485
+ return self.cfg_version("1.6.0")
479
486
 
480
487
  def _do_linux_compile(self):
481
488
  # Notably, this does not build when given a relative path.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: portable-python
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Portable python binaries
5
5
  Author-email: Zoran Simic <zoran@simicweb.com>
6
6
  License-Expression: MIT
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "2.2.0",
3
+ "distance": 0,
4
+ "node": "g747ebc2791e2e6c3b3caa6dc9d5db53ca203bf6e",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-12-03"
8
+ }
@@ -1,7 +1,10 @@
1
+ import os
1
2
  from unittest.mock import patch
2
3
 
3
4
  import runez
4
5
 
6
+ from portable_python import BuildSetup, required_python_spec
7
+ from portable_python.cpython import Cpython
5
8
  from portable_python.versions import PPG
6
9
 
7
10
 
@@ -24,7 +27,7 @@ def test_build_free_threaded(cli):
24
27
  cli.run("-n", "-tmacos-arm64", "build", "3.14.4t", "-mreadline,tkinter")
25
28
  assert cli.succeeded
26
29
  assert " --enable-aqua=yes" in cli.logged # tk on macos
27
- assert "zstd 1.5.7 static* [auto-selected] Required for 3.14 and up" in cli.logged
30
+ assert "zstd 1.6.0 static* [auto-selected] Required for 3.14 and up" in cli.logged
28
31
  assert " --disable-gil" in cli.logged
29
32
  assert "env LIBMPDEC_LIBS=build/deps/lib/libmpdec.a" in cli.logged
30
33
  assert "env LIBREADLINE_LIBS=-Lbuild/deps/lib -lreadline -lncursesw" in cli.logged
@@ -134,3 +137,48 @@ def test_finalization(cli, monkeypatch):
134
137
  assert f"PEP 668: Cleaned 2 build artifacts (0 B): pip pip{f.mm}" in cli.logged
135
138
  # bin/ exes remain unchanged with --prefix
136
139
  assert list(runez.readlines(f.destdir / "opt/foo/bin/some-exe")) == ["#!.../bin/python3", "hello"]
140
+
141
+
142
+ SAMPLE_MAKEFILE = """
143
+ CC=\t\tgcc -pthread
144
+ CXX=\t\t{cxx}
145
+ LDSHARED=\t$(CC) -shared
146
+ LDCXXSHARED=\t$(CXX) -shared
147
+ """
148
+
149
+
150
+ def testgroom_makefile_compilers(temp_folder, logged, monkeypatch):
151
+ PPG.grab_config(target="linux-x86_64")
152
+ python_builder = BuildSetup(required_python_spec("3.14.6")).python_builder
153
+ assert isinstance(python_builder, Cpython)
154
+ python_builder.groom_makefile_compilers() # No Makefile yet (dryrun mode): no-op
155
+ assert not logged
156
+
157
+ # Since 3.14.6, ./configure records the absolute path of the C++ compiler found on PATH (here: a ccache masquerade folder)
158
+ wrapper = os.path.abspath("ccache/g++")
159
+ runez.write(wrapper, "#!/bin/sh\n", logger=None)
160
+ os.chmod(wrapper, 0o755)
161
+ monkeypatch.setenv("PATH", os.path.dirname(wrapper))
162
+ monkeypatch.delenv("CXX", raising=False)
163
+ for path in ("Makefile.pre", "Makefile"):
164
+ runez.write(path, SAMPLE_MAKEFILE.format(cxx=f"{wrapper} -pthread"), logger=None)
165
+
166
+ python_builder.groom_makefile_compilers()
167
+ for path in ("Makefile.pre", "Makefile"):
168
+ assert list(runez.readlines(path))[2] == "CXX=\t\tg++ -pthread" # Bare name, compilation still uses the same g++ via PATH
169
+
170
+ logged.pop()
171
+ python_builder.groom_makefile_compilers() # Already bare: no-op
172
+ assert not logged
173
+
174
+ # A CXX that is not the one found on PATH is left as-is (as is a CXX explicitly provided by the user)
175
+ runez.write("Makefile", SAMPLE_MAKEFILE.format(cxx="/usr/bin/g++"), logger=None)
176
+ python_builder.groom_makefile_compilers()
177
+ assert list(runez.readlines("Makefile"))[2] == "CXX=\t\t/usr/bin/g++"
178
+
179
+ # A compiler wrapper explicitly provided by the user ends up in sysconfig, with a warning
180
+ monkeypatch.setenv("CXX", wrapper)
181
+ runez.write("Makefile", SAMPLE_MAKEFILE.format(cxx=wrapper), logger=None)
182
+ python_builder.groom_makefile_compilers()
183
+ assert f"sysconfig will record compiler wrapper 'CXX={wrapper}'" in logged.pop()
184
+ assert list(runez.readlines("Makefile"))[2] == f"CXX=\t\t{wrapper}" # User provided CXX is not modified
@@ -7,7 +7,7 @@ def test_build_bogus_platform(cli):
7
7
  def test_failed_build(cli):
8
8
  cli.run("-tmacos-arm64", "build", "3.12.0")
9
9
  assert cli.failed
10
- assert "Error while compiling xz:5.8.4: ForbiddenHttpError" in cli.logged
10
+ assert "Error while compiling xz:5.8.5: ForbiddenHttpError" in cli.logged
11
11
  assert "Overall compilation failed:" in cli.logged
12
12
 
13
13
 
@@ -15,7 +15,7 @@ def test_scan(cli):
15
15
 
16
16
  with patch.object(PPG, "find_telltale", return_value=None): # Simulate a host without any system headers
17
17
  cli.run("-tlinux-x86_64", "build-report", "3.14.0")
18
- assert "zstd 1.5.7 static* broken, can't compile without libzstd-dev" in cli.logged # Auto-selected ('*')
18
+ assert "zstd 1.6.0 static* broken, can't compile without libzstd-dev" in cli.logged # Auto-selected ('*')
19
19
  assert "mpdec 4.0.1 static* broken, can't compile without libmpdec-dev" in cli.logged
20
20
 
21
21
  cli.run("-tmacos-arm64", "build-report", "3.14.0")
@@ -87,7 +87,7 @@ def test_edge_cases(temp_folder, monkeypatch, logged):
87
87
 
88
88
  mb = ModuleBuilder(setup)
89
89
  assert not mb.url
90
- assert not mb.version
90
+ assert mb.version == "3.9.6" # Top-level module: version of the python being built
91
91
  mb.resolved_telltale = "foo.h"
92
92
  mb.m_debian = "-foo"
93
93
  outcome, reason = mb.linker_outcome(is_selected=True)
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "2.1.0",
3
- "distance": 0,
4
- "node": "g52f18f1d8761de7e37bc812c95a542f6b186bb0f",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-10-20"
8
- }
File without changes
File without changes