[core] add quotes on strings

to deal with space characters on command line
This commit is contained in:
Fabien Castan 2018-01-05 16:59:31 +01:00
parent 576124a342
commit 8e1452d5bc
3 changed files with 5 additions and 3 deletions

View file

@ -249,6 +249,8 @@ class Attribute(BaseObject):
if isinstance(self.attributeDesc, desc.ChoiceParam) and not self.attributeDesc.exclusive: if isinstance(self.attributeDesc, desc.ChoiceParam) and not self.attributeDesc.exclusive:
assert(isinstance(self.value, collections.Sequence) and not isinstance(self.value, basestring)) assert(isinstance(self.value, collections.Sequence) and not isinstance(self.value, basestring))
return self.attributeDesc.joinChar.join(self.value) return self.attributeDesc.joinChar.join(self.value)
if isinstance(self.attributeDesc, (desc.StringParam, desc.File)):
return '"{}"'.format(self.value)
return str(self.value) return str(self.value)
def isDefault(self): def isDefault(self):
@ -825,7 +827,7 @@ class Node(BaseObject):
**cmdVars) **cmdVars)
attr._invalidationValue = attr.attributeDesc.value.format( attr._invalidationValue = attr.attributeDesc.value.format(
**cmdVarsNoCache) **cmdVarsNoCache)
v = attr.value v = attr.getValueStr()
cmdVars[name] = '--{name} {value}'.format(name=name, value=v) cmdVars[name] = '--{name} {value}'.format(name=name, value=v)
cmdVars[name + 'Value'] = str(v) cmdVars[name + 'Value'] = str(v)

View file

@ -179,7 +179,7 @@ class CameraInit(desc.CommandLineNode):
def buildCommandLine(self, chunk): def buildCommandLine(self, chunk):
cmd = desc.CommandLineNode.buildCommandLine(self, chunk) cmd = desc.CommandLineNode.buildCommandLine(self, chunk)
if chunk.node.viewpointsFile: if chunk.node.viewpointsFile:
cmd += ' --input ' + chunk.node.viewpointsFile cmd += ' --input "{}"'.format(chunk.node.viewpointsFile)
return cmd return cmd
def processChunk(self, chunk): def processChunk(self, chunk):

View file

@ -44,7 +44,7 @@ class SimpleFarmSubmitter(BaseSubmitter):
task = simpleFarm.Task( task = simpleFarm.Task(
name=node.nodeType, name=node.nodeType,
command='meshroom_compute --node {nodeName} {meshroomFile} {parallelArgs} --extern'.format( command='meshroom_compute --node {nodeName} "{meshroomFile}" {parallelArgs} --extern'.format(
nodeName=node.name, meshroomFile=meshroomFile, parallelArgs=parallelArgs), nodeName=node.name, meshroomFile=meshroomFile, parallelArgs=parallelArgs),
tags=tags, tags=tags,
rezPackages=[self.MESHROOM_PACKAGE], rezPackages=[self.MESHROOM_PACKAGE],