From 52a015fb118d331495d5912c6ada4b1a90d3d013 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Tue, 30 Apr 2024 09:07:11 +0200 Subject: [PATCH] Bazel: remove further unneeded files --- misc/bazel/internal/BUILD.bazel | 0 misc/bazel/internal/git_lfs_smudge.py | 32 --------------------------- 2 files changed, 32 deletions(-) delete mode 100644 misc/bazel/internal/BUILD.bazel delete mode 100755 misc/bazel/internal/git_lfs_smudge.py diff --git a/misc/bazel/internal/BUILD.bazel b/misc/bazel/internal/BUILD.bazel deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/misc/bazel/internal/git_lfs_smudge.py b/misc/bazel/internal/git_lfs_smudge.py deleted file mode 100755 index 4e86cecc3abf..000000000000 --- a/misc/bazel/internal/git_lfs_smudge.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import pathlib -import subprocess -import os - -sources = [pathlib.Path(arg).resolve() for arg in sys.argv[1:]] -source_dir = pathlib.Path(os.path.commonpath(src.parent for src in sources)) -source_dir = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], cwd=source_dir, text=True).strip() - - -def is_lfs_pointer(fileobj): - lfs_header = "version https://git-lfs.github.com/spec".encode() - actual_header = fileobj.read(len(lfs_header)) - fileobj.seek(0) - return lfs_header == actual_header - - -for src in sources: - with open(src, 'rb') as input: - if is_lfs_pointer(input): - lfs_pointer = input.read() - rel_src = src.relative_to(source_dir).as_posix() - with open(src.name, 'wb') as output: - subprocess.run( - ["git", - "-c", f"lfs.fetchinclude={rel_src}", "-c", "lfs.fetchexclude=", - "lfs", "smudge", "--", rel_src], - input=lfs_pointer, stdout=output, check=True, cwd=source_dir) - continue - pathlib.Path(src.name).symlink_to(src)