Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions vcpkg_precommit/hook.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import argparse
import os
import platform
import subprocess
import tempfile
from pathlib import Path
from typing import Optional, Sequence
from urllib.request import urlretrieve
Expand All @@ -13,8 +15,8 @@ def get_vcpkg_binary() -> Path:

binary_map = {
("windows", "amd64"): ("vcpkg.exe", "vcpkg-windows-x64.exe"),
("linux", "x86_64"): ("vcpkg", "vcpkg-linux"),
("darwin", "arm64"): ("vcpkg", "vcpkg-macos-arm64"),
("linux", "x86_64"): ("vcpkg", "vcpkg-glibc"),
("darwin", "arm64"): ("vcpkg", "vcpkg-macos"),
("darwin", "x86_64"): ("vcpkg", "vcpkg-macos"),
}

Expand All @@ -39,6 +41,7 @@ def get_vcpkg_binary() -> Path:

def format_manifest_vcpkg_json(filename: str, vcpkg_binary: Path) -> bool:
"""Format a single vcpkg.json file."""
os.environ["VCPKG_ROOT"] = tempfile.TemporaryDirectory().name
result = subprocess.run(
[str(vcpkg_binary), "format-manifest", "--x-wait-for-lock", filename],
capture_output=True,
Expand Down
Loading