2 from __future__
import print_function, division
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(
"Error: requested file ({}) does not exist".format(lib))
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(
" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize))
37 with open(save,
"w")
as sf:
38 sf.write(
str(libsize))