1 from __future__
import annotations
11 if len(sys.argv) != 3:
12 sys.exit(
"Invalid arguments: usage: python libsize.py file.so save.txt")
17 if not os.path.exists(lib):
18 sys.exit(f
"Error: requested file ({lib}) does not exist")
20 libsize = os.path.getsize(lib)
22 print(
"------", os.path.basename(lib),
"file size:", libsize, end=
"")
24 if os.path.exists(save):
25 with open(save)
as sf:
26 oldsize =
int(sf.readline())
29 change = libsize - oldsize
33 print(f
" (change of {change:+} bytes = {change / oldsize:+.2%})")
37 with open(save,
"w")
as sf:
38 sf.write(
str(libsize))