13 found = subprocess.check_output([
"git",
"grep",
"class *[A-Za-z0-9_<>]* *: *public "])
14 s.update(found.split(
"\n"))
22 name = name[name.find(
"class")+5:].strip()
23 ret.setdefault(name,[]).
append((
":".
join(parts[2:]), file))
33 if name
in all_modules:
34 info = all_modules[name]
36 print "ERROR: more than one declaration for '"+name+
"'\n"
37 for inherits,file
in info:
38 print " ",file, inherits
40 inherits,file = info[0]
41 if -1 != inherits.find(
"edm::EDProducer"):
43 elif -1 != inherits.find(
"edm::EDFilter"):
46 print "ERROR: class '"+name+
"' does not directly inherit from EDProducer or EDFilter\n "+inherits
49 print "ERROR: did not find a standard class declaration for '"+name+
"'"
51 found = subprocess.check_output([
"git",
"grep",
"class *"+name+
" *:"])
55 found = subprocess.check_output([
"git",
"grep",
"typedef *.* "+name])
62 c = fileName.split(
"/")
63 print "checking out "+c[0]+
"/"+c[1]
64 sparce_checkout =
".git/info/sparse-checkout"
65 f = open(sparce_checkout,
"r")
66 linesInSparse = set(f.readlines())
68 linesInSparse.add(c[0]+"/"+c[1]+
"\n")
70 f = open(sparce_checkout+
"_new",
"w")
71 for l
in linesInSparse:
75 shutil.move(sparce_checkout,sparce_checkout+
"_old")
76 shutil.move(sparce_checkout+
"_new",sparce_checkout)
77 subprocess.call([
"git",
"read-tree",
"-mu",
"HEAD"])
80 print " editting "+fileName
82 fNew = open(fileName+
"_NEW",
"w")
84 lookingForChanges =
True
86 for l
in fOld.readlines():
88 if -1 != l.find(
"#include"):
89 if moduleType == kProducer:
90 if -1 != l.find(
"FWCore/Framework/interface/EDProducer.h"):
91 l=
'#include "FWCore/Framework/interface/stream/EDProducer.h"\n'
93 elif moduleType == kFilter:
94 if -1 != l.find(
"FWCore/Framework/interface/EDFilter.h"):
95 l =
'#include "FWCore/Framework/interface/stream/EDFilter.h"\n'
97 elif -1 != l.find(
"class"):
98 if -1 != l.find(moduleName):
99 if moduleType == kProducer:
100 if -1 != l.find(
"edm::EDProducer"):
101 l = l.replace(
"edm::EDProducer",
"edm::stream::EDProducer<>")
102 lookingForChanges =
False
103 elif moduleType == kFilter:
104 if -1 != l.find(
"edm::EDFilter"):
105 l=l.replace(
"edm::EDFilter",
"edm::stream::EDFilter<>")
107 if -1 != l.find(
" beginJob("):
108 print " WARNING: beginJob found but not supported by stream"
110 if -1 != l.find(
" endJob("):
111 print " WARNING: endJob found but not supported by stream"
114 print " WARNING: did not write include into "+fileName
117 shutil.move(fileName,fileName+
"_OLD")
118 shutil.move(fileName+
"_NEW",fileName)
120 modules = sys.argv[1:]
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 ...
static std::string join(char **cmd)
def find_all_module_classes