2from __future__
import division, print_function
13 sys.exit(
"Invalid arguments: usage: python libsize.py file.so save.txt")
18if not os.path.exists(lib):
19 sys.exit(
"Error: requested file ({}) does not exist".format(lib))
21libsize = os.path.getsize(lib)
23print(
"------", os.path.basename(lib),
"file size:", libsize, end=
"")
25if os.path.exists(save):
26 with open(save)
as sf:
27 oldsize = int(sf.readline())
30 change = libsize - oldsize
34 print(
" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize))
38with open(save,
"w")
as sf:
39 sf.write(
str(libsize))
size_t len(handle h)
Get the length of a Python object.