3 from __future__
import print_function
14 found = subprocess.check_output([
"git",
"grep",
"class *[A-Za-z0-9_<>]* *: *public "])
15 s.update(found.split(
"\n"))
23 name = name[name.find(
"class")+5:].
strip()
24 ret.setdefault(name,[]).
append((
":".
join(parts[2:]), file))
34 if name
in all_modules:
35 info = all_modules[name]
37 print(
"ERROR: more than one declaration for '"+name+
"'\n")
38 for inherits,file
in info:
39 print(
" ",file, inherits)
41 inherits,file = info[0]
42 if -1 != inherits.find(
"edm::EDProducer"):
44 elif -1 != inherits.find(
"edm::EDFilter"):
47 print(
"ERROR: class '"+name+
"' does not directly inherit from EDProducer or EDFilter\n "+inherits)
50 print(
"ERROR: did not find a standard class declaration for '"+name+
"'")
52 found = subprocess.check_output([
"git",
"grep",
"class *"+name+
" *:"])
56 found = subprocess.check_output([
"git",
"grep",
"typedef *.* "+name])
63 c = fileName.split(
"/")
64 print(
"checking out "+c[0]+
"/"+c[1])
65 sparce_checkout =
".git/info/sparse-checkout"
66 f = open(sparce_checkout,
"r")
67 linesInSparse = set(f.readlines())
69 linesInSparse.add(c[0]+"/"+c[1]+
"\n")
71 f = open(sparce_checkout+
"_new",
"w")
72 for l
in linesInSparse:
76 shutil.move(sparce_checkout,sparce_checkout+
"_old")
77 shutil.move(sparce_checkout+
"_new",sparce_checkout)
78 subprocess.call([
"git",
"read-tree",
"-mu",
"HEAD"])
81 print(
" editting "+fileName)
83 fNew = open(fileName+
"_NEW",
"w")
85 lookingForChanges =
True
87 for l
in fOld.readlines():
89 if -1 != l.find(
"#include"):
90 if moduleType == kProducer:
91 if -1 != l.find(
"FWCore/Framework/interface/EDProducer.h"):
92 l=
'#include "FWCore/Framework/interface/stream/EDProducer.h"\n'
94 elif moduleType == kFilter:
95 if -1 != l.find(
"FWCore/Framework/interface/EDFilter.h"):
96 l =
'#include "FWCore/Framework/interface/stream/EDFilter.h"\n'
98 elif -1 != l.find(
"class"):
99 if -1 != l.find(moduleName):
100 if moduleType == kProducer:
101 if -1 != l.find(
"edm::EDProducer"):
102 l = l.replace(
"edm::EDProducer",
"edm::stream::EDProducer<>")
103 lookingForChanges =
False
104 elif moduleType == kFilter:
105 if -1 != l.find(
"edm::EDFilter"):
106 l=l.replace(
"edm::EDFilter",
"edm::stream::EDFilter<>")
108 if -1 != l.find(
" beginJob("):
109 print(
" WARNING: beginJob found but not supported by stream")
111 if -1 != l.find(
" endJob("):
112 print(
" WARNING: endJob found but not supported by stream")
115 print(
" WARNING: did not write include into "+fileName)
118 shutil.move(fileName,fileName+
"_OLD")
119 shutil.move(fileName+
"_NEW",fileName)
121 modules = sys.argv[1:]
123 print(
"getting info")
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
static std::string join(char **cmd)
def find_all_module_classes