Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/apidoc/gen_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ def choose_category(fn):

def xml_for(command):
name = command['name']
async = command['async'] and ' (A)' or ''
asyncmethod = command['async'] and ' (A)' or ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland shouldn't the header of this python file be changed from #!/cygdrive/c/Python27 to #!/cygdrive/c/Python3?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if this comment is redundant, I see that @nvazquez mentioned about changing other pieces as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the cygwin specific python is not a good idea in any case #! /bin/env python would be better.
I think this is being taken into account in ther PRs so maybe i should close, @nvazquez @GabrielBrascher ?

dirname = command['dirname']
return '''<xsl:if test="name=\'%(name)s\'">
<li><a href="%(dirname)s/%(name)s.html"><xsl:value-of select="name"/>%(async)s</a></li>
<li><a href="%(dirname)s/%(name)s.html"><xsl:value-of select="name"/>%(asyncmethod)s</a></li>
</xsl:if>
''' % locals()

Expand Down
25 changes: 12 additions & 13 deletions tools/marvin/marvin/codegenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from textwrap import dedent
import os
import sys
import urllib2
from urllib.request import urlopen


class cmdParameterProperty(object):
Expand All @@ -40,7 +40,7 @@ class cloudStackCmd(object):
def __init__(self):
self.name = ""
self.desc = ""
self.async = "false"
self.asyncmethod = "false"
self.request = []
self.response = []

Expand Down Expand Up @@ -129,7 +129,7 @@ def generate(self, cmd):
self.code += self.space + "def __init__(self):\n"

self.code += self.space + self.space
self.code += 'self.isAsync = "%s"\n' % str(self.cmd.async).lower()
self.code += 'self.isAsync = "%s"\n' % str(self.cmd.asyncmethod).lower()

for req in self.cmd.request:
if req.desc is not None:
Expand Down Expand Up @@ -305,9 +305,9 @@ def loadCmdFromXML(self, dom):
if desc:
csCmd.desc = desc

async = getText(cmd.getElementsByTagName('isAsync'))
if async:
csCmd.async = async
asyncmethod = getText(cmd.getElementsByTagName('isAsync'))
if asyncmethod:
csCmd.asyncmethod = asyncmethod

argList = cmd.getElementsByTagName("request")[0].\
getElementsByTagName("arg")
Expand Down Expand Up @@ -398,7 +398,7 @@ def loadCmdFromJSON(self, apiStream):
csCmd.desc = cmd['description']

if 'isasync' in cmd:
csCmd.async = cmd['isasync']
csCmd.asyncmethod = cmd['isasync']

for param in cmd['params']:
paramProperty = cmdParameterProperty()
Expand Down Expand Up @@ -436,7 +436,7 @@ def generateCodeFromJSON(self, endpointUrl):
@return: The classes in cloudstackAPI/ formed from api discovery json
"""
if endpointUrl.find('response=json') >= 0:
apiStream = urllib2.urlopen(endpointUrl)
apiStream = urlopen(endpointUrl)
cmds = self.loadCmdFromJSON(apiStream)
for cmd in cmds:
self.generate(cmd)
Expand Down Expand Up @@ -468,17 +468,16 @@ def getText(elements):
try:
os.mkdir(apiModule)
except:
print "Failed to create folder %s, due to %s" % (apiModule,
sys.exc_info())
print parser.print_help()
print ("Failed to create folder {0}, due to {1}".format(apiModule, sys.exc_info()))
print (parser.print_help())
exit(2)

apiSpecFile = "/etc/cloud/cli/commands.xml"
if options.spec is not None:
apiSpecFile = options.spec
if not os.path.exists(apiSpecFile):
print "the spec file %s does not exists" % apiSpecFile
print parser.print_help()
print ("the spec file %s does not exists" % apiSpecFile)
print (parser.print_help())
exit(1)

cg = CodeGenerator(folder)
Expand Down