mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
Hardcopy of pybind11 instead of using git submodules (#552)
* removed pybind as submodule * added hardcopy of pybind11 2.10.0 * rename pybind11 folder to avoid conflicts when changing branch Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
36
libs/pybind/tools/libsize.py
Normal file
36
libs/pybind/tools/libsize.py
Normal file
@ -0,0 +1,36 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Internal build script for generating debugging test .so size.
|
||||
# Usage:
|
||||
# python libsize.py file.so save.txt -- displays the size of file.so and, if save.txt exists, compares it to the
|
||||
# size in it, then overwrites save.txt with the new size for future runs.
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
sys.exit("Invalid arguments: usage: python libsize.py file.so save.txt")
|
||||
|
||||
lib = sys.argv[1]
|
||||
save = sys.argv[2]
|
||||
|
||||
if not os.path.exists(lib):
|
||||
sys.exit(f"Error: requested file ({lib}) does not exist")
|
||||
|
||||
libsize = os.path.getsize(lib)
|
||||
|
||||
print("------", os.path.basename(lib), "file size:", libsize, end="")
|
||||
|
||||
if os.path.exists(save):
|
||||
with open(save) as sf:
|
||||
oldsize = int(sf.readline())
|
||||
|
||||
if oldsize > 0:
|
||||
change = libsize - oldsize
|
||||
if change == 0:
|
||||
print(" (no change)")
|
||||
else:
|
||||
print(f" (change of {change:+} bytes = {change / oldsize:+.2%})")
|
||||
else:
|
||||
print()
|
||||
|
||||
with open(save, "w") as sf:
|
||||
sf.write(str(libsize))
|
Reference in New Issue
Block a user