mirror of
https://github.com/esphome/esphome.git
synced 2026-09-13 16:18:41 +00:00
[esp32] Accept '#' as ESP-IDF source ref separator (#17193)
This commit is contained in:
@@ -337,16 +337,19 @@ print(".".join([str(x) for x in sys.version_info]))
|
||||
|
||||
|
||||
_GITHUB_SHORTHAND_RE = re.compile(
|
||||
r"^github://([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-\._]+?)(?:@([a-zA-Z0-9\-_.\./]+))?$"
|
||||
r"^github://([a-zA-Z0-9\-]+)/([a-zA-Z0-9\-\._]+?)(?:[@#]([a-zA-Z0-9\-_.\./]+))?$"
|
||||
)
|
||||
_GITHUB_HTTPS_RE = re.compile(
|
||||
r"^(https://github\.com/[a-zA-Z0-9\-]+/[a-zA-Z0-9\-\._]+?\.git)(?:@([a-zA-Z0-9\-_.\./]+))?$"
|
||||
r"^(https://github\.com/[a-zA-Z0-9\-]+/[a-zA-Z0-9\-\._]+?\.git)(?:[@#]([a-zA-Z0-9\-_.\./]+))?$"
|
||||
)
|
||||
|
||||
|
||||
def _parse_git_source(source_url: str) -> tuple[str, str | None] | None:
|
||||
"""Return ``(url, ref)`` for ``github://owner/repo[@ref]`` or
|
||||
``https://github.com/owner/repo.git[@ref]``, else ``None``."""
|
||||
``https://github.com/owner/repo.git[@ref]``, else ``None``.
|
||||
|
||||
The ref may be separated with ``@`` or ``#``; ``#`` matches the PlatformIO
|
||||
convention used for ``platform_version`` URLs."""
|
||||
if m := _GITHUB_SHORTHAND_RE.match(source_url):
|
||||
owner, repo, ref = m.group(1), m.group(2), m.group(3)
|
||||
# Tolerate a trailing ".git" on the shorthand repo so the
|
||||
|
||||
@@ -65,6 +65,19 @@ from esphome.framework_helpers import _tar_extract_all, get_python_env_executabl
|
||||
"https://github.com/espressif/esp-idf.git@v6.0.1",
|
||||
("https://github.com/espressif/esp-idf.git", "v6.0.1"),
|
||||
),
|
||||
# '#' ref separator (PlatformIO/git-web convention) works on both forms
|
||||
(
|
||||
"https://github.com/espressif/esp-idf.git#release/v6.1",
|
||||
("https://github.com/espressif/esp-idf.git", "release/v6.1"),
|
||||
),
|
||||
(
|
||||
"github://espressif/esp-idf#release/v6.1",
|
||||
("https://github.com/espressif/esp-idf.git", "release/v6.1"),
|
||||
),
|
||||
(
|
||||
"github://espressif/esp-idf.git#master",
|
||||
("https://github.com/espressif/esp-idf.git", "master"),
|
||||
),
|
||||
# Tolerate a trailing ".git" on the shorthand so the user doesn't
|
||||
# silently end up with a doubled "...esp-idf.git.git" URL.
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user