mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
Remove more trailing semicolons in Python files
This commit is contained in:
parent
2198dadc2f
commit
3591f79b7e
@ -409,7 +409,7 @@ class CLexer:
|
|||||||
return self.lineno
|
return self.lineno
|
||||||
|
|
||||||
def push(self, token):
|
def push(self, token):
|
||||||
self.tokens.insert(0, token);
|
self.tokens.insert(0, token)
|
||||||
|
|
||||||
def debug(self):
|
def debug(self):
|
||||||
print "Last token: ", self.last
|
print "Last token: ", self.last
|
||||||
@ -429,7 +429,7 @@ class CLexer:
|
|||||||
if line[0] == '#':
|
if line[0] == '#':
|
||||||
self.tokens = map((lambda x: ('preproc', x)),
|
self.tokens = map((lambda x: ('preproc', x)),
|
||||||
string.split(line))
|
string.split(line))
|
||||||
break;
|
break
|
||||||
l = len(line)
|
l = len(line)
|
||||||
if line[0] == '"' or line[0] == "'":
|
if line[0] == '"' or line[0] == "'":
|
||||||
end = line[0]
|
end = line[0]
|
||||||
@ -699,7 +699,7 @@ class CParser:
|
|||||||
if self.top_comment == "":
|
if self.top_comment == "":
|
||||||
self.top_comment = com
|
self.top_comment = com
|
||||||
if self.comment == None or com[0] == '*':
|
if self.comment == None or com[0] == '*':
|
||||||
self.comment = com;
|
self.comment = com
|
||||||
else:
|
else:
|
||||||
self.comment = self.comment + com
|
self.comment = self.comment + com
|
||||||
token = self.lexer.token()
|
token = self.lexer.token()
|
||||||
@ -897,7 +897,7 @@ class CParser:
|
|||||||
while i < nbargs:
|
while i < nbargs:
|
||||||
if args[i][1] == arg:
|
if args[i][1] == arg:
|
||||||
args[i] = (args[i][0], arg, desc)
|
args[i] = (args[i][0], arg, desc)
|
||||||
break;
|
break
|
||||||
i = i + 1
|
i = i + 1
|
||||||
if i >= nbargs:
|
if i >= nbargs:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
@ -1141,10 +1141,10 @@ class CParser:
|
|||||||
type = type + token[1]
|
type = type + token[1]
|
||||||
token = self.token()
|
token = self.token()
|
||||||
elif token != None and token[0] == 'sep' and token[1] == ';':
|
elif token != None and token[0] == 'sep' and token[1] == ';':
|
||||||
break;
|
break
|
||||||
elif token != None and token[0] == 'name':
|
elif token != None and token[0] == 'name':
|
||||||
type = base_type
|
type = base_type
|
||||||
continue;
|
continue
|
||||||
else:
|
else:
|
||||||
self.error("parsing typedef: expecting ';'", token)
|
self.error("parsing typedef: expecting ';'", token)
|
||||||
return token
|
return token
|
||||||
@ -1239,7 +1239,7 @@ class CParser:
|
|||||||
else:
|
else:
|
||||||
self.error("parseStruct: name", token)
|
self.error("parseStruct: name", token)
|
||||||
token = self.token()
|
token = self.token()
|
||||||
self.type = base_type;
|
self.type = base_type
|
||||||
self.struct_fields = fields
|
self.struct_fields = fields
|
||||||
#self.debug("end parseStruct", token)
|
#self.debug("end parseStruct", token)
|
||||||
#print fields
|
#print fields
|
||||||
@ -1289,7 +1289,7 @@ class CParser:
|
|||||||
else:
|
else:
|
||||||
self.error("parseUnion: name", token)
|
self.error("parseUnion: name", token)
|
||||||
token = self.token()
|
token = self.token()
|
||||||
self.type = base_type;
|
self.type = base_type
|
||||||
self.union_fields = fields
|
self.union_fields = fields
|
||||||
# self.debug("end parseUnion", token)
|
# self.debug("end parseUnion", token)
|
||||||
# print fields
|
# print fields
|
||||||
@ -1633,7 +1633,7 @@ class CParser:
|
|||||||
self.type = self.type + token[1]
|
self.type = self.type + token[1]
|
||||||
token = self.token()
|
token = self.token()
|
||||||
if token == None or token[0] != "name" :
|
if token == None or token[0] != "name" :
|
||||||
self.error("parsing function type, name expected", token);
|
self.error("parsing function type, name expected", token)
|
||||||
return token
|
return token
|
||||||
self.type = self.type + token[1]
|
self.type = self.type + token[1]
|
||||||
nametok = token
|
nametok = token
|
||||||
@ -1643,14 +1643,14 @@ class CParser:
|
|||||||
token = self.token()
|
token = self.token()
|
||||||
if token != None and token[0] == "sep" and token[1] == '(':
|
if token != None and token[0] == "sep" and token[1] == '(':
|
||||||
token = self.token()
|
token = self.token()
|
||||||
type = self.type;
|
type = self.type
|
||||||
token = self.parseSignature(token);
|
token = self.parseSignature(token)
|
||||||
self.type = type;
|
self.type = type
|
||||||
else:
|
else:
|
||||||
self.error("parsing function type, '(' expected", token);
|
self.error("parsing function type, '(' expected", token)
|
||||||
return token
|
return token
|
||||||
else:
|
else:
|
||||||
self.error("parsing function type, ')' expected", token);
|
self.error("parsing function type, ')' expected", token)
|
||||||
return token
|
return token
|
||||||
self.lexer.push(token)
|
self.lexer.push(token)
|
||||||
token = nametok
|
token = nametok
|
||||||
@ -1675,7 +1675,7 @@ class CParser:
|
|||||||
self.type = self.type + token[1]
|
self.type = self.type + token[1]
|
||||||
token = self.token()
|
token = self.token()
|
||||||
else:
|
else:
|
||||||
self.error("parsing array type, ']' expected", token);
|
self.error("parsing array type, ']' expected", token)
|
||||||
return token
|
return token
|
||||||
elif token != None and token[0] == "sep" and token[1] == ':':
|
elif token != None and token[0] == "sep" and token[1] == ':':
|
||||||
# remove :12 in case it's a limited int size
|
# remove :12 in case it's a limited int size
|
||||||
@ -1904,7 +1904,7 @@ class CParser:
|
|||||||
self.index_add(self.name, self.filename, static,
|
self.index_add(self.name, self.filename, static,
|
||||||
"function", d)
|
"function", d)
|
||||||
token = self.token()
|
token = self.token()
|
||||||
token = self.parseBlock(token);
|
token = self.parseBlock(token)
|
||||||
elif token[1] == ',':
|
elif token[1] == ',':
|
||||||
self.comment = None
|
self.comment = None
|
||||||
self.index_add(self.name, self.filename, static,
|
self.index_add(self.name, self.filename, static,
|
||||||
@ -2014,7 +2014,7 @@ class docBuilder:
|
|||||||
for header in self.headers.keys():
|
for header in self.headers.keys():
|
||||||
parser = CParser(header)
|
parser = CParser(header)
|
||||||
idx = parser.parse()
|
idx = parser.parse()
|
||||||
self.headers[header] = idx;
|
self.headers[header] = idx
|
||||||
self.idx.merge(idx)
|
self.idx.merge(idx)
|
||||||
|
|
||||||
def scanModules(self):
|
def scanModules(self):
|
||||||
@ -2032,19 +2032,19 @@ class docBuilder:
|
|||||||
skip = 1
|
skip = 1
|
||||||
for incl in self.includes:
|
for incl in self.includes:
|
||||||
if string.find(file, incl) != -1:
|
if string.find(file, incl) != -1:
|
||||||
skip = 0;
|
skip = 0
|
||||||
break
|
break
|
||||||
if skip == 0:
|
if skip == 0:
|
||||||
self.modules[file] = None;
|
self.modules[file] = None
|
||||||
files = glob.glob(directory + "/*.h")
|
files = glob.glob(directory + "/*.h")
|
||||||
for file in files:
|
for file in files:
|
||||||
skip = 1
|
skip = 1
|
||||||
for incl in self.includes:
|
for incl in self.includes:
|
||||||
if string.find(file, incl) != -1:
|
if string.find(file, incl) != -1:
|
||||||
skip = 0;
|
skip = 0
|
||||||
break
|
break
|
||||||
if skip == 0:
|
if skip == 0:
|
||||||
self.headers[file] = None;
|
self.headers[file] = None
|
||||||
self.scanHeaders()
|
self.scanHeaders()
|
||||||
self.scanModules()
|
self.scanModules()
|
||||||
|
|
||||||
@ -2067,11 +2067,11 @@ class docBuilder:
|
|||||||
val = eval(info[0])
|
val = eval(info[0])
|
||||||
except:
|
except:
|
||||||
val = info[0]
|
val = info[0]
|
||||||
output.write(" value='%s'" % (val));
|
output.write(" value='%s'" % (val))
|
||||||
if info[2] != None and info[2] != '':
|
if info[2] != None and info[2] != '':
|
||||||
output.write(" type='%s'" % info[2]);
|
output.write(" type='%s'" % info[2])
|
||||||
if info[1] != None and info[1] != '':
|
if info[1] != None and info[1] != '':
|
||||||
output.write(" info='%s'" % escape(info[1]));
|
output.write(" info='%s'" % escape(info[1]))
|
||||||
output.write("/>\n")
|
output.write("/>\n")
|
||||||
|
|
||||||
def serialize_macro(self, output, name):
|
def serialize_macro(self, output, name):
|
||||||
@ -2119,7 +2119,7 @@ class docBuilder:
|
|||||||
if self.idx.structs.has_key(name) and ( \
|
if self.idx.structs.has_key(name) and ( \
|
||||||
type(self.idx.structs[name].info) == type(()) or
|
type(self.idx.structs[name].info) == type(()) or
|
||||||
type(self.idx.structs[name].info) == type([])):
|
type(self.idx.structs[name].info) == type([])):
|
||||||
output.write(">\n");
|
output.write(">\n")
|
||||||
try:
|
try:
|
||||||
for field in self.idx.structs[name].info:
|
for field in self.idx.structs[name].info:
|
||||||
desc = field[2]
|
desc = field[2]
|
||||||
@ -2136,7 +2136,7 @@ class docBuilder:
|
|||||||
self.warning("Failed to serialize struct %s" % (name))
|
self.warning("Failed to serialize struct %s" % (name))
|
||||||
output.write(" </struct>\n")
|
output.write(" </struct>\n")
|
||||||
else:
|
else:
|
||||||
output.write("/>\n");
|
output.write("/>\n")
|
||||||
else :
|
else :
|
||||||
output.write(" <typedef name='%s' file='%s' type='%s'" % (
|
output.write(" <typedef name='%s' file='%s' type='%s'" % (
|
||||||
name, self.modulename_file(id.header), id.info))
|
name, self.modulename_file(id.header), id.info))
|
||||||
@ -2176,7 +2176,7 @@ class docBuilder:
|
|||||||
if apstr != "":
|
if apstr != "":
|
||||||
apstr = apstr + " && "
|
apstr = apstr + " && "
|
||||||
apstr = apstr + cond
|
apstr = apstr + cond
|
||||||
output.write(" <cond>%s</cond>\n"% (apstr));
|
output.write(" <cond>%s</cond>\n"% (apstr))
|
||||||
try:
|
try:
|
||||||
(ret, params, desc) = id.info
|
(ret, params, desc) = id.info
|
||||||
output.write(" <info><![CDATA[%s]]></info>\n" % (desc))
|
output.write(" <info><![CDATA[%s]]></info>\n" % (desc))
|
||||||
@ -2388,7 +2388,7 @@ class docBuilder:
|
|||||||
letter = id[0]
|
letter = id[0]
|
||||||
output.write(" <letter name='%s'>\n" % (letter))
|
output.write(" <letter name='%s'>\n" % (letter))
|
||||||
output.write(" <word name='%s'>\n" % (id))
|
output.write(" <word name='%s'>\n" % (id))
|
||||||
tokens = index[id];
|
tokens = index[id]
|
||||||
tokens.sort()
|
tokens.sort()
|
||||||
tok = None
|
tok = None
|
||||||
for token in tokens:
|
for token in tokens:
|
||||||
|
@ -166,15 +166,15 @@ def checkTables(db, verbose = 1):
|
|||||||
print "table %s missing" % (table)
|
print "table %s missing" % (table)
|
||||||
createTable(db, table)
|
createTable(db, table)
|
||||||
try:
|
try:
|
||||||
ret = c.execute("SELECT count(*) from %s" % table);
|
ret = c.execute("SELECT count(*) from %s" % table)
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
if verbose:
|
if verbose:
|
||||||
print "Table %s contains %d records" % (table, row[0])
|
print "Table %s contains %d records" % (table, row[0])
|
||||||
except:
|
except:
|
||||||
print "Troubles with table %s : repairing" % (table)
|
print "Troubles with table %s : repairing" % (table)
|
||||||
ret = c.execute("repair table %s" % table);
|
ret = c.execute("repair table %s" % table)
|
||||||
print "repairing returned %d" % (ret)
|
print "repairing returned %d" % (ret)
|
||||||
ret = c.execute("SELECT count(*) from %s" % table);
|
ret = c.execute("SELECT count(*) from %s" % table)
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
print "Table %s contains %d records" % (table, row[0])
|
print "Table %s contains %d records" % (table, row[0])
|
||||||
if verbose:
|
if verbose:
|
||||||
@ -600,7 +600,7 @@ def addWordHTML(word, resource, id, section, relevance):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
wordsDictHTML[word] = {}
|
wordsDictHTML[word] = {}
|
||||||
d = wordsDictHTML[word];
|
d = wordsDictHTML[word]
|
||||||
d[resource] = (relevance, id, section)
|
d[resource] = (relevance, id, section)
|
||||||
return relevance
|
return relevance
|
||||||
|
|
||||||
@ -647,7 +647,7 @@ def addWordArchive(word, id, relevance):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
wordsDictArchive[word] = {}
|
wordsDictArchive[word] = {}
|
||||||
d = wordsDictArchive[word];
|
d = wordsDictArchive[word]
|
||||||
d[id] = relevance
|
d[id] = relevance
|
||||||
return relevance
|
return relevance
|
||||||
|
|
||||||
@ -989,7 +989,7 @@ def analyzeHTML(doc, resource, p, section, id):
|
|||||||
return words
|
return words
|
||||||
|
|
||||||
def analyzeHTML(doc, resource):
|
def analyzeHTML(doc, resource):
|
||||||
para = 0;
|
para = 0
|
||||||
ctxt = doc.xpathNewContext()
|
ctxt = doc.xpathNewContext()
|
||||||
try:
|
try:
|
||||||
res = ctxt.xpathEval("//head/title")
|
res = ctxt.xpathEval("//head/title")
|
||||||
@ -1079,7 +1079,7 @@ def scanXMLMsgArchive(url, title, force = 0):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
print "Loading %s" % (url)
|
print "Loading %s" % (url)
|
||||||
doc = libxml2.htmlParseFile(url, None);
|
doc = libxml2.htmlParseFile(url, None)
|
||||||
except:
|
except:
|
||||||
doc = None
|
doc = None
|
||||||
if doc == None:
|
if doc == None:
|
||||||
@ -1102,7 +1102,7 @@ def scanXMLDateArchive(t = None, force = 0):
|
|||||||
url = getXMLDateArchive(t)
|
url = getXMLDateArchive(t)
|
||||||
print "loading %s" % (url)
|
print "loading %s" % (url)
|
||||||
try:
|
try:
|
||||||
doc = libxml2.htmlParseFile(url, None);
|
doc = libxml2.htmlParseFile(url, None)
|
||||||
except:
|
except:
|
||||||
doc = None
|
doc = None
|
||||||
if doc == None:
|
if doc == None:
|
||||||
@ -1150,7 +1150,7 @@ def analyzeArchives(t = None, force = 0):
|
|||||||
refs = wordsDictArchive[word]
|
refs = wordsDictArchive[word]
|
||||||
if refs == None:
|
if refs == None:
|
||||||
skipped = skipped + 1
|
skipped = skipped + 1
|
||||||
continue;
|
continue
|
||||||
for id in refs.keys():
|
for id in refs.keys():
|
||||||
relevance = refs[id]
|
relevance = refs[id]
|
||||||
updateWordArchive(word, id, relevance)
|
updateWordArchive(word, id, relevance)
|
||||||
@ -1170,7 +1170,7 @@ def analyzeHTMLTop():
|
|||||||
refs = wordsDictHTML[word]
|
refs = wordsDictHTML[word]
|
||||||
if refs == None:
|
if refs == None:
|
||||||
skipped = skipped + 1
|
skipped = skipped + 1
|
||||||
continue;
|
continue
|
||||||
for resource in refs.keys():
|
for resource in refs.keys():
|
||||||
(relevance, id, section) = refs[resource]
|
(relevance, id, section) = refs[resource]
|
||||||
updateWordHTML(word, resource, section, id, relevance)
|
updateWordHTML(word, resource, section, id, relevance)
|
||||||
@ -1199,7 +1199,7 @@ def analyzeAPITop():
|
|||||||
refs = wordsDict[word]
|
refs = wordsDict[word]
|
||||||
if refs == None:
|
if refs == None:
|
||||||
skipped = skipped + 1
|
skipped = skipped + 1
|
||||||
continue;
|
continue
|
||||||
for (module, symbol) in refs.keys():
|
for (module, symbol) in refs.keys():
|
||||||
updateWord(word, symbol, refs[(module, symbol)])
|
updateWord(word, symbol, refs[(module, symbol)])
|
||||||
i = i + 1
|
i = i + 1
|
||||||
@ -1228,26 +1228,26 @@ def main():
|
|||||||
elif args[i] == '--archive':
|
elif args[i] == '--archive':
|
||||||
analyzeArchives(None, force)
|
analyzeArchives(None, force)
|
||||||
elif args[i] == '--archive-year':
|
elif args[i] == '--archive-year':
|
||||||
i = i + 1;
|
i = i + 1
|
||||||
year = args[i]
|
year = args[i]
|
||||||
months = ["January" , "February", "March", "April", "May",
|
months = ["January" , "February", "March", "April", "May",
|
||||||
"June", "July", "August", "September", "October",
|
"June", "July", "August", "September", "October",
|
||||||
"November", "December"];
|
"November", "December"]
|
||||||
for month in months:
|
for month in months:
|
||||||
try:
|
try:
|
||||||
str = "%s-%s" % (year, month)
|
str = "%s-%s" % (year, month)
|
||||||
T = time.strptime(str, "%Y-%B")
|
T = time.strptime(str, "%Y-%B")
|
||||||
t = time.mktime(T) + 3600 * 24 * 10;
|
t = time.mktime(T) + 3600 * 24 * 10
|
||||||
analyzeArchives(t, force)
|
analyzeArchives(t, force)
|
||||||
except:
|
except:
|
||||||
print "Failed to index month archive:"
|
print "Failed to index month archive:"
|
||||||
print sys.exc_type, sys.exc_value
|
print sys.exc_type, sys.exc_value
|
||||||
elif args[i] == '--archive-month':
|
elif args[i] == '--archive-month':
|
||||||
i = i + 1;
|
i = i + 1
|
||||||
month = args[i]
|
month = args[i]
|
||||||
try:
|
try:
|
||||||
T = time.strptime(month, "%Y-%B")
|
T = time.strptime(month, "%Y-%B")
|
||||||
t = time.mktime(T) + 3600 * 24 * 10;
|
t = time.mktime(T) + 3600 * 24 * 10
|
||||||
analyzeArchives(t, force)
|
analyzeArchives(t, force)
|
||||||
except:
|
except:
|
||||||
print "Failed to index month archive:"
|
print "Failed to index month archive:"
|
||||||
|
@ -289,7 +289,7 @@ class virEventLoopPure:
|
|||||||
def update_timer(self, timerID, interval):
|
def update_timer(self, timerID, interval):
|
||||||
for h in self.timers:
|
for h in self.timers:
|
||||||
if h.get_id() == timerID:
|
if h.get_id() == timerID:
|
||||||
h.set_interval(interval);
|
h.set_interval(interval)
|
||||||
self.interrupt()
|
self.interrupt()
|
||||||
|
|
||||||
debug("Update timer %d interval %d" % (timerID, interval))
|
debug("Update timer %d interval %d" % (timerID, interval))
|
||||||
@ -325,25 +325,25 @@ class virEventLoopPure:
|
|||||||
if events & libvirt.VIR_EVENT_HANDLE_WRITABLE:
|
if events & libvirt.VIR_EVENT_HANDLE_WRITABLE:
|
||||||
ret |= select.POLLOUT
|
ret |= select.POLLOUT
|
||||||
if events & libvirt.VIR_EVENT_HANDLE_ERROR:
|
if events & libvirt.VIR_EVENT_HANDLE_ERROR:
|
||||||
ret |= select.POLLERR;
|
ret |= select.POLLERR
|
||||||
if events & libvirt.VIR_EVENT_HANDLE_HANGUP:
|
if events & libvirt.VIR_EVENT_HANDLE_HANGUP:
|
||||||
ret |= select.POLLHUP;
|
ret |= select.POLLHUP
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
# Convert from poll() event constants, to libvirt events constants
|
# Convert from poll() event constants, to libvirt events constants
|
||||||
def events_from_poll(self, events):
|
def events_from_poll(self, events):
|
||||||
ret = 0;
|
ret = 0
|
||||||
if events & select.POLLIN:
|
if events & select.POLLIN:
|
||||||
ret |= libvirt.VIR_EVENT_HANDLE_READABLE;
|
ret |= libvirt.VIR_EVENT_HANDLE_READABLE
|
||||||
if events & select.POLLOUT:
|
if events & select.POLLOUT:
|
||||||
ret |= libvirt.VIR_EVENT_HANDLE_WRITABLE;
|
ret |= libvirt.VIR_EVENT_HANDLE_WRITABLE
|
||||||
if events & select.POLLNVAL:
|
if events & select.POLLNVAL:
|
||||||
ret |= libvirt.VIR_EVENT_HANDLE_ERROR;
|
ret |= libvirt.VIR_EVENT_HANDLE_ERROR
|
||||||
if events & select.POLLERR:
|
if events & select.POLLERR:
|
||||||
ret |= libvirt.VIR_EVENT_HANDLE_ERROR;
|
ret |= libvirt.VIR_EVENT_HANDLE_ERROR
|
||||||
if events & select.POLLHUP:
|
if events & select.POLLHUP:
|
||||||
ret |= libvirt.VIR_EVENT_HANDLE_HANGUP;
|
ret |= libvirt.VIR_EVENT_HANDLE_HANGUP
|
||||||
return ret;
|
return ret
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
@ -437,8 +437,8 @@ def eventToString(event):
|
|||||||
"Resumed",
|
"Resumed",
|
||||||
"Stopped",
|
"Stopped",
|
||||||
"Shutdown",
|
"Shutdown",
|
||||||
"PMSuspended" );
|
"PMSuspended" )
|
||||||
return eventStrings[event];
|
return eventStrings[event]
|
||||||
|
|
||||||
def detailToString(event, detail):
|
def detailToString(event, detail):
|
||||||
eventStrings = (
|
eventStrings = (
|
||||||
|
@ -615,7 +615,7 @@ def print_function_wrapper(module, name, output, export, include):
|
|||||||
# Don't delete the function entry in the caller.
|
# Don't delete the function entry in the caller.
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
c_call = "";
|
c_call = ""
|
||||||
format=""
|
format=""
|
||||||
format_args=""
|
format_args=""
|
||||||
c_args=""
|
c_args=""
|
||||||
@ -638,7 +638,7 @@ def print_function_wrapper(module, name, output, export, include):
|
|||||||
c_args = c_args + " PyObject *pyobj_%s;\n" % (arg[0])
|
c_args = c_args + " PyObject *pyobj_%s;\n" % (arg[0])
|
||||||
c_convert = c_convert + \
|
c_convert = c_convert + \
|
||||||
" %s = (%s) Py%s_Get(pyobj_%s);\n" % (arg[0],
|
" %s = (%s) Py%s_Get(pyobj_%s);\n" % (arg[0],
|
||||||
arg[1], t, arg[0]);
|
arg[1], t, arg[0])
|
||||||
else:
|
else:
|
||||||
format_args = format_args + ", &%s" % (arg[0])
|
format_args = format_args + ", &%s" % (arg[0])
|
||||||
if f == 't#':
|
if f == 't#':
|
||||||
@ -646,7 +646,7 @@ def print_function_wrapper(module, name, output, export, include):
|
|||||||
c_args = c_args + " int py_buffsize%d;\n" % num_bufs
|
c_args = c_args + " int py_buffsize%d;\n" % num_bufs
|
||||||
num_bufs = num_bufs + 1
|
num_bufs = num_bufs + 1
|
||||||
if c_call != "":
|
if c_call != "":
|
||||||
c_call = c_call + ", ";
|
c_call = c_call + ", "
|
||||||
c_call = c_call + "%s" % (arg[0])
|
c_call = c_call + "%s" % (arg[0])
|
||||||
else:
|
else:
|
||||||
if skipped_types.has_key(arg[1]):
|
if skipped_types.has_key(arg[1]):
|
||||||
@ -671,7 +671,7 @@ def print_function_wrapper(module, name, output, export, include):
|
|||||||
c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0],
|
c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0],
|
||||||
args[1][0])
|
args[1][0])
|
||||||
else:
|
else:
|
||||||
c_call = "\n %s(%s);\n" % (name, c_call);
|
c_call = "\n %s(%s);\n" % (name, c_call)
|
||||||
ret_convert = " Py_INCREF(Py_None);\n return Py_None;\n"
|
ret_convert = " Py_INCREF(Py_None);\n return Py_None;\n"
|
||||||
elif py_types.has_key(ret[0]):
|
elif py_types.has_key(ret[0]):
|
||||||
(f, t, n, c) = py_types[ret[0]]
|
(f, t, n, c) = py_types[ret[0]]
|
||||||
@ -679,13 +679,13 @@ def print_function_wrapper(module, name, output, export, include):
|
|||||||
if file == "python_accessor" and ret[2] != None:
|
if file == "python_accessor" and ret[2] != None:
|
||||||
c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
|
c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
|
||||||
else:
|
else:
|
||||||
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
c_call = "\n c_retval = %s(%s);\n" % (name, c_call)
|
||||||
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
|
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
|
||||||
ret_convert = ret_convert + " return py_retval;\n"
|
ret_convert = ret_convert + " return py_retval;\n"
|
||||||
elif py_return_types.has_key(ret[0]):
|
elif py_return_types.has_key(ret[0]):
|
||||||
(f, t, n, c) = py_return_types[ret[0]]
|
(f, t, n, c) = py_return_types[ret[0]]
|
||||||
c_return = " %s c_retval;\n" % (ret[0])
|
c_return = " %s c_retval;\n" % (ret[0])
|
||||||
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
c_call = "\n c_retval = %s(%s);\n" % (name, c_call)
|
||||||
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
|
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
|
||||||
ret_convert = ret_convert + " return py_retval;\n"
|
ret_convert = ret_convert + " return py_retval;\n"
|
||||||
else:
|
else:
|
||||||
@ -705,31 +705,31 @@ def print_function_wrapper(module, name, output, export, include):
|
|||||||
|
|
||||||
include.write("PyObject * ")
|
include.write("PyObject * ")
|
||||||
if module == "libvirt":
|
if module == "libvirt":
|
||||||
include.write("libvirt_%s(PyObject *self, PyObject *args);\n" % (name));
|
include.write("libvirt_%s(PyObject *self, PyObject *args);\n" % (name))
|
||||||
export.write(" { (char *)\"%s\", libvirt_%s, METH_VARARGS, NULL },\n" %
|
export.write(" { (char *)\"%s\", libvirt_%s, METH_VARARGS, NULL },\n" %
|
||||||
(name, name))
|
(name, name))
|
||||||
elif module == "libvirt-lxc":
|
elif module == "libvirt-lxc":
|
||||||
include.write("libvirt_lxc_%s(PyObject *self, PyObject *args);\n" % (name));
|
include.write("libvirt_lxc_%s(PyObject *self, PyObject *args);\n" % (name))
|
||||||
export.write(" { (char *)\"%s\", libvirt_lxc_%s, METH_VARARGS, NULL },\n" %
|
export.write(" { (char *)\"%s\", libvirt_lxc_%s, METH_VARARGS, NULL },\n" %
|
||||||
(name, name))
|
(name, name))
|
||||||
elif module == "libvirt-qemu":
|
elif module == "libvirt-qemu":
|
||||||
include.write("libvirt_qemu_%s(PyObject *self, PyObject *args);\n" % (name));
|
include.write("libvirt_qemu_%s(PyObject *self, PyObject *args);\n" % (name))
|
||||||
export.write(" { (char *)\"%s\", libvirt_qemu_%s, METH_VARARGS, NULL },\n" %
|
export.write(" { (char *)\"%s\", libvirt_qemu_%s, METH_VARARGS, NULL },\n" %
|
||||||
(name, name))
|
(name, name))
|
||||||
|
|
||||||
if file == "python":
|
if file == "python":
|
||||||
# Those have been manually generated
|
# Those have been manually generated
|
||||||
if cond != None and cond != "":
|
if cond != None and cond != "":
|
||||||
include.write("#endif\n");
|
include.write("#endif\n")
|
||||||
export.write("#endif\n");
|
export.write("#endif\n")
|
||||||
output.write("#endif\n");
|
output.write("#endif\n")
|
||||||
return 1
|
return 1
|
||||||
if file == "python_accessor" and ret[0] != "void" and ret[2] is None:
|
if file == "python_accessor" and ret[0] != "void" and ret[2] is None:
|
||||||
# Those have been manually generated
|
# Those have been manually generated
|
||||||
if cond != None and cond != "":
|
if cond != None and cond != "":
|
||||||
include.write("#endif\n");
|
include.write("#endif\n")
|
||||||
export.write("#endif\n");
|
export.write("#endif\n")
|
||||||
output.write("#endif\n");
|
output.write("#endif\n")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
output.write("PyObject *\n")
|
output.write("PyObject *\n")
|
||||||
@ -756,9 +756,9 @@ def print_function_wrapper(module, name, output, export, include):
|
|||||||
if c_convert != "":
|
if c_convert != "":
|
||||||
output.write(c_convert + "\n")
|
output.write(c_convert + "\n")
|
||||||
|
|
||||||
output.write(" LIBVIRT_BEGIN_ALLOW_THREADS;");
|
output.write(" LIBVIRT_BEGIN_ALLOW_THREADS;")
|
||||||
output.write(c_call);
|
output.write(c_call)
|
||||||
output.write(" LIBVIRT_END_ALLOW_THREADS;\n");
|
output.write(" LIBVIRT_END_ALLOW_THREADS;\n")
|
||||||
output.write(ret_convert)
|
output.write(ret_convert)
|
||||||
output.write("}\n\n")
|
output.write("}\n\n")
|
||||||
if cond != None and cond != "":
|
if cond != None and cond != "":
|
||||||
@ -1195,7 +1195,7 @@ def writeDoc(module, name, args, indent, output):
|
|||||||
if funcs[name][0] is None or funcs[name][0] == "":
|
if funcs[name][0] is None or funcs[name][0] == "":
|
||||||
return
|
return
|
||||||
val = funcs[name][0]
|
val = funcs[name][0]
|
||||||
val = string.replace(val, "NULL", "None");
|
val = string.replace(val, "NULL", "None")
|
||||||
output.write(indent)
|
output.write(indent)
|
||||||
output.write('"""')
|
output.write('"""')
|
||||||
i = string.find(val, "\n")
|
i = string.find(val, "\n")
|
||||||
@ -1261,7 +1261,7 @@ def buildWrappers(module):
|
|||||||
ctypes_processed[type] = ()
|
ctypes_processed[type] = ()
|
||||||
|
|
||||||
for name in functions.keys():
|
for name in functions.keys():
|
||||||
found = 0;
|
found = 0
|
||||||
(desc, ret, args, file, mod, cond) = functions[name]
|
(desc, ret, args, file, mod, cond) = functions[name]
|
||||||
for type in ctypes:
|
for type in ctypes:
|
||||||
classe = classes_type[type][2]
|
classe = classes_type[type][2]
|
||||||
@ -1331,7 +1331,7 @@ def buildWrappers(module):
|
|||||||
classes.write("%s" % arg[0])
|
classes.write("%s" % arg[0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
classes.write("):\n")
|
classes.write("):\n")
|
||||||
writeDoc(module, name, args, ' ', classes);
|
writeDoc(module, name, args, ' ', classes)
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
@ -1340,19 +1340,19 @@ def buildWrappers(module):
|
|||||||
classes.write(" else: %s__o = %s%s\n" %
|
classes.write(" else: %s__o = %s%s\n" %
|
||||||
(arg[0], arg[0], classes_type[arg[1]][0]))
|
(arg[0], arg[0], classes_type[arg[1]][0]))
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
classes.write(" ret = ");
|
classes.write(" ret = ")
|
||||||
else:
|
else:
|
||||||
classes.write(" ");
|
classes.write(" ")
|
||||||
classes.write("libvirtmod.%s(" % name)
|
classes.write("libvirtmod.%s(" % name)
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if n != 0:
|
if n != 0:
|
||||||
classes.write(", ");
|
classes.write(", ")
|
||||||
classes.write("%s" % arg[0])
|
classes.write("%s" % arg[0])
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
classes.write("__o");
|
classes.write("__o")
|
||||||
n = n + 1
|
n = n + 1
|
||||||
classes.write(")\n");
|
classes.write(")\n")
|
||||||
|
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
if classes_type.has_key(ret[0]):
|
if classes_type.has_key(ret[0]):
|
||||||
@ -1360,15 +1360,15 @@ def buildWrappers(module):
|
|||||||
# Raise an exception
|
# Raise an exception
|
||||||
#
|
#
|
||||||
if functions_noexcept.has_key(name):
|
if functions_noexcept.has_key(name):
|
||||||
classes.write(" if ret is None:return None\n");
|
classes.write(" if ret is None:return None\n")
|
||||||
else:
|
else:
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret is None:raise libvirtError('%s() failed')\n" %
|
" if ret is None:raise libvirtError('%s() failed')\n" %
|
||||||
(name))
|
(name))
|
||||||
|
|
||||||
classes.write(" return ");
|
classes.write(" return ")
|
||||||
classes.write(classes_type[ret[0]][1] % ("ret"));
|
classes.write(classes_type[ret[0]][1] % ("ret"))
|
||||||
classes.write("\n");
|
classes.write("\n")
|
||||||
|
|
||||||
# For functions returning an integral type there are
|
# For functions returning an integral type there are
|
||||||
# several things that we can do, depending on the
|
# several things that we can do, depending on the
|
||||||
@ -1398,7 +1398,7 @@ def buildWrappers(module):
|
|||||||
else:
|
else:
|
||||||
classes.write(" return ret\n")
|
classes.write(" return ret\n")
|
||||||
|
|
||||||
classes.write("\n");
|
classes.write("\n")
|
||||||
|
|
||||||
for classname in classes_list:
|
for classname in classes_list:
|
||||||
if classname == "None":
|
if classname == "None":
|
||||||
@ -1441,14 +1441,14 @@ def buildWrappers(module):
|
|||||||
classes.write(" self._dom = dom\n")
|
classes.write(" self._dom = dom\n")
|
||||||
classes.write(" self._conn = dom.connect()\n")
|
classes.write(" self._conn = dom.connect()\n")
|
||||||
classes.write(" if _obj != None:self._o = _obj;return\n")
|
classes.write(" if _obj != None:self._o = _obj;return\n")
|
||||||
classes.write(" self._o = None\n\n");
|
classes.write(" self._o = None\n\n")
|
||||||
destruct=None
|
destruct=None
|
||||||
if classes_destructors.has_key(classname):
|
if classes_destructors.has_key(classname):
|
||||||
classes.write(" def __del__(self):\n")
|
classes.write(" def __del__(self):\n")
|
||||||
classes.write(" if self._o != None:\n")
|
classes.write(" if self._o != None:\n")
|
||||||
classes.write(" libvirtmod.%s(self._o)\n" %
|
classes.write(" libvirtmod.%s(self._o)\n" %
|
||||||
classes_destructors[classname]);
|
classes_destructors[classname])
|
||||||
classes.write(" self._o = None\n\n");
|
classes.write(" self._o = None\n\n")
|
||||||
destruct=classes_destructors[classname]
|
destruct=classes_destructors[classname]
|
||||||
|
|
||||||
if not class_skip_connect_impl.has_key(classname):
|
if not class_skip_connect_impl.has_key(classname):
|
||||||
@ -1470,7 +1470,7 @@ def buildWrappers(module):
|
|||||||
# to avoid double free
|
# to avoid double free
|
||||||
#
|
#
|
||||||
if name == destruct:
|
if name == destruct:
|
||||||
continue;
|
continue
|
||||||
if file != oldfile:
|
if file != oldfile:
|
||||||
if file == "python_accessor":
|
if file == "python_accessor":
|
||||||
classes.write(" # accessors for %s\n" % (classname))
|
classes.write(" # accessors for %s\n" % (classname))
|
||||||
@ -1487,7 +1487,7 @@ def buildWrappers(module):
|
|||||||
classes.write(", %s" % arg[0])
|
classes.write(", %s" % arg[0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
classes.write("):\n")
|
classes.write("):\n")
|
||||||
writeDoc(module, name, args, ' ', classes);
|
writeDoc(module, name, args, ' ', classes)
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
@ -1498,24 +1498,24 @@ def buildWrappers(module):
|
|||||||
(arg[0], arg[0], classes_type[arg[1]][0]))
|
(arg[0], arg[0], classes_type[arg[1]][0]))
|
||||||
n = n + 1
|
n = n + 1
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
classes.write(" ret = ");
|
classes.write(" ret = ")
|
||||||
else:
|
else:
|
||||||
classes.write(" ");
|
classes.write(" ")
|
||||||
n = 0
|
n = 0
|
||||||
classes.write("libvirtmod.%s(" % name)
|
classes.write("libvirtmod.%s(" % name)
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if n != 0:
|
if n != 0:
|
||||||
classes.write(", ");
|
classes.write(", ")
|
||||||
if n != index:
|
if n != index:
|
||||||
classes.write("%s" % arg[0])
|
classes.write("%s" % arg[0])
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
classes.write("__o");
|
classes.write("__o")
|
||||||
else:
|
else:
|
||||||
classes.write("self");
|
classes.write("self")
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
classes.write(classes_type[arg[1]][0])
|
classes.write(classes_type[arg[1]][0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
classes.write(")\n");
|
classes.write(")\n")
|
||||||
|
|
||||||
if name == "virConnectClose":
|
if name == "virConnectClose":
|
||||||
classes.write(" self._o = None\n")
|
classes.write(" self._o = None\n")
|
||||||
@ -1528,7 +1528,7 @@ def buildWrappers(module):
|
|||||||
#
|
#
|
||||||
if functions_noexcept.has_key(name):
|
if functions_noexcept.has_key(name):
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret is None:return None\n");
|
" if ret is None:return None\n")
|
||||||
else:
|
else:
|
||||||
if classname == "virConnect":
|
if classname == "virConnect":
|
||||||
classes.write(
|
classes.write(
|
||||||
@ -1566,9 +1566,9 @@ def buildWrappers(module):
|
|||||||
#
|
#
|
||||||
# generate the returned class wrapper for the object
|
# generate the returned class wrapper for the object
|
||||||
#
|
#
|
||||||
classes.write(" __tmp = ");
|
classes.write(" __tmp = ")
|
||||||
classes.write(classes_type[ret[0]][1] % ("ret"));
|
classes.write(classes_type[ret[0]][1] % ("ret"))
|
||||||
classes.write("\n");
|
classes.write("\n")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Sometime one need to keep references of the source
|
# Sometime one need to keep references of the source
|
||||||
@ -1586,28 +1586,28 @@ def buildWrappers(module):
|
|||||||
# Post-processing - just before we return.
|
# Post-processing - just before we return.
|
||||||
if function_post.has_key(name):
|
if function_post.has_key(name):
|
||||||
classes.write(" %s\n" %
|
classes.write(" %s\n" %
|
||||||
(function_post[name]));
|
(function_post[name]))
|
||||||
|
|
||||||
#
|
#
|
||||||
# return the class
|
# return the class
|
||||||
#
|
#
|
||||||
classes.write(" return __tmp\n");
|
classes.write(" return __tmp\n")
|
||||||
elif converter_type.has_key(ret[0]):
|
elif converter_type.has_key(ret[0]):
|
||||||
#
|
#
|
||||||
# Raise an exception
|
# Raise an exception
|
||||||
#
|
#
|
||||||
if functions_noexcept.has_key(name):
|
if functions_noexcept.has_key(name):
|
||||||
classes.write(
|
classes.write(
|
||||||
" if ret is None:return None");
|
" if ret is None:return None")
|
||||||
|
|
||||||
# Post-processing - just before we return.
|
# Post-processing - just before we return.
|
||||||
if function_post.has_key(name):
|
if function_post.has_key(name):
|
||||||
classes.write(" %s\n" %
|
classes.write(" %s\n" %
|
||||||
(function_post[name]));
|
(function_post[name]))
|
||||||
|
|
||||||
classes.write(" return ");
|
classes.write(" return ")
|
||||||
classes.write(converter_type[ret[0]] % ("ret"));
|
classes.write(converter_type[ret[0]] % ("ret"))
|
||||||
classes.write("\n");
|
classes.write("\n")
|
||||||
|
|
||||||
# For functions returning an integral type there
|
# For functions returning an integral type there
|
||||||
# are several things that we can do, depending on
|
# are several things that we can do, depending on
|
||||||
@ -1650,7 +1650,7 @@ def buildWrappers(module):
|
|||||||
# Post-processing - just before we return.
|
# Post-processing - just before we return.
|
||||||
if function_post.has_key(name):
|
if function_post.has_key(name):
|
||||||
classes.write(" %s\n" %
|
classes.write(" %s\n" %
|
||||||
(function_post[name]));
|
(function_post[name]))
|
||||||
|
|
||||||
classes.write (" return ret\n")
|
classes.write (" return ret\n")
|
||||||
|
|
||||||
@ -1692,7 +1692,7 @@ def buildWrappers(module):
|
|||||||
# Post-processing - just before we return.
|
# Post-processing - just before we return.
|
||||||
if function_post.has_key(name):
|
if function_post.has_key(name):
|
||||||
classes.write(" %s\n" %
|
classes.write(" %s\n" %
|
||||||
(function_post[name]));
|
(function_post[name]))
|
||||||
|
|
||||||
classes.write (" return ret\n")
|
classes.write (" return ret\n")
|
||||||
|
|
||||||
@ -1700,11 +1700,11 @@ def buildWrappers(module):
|
|||||||
# Post-processing - just before we return.
|
# Post-processing - just before we return.
|
||||||
if function_post.has_key(name):
|
if function_post.has_key(name):
|
||||||
classes.write(" %s\n" %
|
classes.write(" %s\n" %
|
||||||
(function_post[name]));
|
(function_post[name]))
|
||||||
|
|
||||||
classes.write(" return ret\n");
|
classes.write(" return ret\n")
|
||||||
|
|
||||||
classes.write("\n");
|
classes.write("\n")
|
||||||
# Append "<classname>.py" to class def, iff it exists
|
# Append "<classname>.py" to class def, iff it exists
|
||||||
try:
|
try:
|
||||||
extra = open(os.path.join(srcPref,"libvirt-override-" + classname + ".py"), "r")
|
extra = open(os.path.join(srcPref,"libvirt-override-" + classname + ".py"), "r")
|
||||||
@ -1726,7 +1726,7 @@ def buildWrappers(module):
|
|||||||
items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
|
items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
|
||||||
for name,value in items:
|
for name,value in items:
|
||||||
classes.write("%s = %s\n" % (name,value))
|
classes.write("%s = %s\n" % (name,value))
|
||||||
classes.write("\n");
|
classes.write("\n")
|
||||||
|
|
||||||
classes.close()
|
classes.close()
|
||||||
|
|
||||||
@ -1776,7 +1776,7 @@ def qemuBuildWrappers(module):
|
|||||||
fd.write(" if str(cyg_e).count(\"No module named\"):\n")
|
fd.write(" if str(cyg_e).count(\"No module named\"):\n")
|
||||||
fd.write(" raise lib_e\n\n")
|
fd.write(" raise lib_e\n\n")
|
||||||
|
|
||||||
fd.write("import libvirt\n\n");
|
fd.write("import libvirt\n\n")
|
||||||
fd.write("#\n# Functions from module %s\n#\n\n" % module)
|
fd.write("#\n# Functions from module %s\n#\n\n" % module)
|
||||||
#
|
#
|
||||||
# Generate functions directly, no classes
|
# Generate functions directly, no classes
|
||||||
@ -1792,12 +1792,12 @@ def qemuBuildWrappers(module):
|
|||||||
fd.write("%s" % arg[0])
|
fd.write("%s" % arg[0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
fd.write("):\n")
|
fd.write("):\n")
|
||||||
writeDoc(module, name, args, ' ', fd);
|
writeDoc(module, name, args, ' ', fd)
|
||||||
|
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
fd.write(" ret = ");
|
fd.write(" ret = ")
|
||||||
else:
|
else:
|
||||||
fd.write(" ");
|
fd.write(" ")
|
||||||
fd.write("libvirtmod_qemu.%s(" % name)
|
fd.write("libvirtmod_qemu.%s(" % name)
|
||||||
n = 0
|
n = 0
|
||||||
|
|
||||||
@ -1808,7 +1808,7 @@ def qemuBuildWrappers(module):
|
|||||||
conn = arg[0]
|
conn = arg[0]
|
||||||
|
|
||||||
if n != 0:
|
if n != 0:
|
||||||
fd.write(", ");
|
fd.write(", ")
|
||||||
if arg[1] in ["virDomainPtr", "virConnectPtr"]:
|
if arg[1] in ["virDomainPtr", "virConnectPtr"]:
|
||||||
# FIXME: This might have problem if the function
|
# FIXME: This might have problem if the function
|
||||||
# has multiple args which are objects.
|
# has multiple args which are objects.
|
||||||
@ -1816,7 +1816,7 @@ def qemuBuildWrappers(module):
|
|||||||
else:
|
else:
|
||||||
fd.write("%s" % arg[0])
|
fd.write("%s" % arg[0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
fd.write(")\n");
|
fd.write(")\n")
|
||||||
|
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
fd.write(" if ret is None: raise libvirt.libvirtError('" + name + "() failed')\n")
|
fd.write(" if ret is None: raise libvirt.libvirtError('" + name + "() failed')\n")
|
||||||
@ -1837,7 +1837,7 @@ def qemuBuildWrappers(module):
|
|||||||
items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
|
items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
|
||||||
for name,value in items:
|
for name,value in items:
|
||||||
fd.write("%s = %s\n" % (name,value))
|
fd.write("%s = %s\n" % (name,value))
|
||||||
fd.write("\n");
|
fd.write("\n")
|
||||||
|
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
@ -1888,7 +1888,7 @@ def lxcBuildWrappers(module):
|
|||||||
fd.write(" if str(cyg_e).count(\"No module named\"):\n")
|
fd.write(" if str(cyg_e).count(\"No module named\"):\n")
|
||||||
fd.write(" raise lib_e\n\n")
|
fd.write(" raise lib_e\n\n")
|
||||||
|
|
||||||
fd.write("import libvirt\n\n");
|
fd.write("import libvirt\n\n")
|
||||||
fd.write("#\n# Functions from module %s\n#\n\n" % module)
|
fd.write("#\n# Functions from module %s\n#\n\n" % module)
|
||||||
#
|
#
|
||||||
# Generate functions directly, no classes
|
# Generate functions directly, no classes
|
||||||
@ -1904,12 +1904,12 @@ def lxcBuildWrappers(module):
|
|||||||
fd.write("%s" % arg[0])
|
fd.write("%s" % arg[0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
fd.write("):\n")
|
fd.write("):\n")
|
||||||
writeDoc(module, name, args, ' ', fd);
|
writeDoc(module, name, args, ' ', fd)
|
||||||
|
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
fd.write(" ret = ");
|
fd.write(" ret = ")
|
||||||
else:
|
else:
|
||||||
fd.write(" ");
|
fd.write(" ")
|
||||||
fd.write("libvirtmod_lxc.%s(" % name)
|
fd.write("libvirtmod_lxc.%s(" % name)
|
||||||
n = 0
|
n = 0
|
||||||
|
|
||||||
@ -1920,7 +1920,7 @@ def lxcBuildWrappers(module):
|
|||||||
conn = arg[0]
|
conn = arg[0]
|
||||||
|
|
||||||
if n != 0:
|
if n != 0:
|
||||||
fd.write(", ");
|
fd.write(", ")
|
||||||
if arg[1] in ["virDomainPtr", "virConnectPtr"]:
|
if arg[1] in ["virDomainPtr", "virConnectPtr"]:
|
||||||
# FIXME: This might have problem if the function
|
# FIXME: This might have problem if the function
|
||||||
# has multiple args which are objects.
|
# has multiple args which are objects.
|
||||||
@ -1928,7 +1928,7 @@ def lxcBuildWrappers(module):
|
|||||||
else:
|
else:
|
||||||
fd.write("%s" % arg[0])
|
fd.write("%s" % arg[0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
fd.write(")\n");
|
fd.write(")\n")
|
||||||
|
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
fd.write(" if ret is None: raise libvirt.libvirtError('" + name + "() failed')\n")
|
fd.write(" if ret is None: raise libvirt.libvirtError('" + name + "() failed')\n")
|
||||||
@ -1949,7 +1949,7 @@ def lxcBuildWrappers(module):
|
|||||||
items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
|
items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1])))
|
||||||
for name,value in items:
|
for name,value in items:
|
||||||
fd.write("%s = %s\n" % (name,value))
|
fd.write("%s = %s\n" % (name,value))
|
||||||
fd.write("\n");
|
fd.write("\n")
|
||||||
|
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
opaque = cbData["opaque"]
|
opaque = cbData["opaque"]
|
||||||
|
|
||||||
cb(self, virDomain(self, _obj=dom), oldSrcPath, newSrcPath, devAlias, reason, opaque)
|
cb(self, virDomain(self, _obj=dom), oldSrcPath, newSrcPath, devAlias, reason, opaque)
|
||||||
return 0;
|
return 0
|
||||||
|
|
||||||
def _dispatchDomainEventTrayChangeCallback(self, dom, devAlias, reason, cbData):
|
def _dispatchDomainEventTrayChangeCallback(self, dom, devAlias, reason, cbData):
|
||||||
"""Dispatches event to python user domain trayChange event callbacks
|
"""Dispatches event to python user domain trayChange event callbacks
|
||||||
@ -141,7 +141,7 @@
|
|||||||
opaque = cbData["opaque"]
|
opaque = cbData["opaque"]
|
||||||
|
|
||||||
cb(self, virDomain(self, _obj=dom), devAlias, reason, opaque)
|
cb(self, virDomain(self, _obj=dom), devAlias, reason, opaque)
|
||||||
return 0;
|
return 0
|
||||||
|
|
||||||
def _dispatchDomainEventPMWakeupCallback(self, dom, reason, cbData):
|
def _dispatchDomainEventPMWakeupCallback(self, dom, reason, cbData):
|
||||||
"""Dispatches event to python user domain pmwakeup event callbacks
|
"""Dispatches event to python user domain pmwakeup event callbacks
|
||||||
@ -150,7 +150,7 @@
|
|||||||
opaque = cbData["opaque"]
|
opaque = cbData["opaque"]
|
||||||
|
|
||||||
cb(self, virDomain(self, _obj=dom), reason, opaque)
|
cb(self, virDomain(self, _obj=dom), reason, opaque)
|
||||||
return 0;
|
return 0
|
||||||
|
|
||||||
def _dispatchDomainEventPMSuspendCallback(self, dom, reason, cbData):
|
def _dispatchDomainEventPMSuspendCallback(self, dom, reason, cbData):
|
||||||
"""Dispatches event to python user domain pmsuspend event callbacks
|
"""Dispatches event to python user domain pmsuspend event callbacks
|
||||||
@ -159,7 +159,7 @@
|
|||||||
opaque = cbData["opaque"]
|
opaque = cbData["opaque"]
|
||||||
|
|
||||||
cb(self, virDomain(self, _obj=dom), reason, opaque)
|
cb(self, virDomain(self, _obj=dom), reason, opaque)
|
||||||
return 0;
|
return 0
|
||||||
|
|
||||||
def _dispatchDomainEventBalloonChangeCallback(self, dom, actual, cbData):
|
def _dispatchDomainEventBalloonChangeCallback(self, dom, actual, cbData):
|
||||||
"""Dispatches events to python user domain balloon change event callbacks
|
"""Dispatches events to python user domain balloon change event callbacks
|
||||||
@ -177,7 +177,7 @@
|
|||||||
opaque = cbData["opaque"]
|
opaque = cbData["opaque"]
|
||||||
|
|
||||||
cb(self, virDomain(self, _obj=dom), reason, opaque)
|
cb(self, virDomain(self, _obj=dom), reason, opaque)
|
||||||
return 0;
|
return 0
|
||||||
|
|
||||||
def domainEventDeregisterAny(self, callbackID):
|
def domainEventDeregisterAny(self, callbackID):
|
||||||
"""Removes a Domain Event Callback. De-registering for a
|
"""Removes a Domain Event Callback. De-registering for a
|
||||||
|
@ -128,7 +128,7 @@ while i < 30:
|
|||||||
except:
|
except:
|
||||||
okay = 0
|
okay = 0
|
||||||
t = -1
|
t = -1
|
||||||
break;
|
break
|
||||||
|
|
||||||
if t == 0:
|
if t == 0:
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user