/usr/share/ECM/find-modules/run-sip.py is in extra-cmake-modules 5.44.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #!/usr/bin/env python
import os, sys
import fnmatch
import subprocess
sipArgs = sys.argv[1:]
idx = sipArgs.index("--module-name")
modname = sipArgs[idx + 1]
del sipArgs[idx]
del sipArgs[idx]
idx = sipArgs.index("-c")
loc = sipArgs[idx + 1]
oldFilenames = fnmatch.filter(os.listdir(loc), "sip" + modname + "*.cpp")
try:
oldFilenames.remove("sip" + modname + "cmodule.cpp")
except:
pass
for f in oldFilenames:
try:
os.remove(os.path.join(loc, f))
except OSError:
pass
idx = sipArgs.index("--unify")
unified = sipArgs[idx + 1]
del sipArgs[idx]
del sipArgs[idx]
idx = sipArgs.index("--sip")
exe = sipArgs[idx + 1]
del sipArgs[idx]
del sipArgs[idx]
try:
print(subprocess.check_output([exe] + sipArgs))
except subprocess.CalledProcessError:
sys.exit(1)
newFilenames = fnmatch.filter(os.listdir(loc), "sip" + modname + "*.cpp")
unifiedString = '\n'.join(['#include "%s"' % f for f in newFilenames]) + '\n'
for fn in newFilenames:
lines = []
with open(os.path.join(loc, fn), "r") as f:
lines = f.readlines()
lines = [line for line in lines if not line.startswith("#line")]
with open(os.path.join(loc, fn), "w") as f:
f.write(''.join(lines))
with open(unified, "w") as f:
f.write(unifiedString)
|