1#!/usr/bin/env python3 2# ################################################################ 3# Copyright (c) Meta Platforms, Inc. and affiliates. 4# All rights reserved. 5# 6# This source code is licensed under both the BSD-style license (found in the 7# LICENSE file in the root directory of this source tree) and the GPLv2 (found 8# in the COPYING file in the root directory of this source tree). 9# You may select, at your option, one of the above-listed licenses. 10# ################################################################ 11 12import os 13import subprocess 14import sys 15 16if len(sys.argv) != 3: 17 print(f"Usage: {sys.argv[0]} FILE SIZE_LIMIT") 18 sys.exit(1) 19 20file = sys.argv[1] 21limit = int(sys.argv[2]) 22 23if not os.path.exists(file): 24 print(f"{file} does not exist") 25 sys.exit(1) 26 27size = os.path.getsize(file) 28 29if size > limit: 30 print(f"file {file} is {size} bytes, which is greater than the limit of {limit} bytes") 31 sys.exit(1) 32