[PR #2870] [MERGED] fix: make Conan recipes parse on Python < 3.12 #2993

Closed
opened 2026-10-14 21:06:45 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/2870
Author: @Mezo-oz
Created: 7/25/2026
Status: ✅ Merged
Merged: 9/18/2026
Merged by: @vkamn

Base: dev ← Head: fix/conan-recipes-python311


📝 Commits (1)

  • bd19b52 fix: make Conan recipes parse on Python < 3.12

📊 Changes

3 files changed (+7 additions, -5 deletions)

View changed files

📝 recipes/amnezia-xray-bindings/conanfile.py (+2 -1)
📝 recipes/hev-socks5-tunnel/conanfile.py (+3 -3)
📝 recipes/tun2socks/conanfile.py (+2 -1)

📄 Description

Problem

Three Conan recipes use f-string syntax that is only valid on Python 3.12+ (PEP 701):

  • recipes/amnezia-xray-bindings/conanfile.py:115
  • recipes/tun2socks/conanfile.py:118
  • recipes/hev-socks5-tunnel/conanfile.py:63-65

Two things are involved, both illegal before 3.12: reusing the same quote character inside an f-string expression, and using a backslash inside one.

f"BUILD_DIR={build_dir.replace("\\", "/") if self._is_windows else build_dir}"
                              ^ SyntaxError

On an older interpreter Conan fails to load the recipe before resolving a single dependency, so the build cannot start at all:

ERROR: Error loading conanfile at '.../recipes/amnezia-xray-bindings/conanfile.py'
  File ".../conanfile.py", line 115
    f"BUILD_DIR={build_dir.replace("\\", "/") if self._is_windows else build_dir}"
                                     ^
SyntaxError: unexpected character after line continuation character
CMake Error at cmake/conan_provider.cmake:504 (message):
  Conan install failed='1'

This is not platform specific — it affects any host with Python < 3.12. It is invisible in CI only because ubuntu-latest ships Python 3.12+. Debian 12 (bookworm) ships Python 3.11, remains widely deployed, and was the base for Raspberry Pi OS through 2025.

Fix

Hoist the expressions out of the f-strings, and use single quotes for the nested string literals. Behaviour is identical on every Python version; no functional change.

Verification

python3 -m py_compile on Python 3.11.2 (aarch64, Debian 12):

recipe before after
amnezia-xray-bindings SyntaxError OK
tun2socks SyntaxError OK
hev-socks5-tunnel SyntaxError OK

With these applied, deploy/build.sh proceeds normally and Conan builds the full dependency graph from source — go/1.26.0, openssl/3.6.x, libssh/0.11.3@amnezia, awg-go/0.2.19, openvpn/2.7.0, tun2socks/2.6.0, amnezia-xray-bindings/1.2.0 and the rest — on arch=armv8.

Related to #1324


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/2870 **Author:** [@Mezo-oz](https://github.com/Mezo-oz) **Created:** 7/25/2026 **Status:** ✅ Merged **Merged:** 9/18/2026 **Merged by:** [@vkamn](https://github.com/vkamn) **Base:** `dev` ← **Head:** `fix/conan-recipes-python311` --- ### 📝 Commits (1) - [`bd19b52`](https://github.com/amnezia-vpn/amnezia-client/commit/bd19b52f91c45ca0fd38061e5f57c163013dfe42) fix: make Conan recipes parse on Python < 3.12 ### 📊 Changes **3 files changed** (+7 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `recipes/amnezia-xray-bindings/conanfile.py` (+2 -1) 📝 `recipes/hev-socks5-tunnel/conanfile.py` (+3 -3) 📝 `recipes/tun2socks/conanfile.py` (+2 -1) </details> ### 📄 Description ### Problem Three Conan recipes use f-string syntax that is only valid on **Python 3.12+** ([PEP 701](https://peps.python.org/pep-0701/)): - `recipes/amnezia-xray-bindings/conanfile.py:115` - `recipes/tun2socks/conanfile.py:118` - `recipes/hev-socks5-tunnel/conanfile.py:63-65` Two things are involved, both illegal before 3.12: reusing the same quote character inside an f-string expression, and using a backslash inside one. ```python f"BUILD_DIR={build_dir.replace("\\", "/") if self._is_windows else build_dir}" ^ SyntaxError ``` On an older interpreter Conan fails to load the recipe *before resolving a single dependency*, so the build cannot start at all: ``` ERROR: Error loading conanfile at '.../recipes/amnezia-xray-bindings/conanfile.py' File ".../conanfile.py", line 115 f"BUILD_DIR={build_dir.replace("\\", "/") if self._is_windows else build_dir}" ^ SyntaxError: unexpected character after line continuation character CMake Error at cmake/conan_provider.cmake:504 (message): Conan install failed='1' ``` This is **not platform specific** — it affects any host with Python < 3.12. It is invisible in CI only because `ubuntu-latest` ships Python 3.12+. Debian 12 (bookworm) ships Python 3.11, remains widely deployed, and was the base for Raspberry Pi OS through 2025. ### Fix Hoist the expressions out of the f-strings, and use single quotes for the nested string literals. Behaviour is identical on every Python version; no functional change. ### Verification `python3 -m py_compile` on **Python 3.11.2** (aarch64, Debian 12): | recipe | before | after | |---|---|---| | `amnezia-xray-bindings` | SyntaxError | OK | | `tun2socks` | SyntaxError | OK | | `hev-socks5-tunnel` | SyntaxError | OK | With these applied, `deploy/build.sh` proceeds normally and Conan builds the full dependency graph from source — `go/1.26.0`, `openssl/3.6.x`, `libssh/0.11.3@amnezia`, `awg-go/0.2.19`, `openvpn/2.7.0`, `tun2socks/2.6.0`, `amnezia-xray-bindings/1.2.0` and the rest — on `arch=armv8`. Related to #1324 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-14 21:06:45 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#2993
No description provided.